R 在ggplot2刻面中带有表达式()的As_标签机
在R 在ggplot2刻面中带有表达式()的As_标签机,r,ggplot2,R,Ggplot2,在 库(ggplot2) 图书馆(重塑) df您可以在此处使用label\u parsed指定标签机的类型 new.lab <- as_labeller(c(a="A",b="B",c=expression(italic("C")))) ggplot(df.m, aes(variable, value)) + geom_boxplot() + facet_wrap(~factor, labeller=new.lab) new.lab改为label\u解析如何 new.lab
库(ggplot2)
图书馆(重塑)
df您可以在此处使用label\u parsed
指定标签机的类型
new.lab <- as_labeller(c(a="A",b="B",c=expression(italic("C"))))
ggplot(df.m, aes(variable, value)) +
geom_boxplot() +
facet_wrap(~factor, labeller=new.lab)
new.lab改为label\u解析如何
new.lab <- as_labeller(c(a="A", b="B", c="italic(C)"), label_parsed)
ggplot(df.m, aes(variable, value)) +
geom_boxplot() +
facet_wrap(~factor, labeller = new.lab)
df.m$f2这似乎不适用于空格:解析错误(text=as.character(value)):1:6:意外符号1:土壤湿度。我得到了像Clay=“Clay”(“%”)和MicrobialN=“paste(N[mic])”这样的想法来解决问题,但是这个呢:R.minor=“italic(Rhinantus~minor)”,它被忽略了。小莱茵图应以斜体显示,并用空格分隔
new.lab <- as_labeller(c(a="A",b="B",c=expression(italic("C"))))
ggplot(df.m, aes(variable, value)) +
geom_boxplot() +
facet_wrap(~factor, labeller=new.lab)
new.lab <- as_labeller(c(a="A", b="B", c="italic(C)"), label_parsed)
ggplot(df.m, aes(variable, value)) +
geom_boxplot() +
facet_wrap(~factor, labeller = new.lab)
df.m$f2 <- factor(df.m$factor, labels = c("AAA", "bold(BBB)", "italic(CCC)"))
ggplot(df.m, aes(variable, value)) +
geom_boxplot() +
facet_wrap(~f2, labeller = label_parsed) +
theme(text = element_text(size = 20))