我想在 ggplot2 条形图的分面标签中使用希腊字符、拉丁字符和百分号。希腊字符可以用 'facet_grid(.~variable, labeller=label_parsed)' 完成:
a<-c("Delta~V","VarcoV","Delta~V","VarcoV")
b<-c(1,2,3,4)
d<-c("one","one","two","two")
mydata<-data.frame(cbind(b,a,d))
ggplot(mydata,aes(x=d,y=b))+facet_grid(.~a, labeller=label_parsed)+geom_bar(stat="identity")
现在我还想添加一个包含 % 和拉丁字符的构面标签:
a<-c("Delta~V","VarcoV","%V","Delta~V","VarcoV","%V")
b<-c(1,2,3,4,5,6)
d<-c("one","one","one","two","two","two")
mydata<-data.frame(cbind(b,a,d))
ggplot(mydata,aes(x=d,y=b))+facet_grid(.~a, labeller= label_parsed)+geom_bar(stat="identity")
这会产生以下错误:
Error in parse(text = x) : <text>:1:1: unexpected input
1: %V
^
任何想法如何包括百分号?