Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 在ggplot2刻面中带有表达式()的As_标签机_R_Ggplot2 - Fatal编程技术网

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))