Arabic (RTL) language on G plot

I am using a mac.. but I can't get my R code to recognize arabic? I am not familiar with plotly. It shows question mark and I am sure its not reading in my cairo graphics.
library(tidyverse)
library(magick)
library(Cairo)
install.packages('Cairo', type = 'source')

Download Fira Sans Condensed from

Fira Sans Condensed - Google Fonts

high_mean <- 12
high_sd <- 4
flat_mean <- 35
flat_sd <- 12

plt<-ggplot(tibble(x = c(0, 70)), aes(x = x)) +
stat_function(geom = "area", fun = dnorm, n = 1000,
args = list(mean = high_mean, sd = high_sd),
fill = "darkred", alpha = 0.8) +
stat_function(geom = "area", fun = dnorm, n = 1000,
args = list(mean = flat_mean, sd = flat_sd),
fill = "darkgrey", alpha = 0.8) +
geom_hline(yintercept = dnorm(flat_mean, flat_mean, flat_sd),
linetype = "61", color = "grey75") +
annotate(geom = "text", x = qnorm(0.5, high_mean, high_sd),
y = dnorm(qnorm(0.5, high_mean, high_sd), high_mean, high_sd) / 2,
label = "Without\nprotective\nmeasures", color = "white",
family = "Fira Sans Condensed", fontface = "bold") +
annotate(geom = "text", x = qnorm(0.5, flat_mean, sd = flat_sd),
y = dnorm(qnorm(0.5, flat_mean, sd = flat_sd), flat_mean, sd = flat_sd) / 2,
label = "With protective\nmeasures", color = "white",
family = "Fira Sans Condensed", fontface = "bold") +
annotate(geom = "text", x = 45, y = dnorm(flat_mean, flat_mean, sd = flat_sd),
label = "Healthcare system capacity", vjust = -0.5, hjust = 0,
family = "Fira Sans Condensed ", fontface = "bold") +
labs(x = "Time since first case",
y = "# of\ncases",
title = "كلذع!!",
subtitle = "Slow down community spread by social distancing",
caption = "Adapted from the CDC and The Economist\nVisit flattenthecurve.com") +
scale_x_continuous(expand = c(0, 0)) +
scale_y_continuous(expand = c(0, 0)) +
theme_minimal(base_family = "Fira Sans Condensed Light") +
theme(panel.grid = element_blank(),
axis.line = element_line(color = "black"),
axis.text = element_blank(),
axis.title = element_text(family = "Fira Sans Condensed", face = "bold"),
axis.title.y = element_text(angle = 0, vjust = 0.5),
plot.title = element_text(family = "Fira Sans Condensed", face = "bold", size = rel(1.7)),
plot.subtitle = element_text(size = rel(1.2), color = "grey50"),
plot.caption = element_text(color = "grey50"))
ggsave("flatten_the_curve.png",
plt,
width = 6, height = 4,
units = "in",
device = cairo_png)

ggsave("flatten_the_curve.png",
plt,
width = 8, height = 6,
units = "in", dpi = 96)Rplot01

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.