我试图让 x 轴上两个变量的文本具有上标。我希望“+”成为上标,但无论我尝试什么,它最终都会显示整个代码。我尝试为它制作单独的标签,并尝试使其更简单
test.labs=as_labeller(c('CD4Gated' = 'CD4^+ cells', 'CD8Gated' = 'CD8^+ cells', 'Bcell'
= "B cells"), default = label_parsed)
bFICOLL + scale_x_discrete(labels=c(CD4Gated = "CD4^+ cells", CD8Gated = "CD8^+ cells",
Bcell = "B cells"))
在另一张图中(经过大量搜索!)我设法让标题包含上标和下面的代码,但它不适用于刻度标签。
ggtitle('Spring FEC &' ~~ CD4^'+' ~~ 'cells')
这是该图的代码。希望有人能够告诉我我做错了什么?
bFICOLL <- ggplot(LymphOrder, aes(x=WBC, y=Percentage, fill=Diagnosis,
shape=Diagnosis)) +
geom_violin() +
facet_wrap(~Season, scale="free")+
theme(strip.text.x = element_text(size = 30))+
geom_point(pch = 21, position = position_jitterdodge())+
scale_fill_manual(values=c("#56B4E9", "#009E73"))+
scale_shape_manual(values=c(1,2))+
theme(panel.background = element_blank(), axis.line = element_line(colour = "black"))+
theme(strip.background = element_rect( color="black", fill="#FFFFFF", size=1.5,
linetype="solid"))+
ggtitle('Lymphocyte subsets')+
theme(plot.title = element_text(size = 40, face = "bold")) +
ylab('Percentage') +
xlab("Lymphocytes")+
ylim(0,80)+
theme(axis.ticks.length = unit(5, "pt"))+
theme(axis.title.x = element_text(size=20))+
theme(axis.text.x = element_text(size=15))+
theme(axis.text.x = element_text(angle = 30, hjust = 1))+
theme(axis.text.y = element_text(size=20))+
theme(axis.title.y = element_text(size=20))+
theme(legend.title = element_blank(),
legend.text = element_text(size = 20))
bFICOLL + scale_x_discrete(labels=c(CD4Gated = "CD4^+ cells", CD8Gated = "CD8^+
cells",
Bcell = "B cells"))
Boxplot without superscript in x axis tick labels