Hebrew Characters printed in reverse order on plots

Hi everyone,
I'm creating a R-markdown document output as HTML
Rendering Hebrew (RTL) language works fine except on ggplot2 elements - it reverses text order.

scale_x_discrete - does not show values at all on created plot
xlab, ylab creates reversed text

example code:

example <- data.frame(matrix(nrow = 20, ncol = 2))

example$Var1 <- sample(1:5, 20, replace = TRUE)
example$Var2 <- sample(1:12,20, replace = TRUE)

example$Var1 <- as.factor(example$Var1)

ggplot(data = example, aes(Var2)) + geom_bar(aes(fill = Var1)) +
scale_fill_manual(values = cbPalette) +
theme(text = element_text(family = "Arial Unicode MS")) +
xlab("רמת דתיות") + ylab("אחוזונים מספר ילדים") +
scale_x_discrete(labels=c("חילוני", "מסורתי", "דתי", "חרדי", "לא-יהודי"))

image

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.