r - using plotmath symbol in ggplot2 geom_text - legend is altered - why? -


I want to use a Plotmath symbol (x bar) to plot ggplot2. The way I do somehow, I change the legend Letter "One" suddenly appears where I am wrong

  d & lt; - data.frame (x = rnorm (10), y = rnorm (10), g = representative (c ("m", "(x, y, group = g, color = g)) + geom_point () + geom_text (X = 0, y = 0, label = "bar"), ggplot (d, aes (x, y, group = g, color = g) parse = t)   < P>    

This will fix the problem:

  ggplot (d, aes (x, y, group = g)) + Geom_point (aes (color = g)) + geom_text (X = 0, y = 0, label = "bar (x)", parse = T)   

add color only.

Or, if you < Em> annotate , comments will not be placed in legends

  ggplot (d, aes (X (Y, group = g, color = g)) + geom_point () + annotate ('text', x = 0, y = 0, label = "bar (x)", parse = t)   

will work.

Comments