displayArabic: Display Arabic in ggplot

Description Usage Arguments Value Examples

View source: R/displayArabic.R

Description

This function displays Arabic characters in the correct order using the correct connections in ggplot. It calls a python file in the DisplayArabic package that reverses the order of the Arabic characters using the python-bidi module and calls the correct character form based on the character's position in the word using the python arabic-reshaper module by Abdullah Diab and contributors (see: github.com/mpcabd/python-arabic-reshaper). The object the function returns will display Arabic strings correctly in ggplot.

Usage

1
displayArabic(Arabic_string)

Arguments

Arabic_string

String you want to display in ggplot

Value

An Arabic string that will display correctly in ggplot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# An example of an Arabic plot label with and without displayArabic()
library(ggplot2) # Needed for plotting

## First, generate random points:
x <- data.frame(a=runif(10),b=runif(10))

## Plotting the points without displayArabic():
ggplot(x, aes(a,b)) +
    geom_point() +
    xlab("سلام")

## Plotting the points with displayArabic():
ggplot(x, aes(a,b)) +
    geom_point() +
    xlab(displayArabic("سلام"))

MCRoche/DisplayArabic documentation built on Nov. 12, 2020, 9:44 p.m.