Hello,
I am trying to add a less than equal to symbol in a ggplot2 legend text.
See sample code below. I have tried using the expression function and
\u2264. I also tried adding labels to legend.text under theme.
Neither of these 3 options work.
Please help,
Mahesh
++++++++++++++
Extra.column=ifelse(data[,covariate]>cutpoint,1,0)
Grp1 <- "\u2264 1.5"
Grp2 <- ">1.5"
Extra.column=factor(Extra.column,levels=c(0,1),labels=c(Grp1,Grp2))
data2=cbind.data.frame(data,Extra.column)
df <- ddply(data2, .(Time,Extra.column), summarize,
N = length(Yvar), meanYvar=mean(Yvar),
seYvar=sd(Yvar)/sqrt(length(Yvar)))
df = df[df$N>=10,]
PLot=ggplot(df, aes(x=AVST, y=meanYvar, shape=Extra.column)) +
scale_y_continuous(name="Mean Yvar ± SE" )+ scale_x_continuous(name="Time
(year)")+
theme(axis.text.x = element_text(size=16,colour="black"),legend.title
= element_blank(),
axis.text.y = element_text(size=16,colour="black"),plot.title =
element_text( face="bold",size=18),
legend.justification=c(0,1), legend.position=c(0,1),
axis.title.x = element_text(face="bold", colour="black",
size=16,vjust=0),
axis.title.y = element_text(face="bold", colour="black",
size=16,vjust=0.3),
legend.text = element_text(size = 12, face = "bold" )) +
ggtitle(GGTitle)+
geom_line() + geom_point(size=5) +
geom_errorbar(width=0.1, aes(ymin=meanYvar-seYvar,
ymax=meanYvar+seYvar))
PLot
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.