R中的ggplot:如何分别设置轴标签上的对齐方式 [英] ggplot in R: how to set alignment individually on axis labels
本文介绍了R中的ggplot:如何分别设置轴标签上的对齐方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在R中有一个ggplot,它在x轴上显示三个标签.默认情况下,这些标签居中.但是,我正在寻找一种方法,以使第一个标签左对齐,将第二个标签居中,然后将第三个标签右对齐.链接的照片显示了我尝试复制的确切结果.关于如何在R中执行此操作的任何建议?
I have a ggplot in R that displays three labels on the x-axis. By default, these labels are centered. However, I am searching for a way to left-align the first label, center the second, and right-align the third label. The linked photo shows the exact result that I try to replicate. Any suggestions on how I can do this in R?
我尝试复制的标签对齐方式.
The label alignment I try to replicate.
推荐答案
qplot(100*1:3,1) + scale_x_continuous(breaks=100*c(1,2,3)) +
theme(axis.text.x = element_text(hjust=c(0,0.5,1)))
这篇关于R中的ggplot:如何分别设置轴标签上的对齐方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文