How to write micro symbol in ggplot 2 legend
1
0
Entering edit mode
9.3 years ago
Nitin ▴ 170

Hello,

I am trying to plot line plot using ggplot2 in R. I want to use a micro symbol in legend labels. I am using following code

lineplot <- 
  ggplot(meltDat, aes(x = num, y = value, group = variable, color = variable)) + 
  geom_line() + xlab("Time in seconds") + ylab("scattering") + 
  scale_color_manual(
    values=c("darkorange","orange3","orange","steelblue3","royalblue3","steelblue3"),
    breaks=c("CSonly","CS","CS+H+BV","CS+HS+14","CS+HSP+28microM"),
    labels=c("CS only","CS + HS","CS + HSP + B",
             "CS + HS + C bquote (14 muM)","CS + HS + C 7 (28 micro Molar)"))

Unfortunately, it is not working.

Can anybody suggest some piece of code to do this?

Thanks,
Nit

R ggplot2 • 6.9k views
ADD COMMENT
2
Entering edit mode

Making presentation/publication-ready pictures with R sometimes can be painful (legends/fonts/special characters/...). For many purposes it can be useful to make a pdf-export of your plot and format your plot in a scalable vector graphics editor like Inkscape or Illustrator

ADD REPLY
1
Entering edit mode
9.3 years ago

Your google-fu needs strengthening: https://github.com/hadley/ggplot2/wiki/Plotmath

BTW, the short answer is that you need to use expression().

ADD COMMENT

Login before adding your answer.

Traffic: 2712 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6