[英]Adding superscript to axis tick labels that contain / and ; for a ggplot2 object
这是一种使用scale_x_discrete
和expression
with plotmath 的方法。
library(ggplot2)
ggplot(ToothGrowth, aes(supp, len)) +
geom_bar(stat = "sum", show.legend = FALSE)+
scale_x_discrete(breaks = c("OJ", "VC"),
labels = c(expression(Cul3^"+/+"*";Ctrl"), "Some other label"))+
theme(axis.text.x = element_text(size = 18))
创建于 2022-10-04,使用reprex v2.0.2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.