Here is a link to an excellent wiki that explains how to put greek symbols in ggplot2. In summary, here is what you do to obtain greek symbols
- Text Labels: Use
parse = T
inside geom_text
or annotate
.
- Axis Labels: Use
expression(alpha)
to get greek alpha.
- Facet Labels: Use
labeller = label_parsed
inside facet
.
- Legend Labels: Use
bquote(alpha == .(value))
in legend label.
You can see detailed usage of these options in the link
EDIT. The objective of using greek symbols along the tick marks can be achieved as follows
require(ggplot2);
data(tips);
p0 = qplot(sex, data = tips, geom = 'bar');
p1 = p0 + scale_x_discrete(labels = c('Female' = expression(alpha),
'Male' = expression(beta)));
print(p1);
For complete documentation on the various symbols that are available when doing this and how to use them, see ?plotmath
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…