0

I am using ggplot to generate graph by reading the data from excel file. In Excel file there are some Greek Letters, like Theta. So, when I draw the graph, every things are working fine and as expected, except that Greek Letter which is replaced by ? symbol in legend.

The below is my ggplot code.

km = read.csv("LN3T0_Zab_ZabCTALL.csv",T)
km <- transform(km, Protocols= reorder(Protocols, order(Order, decreasing = F)))
plot1 <- ggplot(data=km , aes(x=Write.Ratio, y=Latency, group=Protocols, colour = Protocols, shape=Protocols)) +
  geom_errorbar(aes(ymin=Latency-Error, ymax=Latency+Error), width=2.0, colour="black") +
  geom_line(size=1.2) +
  geom_point(size=3.2)

plot1 <- plot1 + scale_y_continuous(breaks= seq(0,80,10), limits = c(0,80)) + 
  labs(x="Write Ratio") +
  scale_x_continuous(breaks = c(10,20,30,40,50,60,70,80,90,100)) + 
  labs(y="Latency (ms)")

plot1 <- plot1 + scale_colour_manual(values=c("#00ff00","#0000ff","#00ffff","#bf00ff","#ff00bf"))

plot1 <- plot1 + theme_bw() + 
  theme(legend.position="bottom") + 
  labs(fill="", colour=" ", shape=" ") + 
  theme(text = element_text(size=18)) + 
  guides(fill = guide_legend(keywidth = 0.8, keyheight = 0.01))+
  scale_shape_manual(values=c(16, 15, 18, 19, 20))

plot1

How to show the Greek letters (that is written in Excel file) in graph that is generated using ggplot?

Any help?

joran
  • 169,992
  • 32
  • 429
  • 468
  • A csv file is just a plain text file usually, not an Excel file. Do you know what encoding was used in the csv file? It's important to import your data with the proper encoding if it different than the system default. Try to create some sort of [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) so we can run the code and try it. We can't run this without sample data. – MrFlick Oct 20 '17 at 17:52
  • Yes, it is unicode UTF-8. Do you want me to send my CSV File? @ MrFlick. –  Ibrahim EL-Sanosi Oct 21 '17 at 15:08

0 Answers0