0

I am trying to visualize a network of words in Urdu but failed to display Urdu words as node_text properly.

title_word_pairs %>%
  filter(n >= 100) %>%
  graph_from_data_frame() %>%
  ggraph(layout = "fr") +
  geom_edge_link(aes(edge_alpha = n, edge_width = n), edge_colour = "cyan4") +
  geom_node_point(size = 3) +
  geom_node_text(aes(label = name), repel = TRUE, 
                 point.padding = unit(0.2, "lines")) +
  theme_void()

enter image description here

I tried displayArabic function from the "DisplayArabic" package, but still it did not work.

title_word_pairs %>%
  filter(n >= 100) %>%
  graph_from_data_frame() %>%
  ggraph(layout = "fr") +
  geom_edge_link(aes(edge_alpha = n, edge_width = n), edge_colour = "cyan4") +
  geom_node_point(size = 3) +
  geom_node_text(aes(label = displayArabic(toString(name))), repel = TRUE, 
                 point.padding = unit(0.2, "lines")) +
  theme_void()

enter image description here

  • Have you tried using the {ragg} device for outputting the images? (related: https://www.tidyverse.org/blog/2021/02/modern-text-features/) I think text display, including RtL script display, is a graphics device thing. As somebody who doesn't read RtL scripts, it is unclear to me what is wrong with the display here. – teunbrand Nov 28 '22 at 07:18
  • thank you so much, I installed "ragg" package, and set dev='ragg' and it worked! – michaelhuang Nov 29 '22 at 05:33

0 Answers0