使用labeller更改facet_grid中的标签并包含%符号吗?

时间:2019-09-25 19:40:04

标签: r ggplot2 symbols facet-grid

我想更改facet_grid中的标签,并且需要在上标中使用O来获取“ tCO 0%”。在0后添加%符号时,以下代码发送错误:

解析错误(text = as.character(values)):   :1:11:意外输入 1:RNA-tC ^ O〜0%               ^

data <- read.csv("dotplothisto.csv", header = TRUE, sep=";")

levels(data$Treatment) <- c("Control", "RNA-tC^O~0%","RNA-tC^O~25%", "RNA-tC^O~50%", "RNA-tC^O~75%", "RNA-tC^O~100%", "Cy5-mRNA")

Scatterplot <- data %>% ggplot(aes(x, y, group = Treatment))+
  facet_grid(.~Treatment, labeller = label_parsed)+ 
  scale_x_log10(limits=c(1,10000), breaks = trans_breaks("log10", function(x) 10^x),
                labels = trans_format("log10", math_format(10^.x))) +
  geom_point(aes(color=MFI_GFP), shape=20)+
  scale_color_gradient(trans = "log", low="grey", high="green", guide = FALSE)+

print(Scatterplot)
´´´

0 个答案:

没有答案