我有一个数据框:
ID Strain value Type Gene
182 VFG007613(gi:27366370) Strain-1 0 X motY
183 VFG007614(gi:37679367) Strain-1 1 X motY
184 VFG007619(gi:27364700) Strain-1 0 X motX
185 VFG007620(gi:37681249) Strain-1 1 X motX
186 VFG007622(gi:27364235) Strain-1 0 X wza
187 VFG007623(gi:37678521) Strain-1 1 X wza
188 VFG007627(gi:37678523) Strain-1 1 X wzb
189 VFG007629(gi:27364230) Strain-1 1 X wzc
190 VFG007630(gi:37678524) Strain-1 0 X wzc
191 VFG007640(gi:37678525) Strain-1 0 X wbjD/wecB
192 VFG007653(gi:27364224) Strain-1 1 X wbfY
193 VFG007654(gi:37678548) Strain-1 0 X wbfY
194 VFG007656(gi:27364223) Strain-1 0 X wbfV/wcvB
195 VFG007657(gi:37678549) Strain-1 0 X wbfV/wcvB
196 VFG007668(gi:27367928) Strain-1 1 X GeneA
197 VFG007669(gi:37676055) Strain-1 0 X GeneA
基因的名称类似于 wbfY,最后一个字母始终为大写,因此我想使用除大写外的斜体 Gene 列来绘制 axis.text.x,如下所示:wbfY, wbjD/wecB, motY, motX, geneG, anynameA. 可以使用某些函数将所有文本绘制为斜体(genename) 除了大写斜体(:upper:):genenameD.
或者有什么办法可以做到吗?
ggplot(mydf, aes(x=Gene, y=Strain, fill = Type, alpha = value)) +
scale_fill_manual(values = c("#336666", "#006699")) +
geom_tile(colour = "grey79") +
scale_alpha_identity(guide = "none") +
coord_fixed(ratio = 2.4) +
theme_bw() +
theme(text = element_text(family = "Times New Roman"), # corresponde a todo en Time New Romans
legend.position="bottom",
legend.title = element_text(size = 14), # legend size title, corresponde a Genotype
legend.text = element_text(size = 14), # corresponde a vcgC and vcgE
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle = 90, size = 18, hjust =1, vjust = 0.5, face = "italic"),
axis.title.x = element_text(size = 15, face = "bold"),
axis.text.y = element_text(angle = 0, hjust = 1, size = 12, face = "bold"),
axis.title.y = element_text(size = 15, face = "bold")
)
在这种情况下,所有 axis.text.x 都是斜体,但我想避免使用大写!
我怎样才能做到这一点?
非常感谢