This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to write micro symbol in ggplot 2 legend

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

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

1 answer

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

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

Log in to answer this question.