0
在我的直方图中,它看起来像条是浮动的。我想删除x轴的偏移量。此外,我想-3和3显示为X轴上的点。qplot直方图中的x轴偏移量和缺失的x轴数据点(R)
我的代码:
qplot(cognitivecat, geom="histogram", binwidth = 0.5, xlab = 'CSS Scores',
ylab = 'Number of Observations') + theme_bw() + theme(
plot.background = element_blank()
,panel.grid.major = element_blank()
,panel.grid.minor = element_blank()
,panel.border = element_blank()
) + theme(axis.line.x = element_line(color="black", size = 0.25),
axis.line.y = element_line(color="black", size = 0.25))
看'expand_y_continuous'的'expand'参数。同样看看x等价物中的'breaks'参数。 –
'scale_x_continuous(breaks = c(-3,-2,-1,0,1,2,3))+ scale_y_continuous(expand = c(0,0))'帮助。谢谢!在这里找到解释:http://docs.ggplot2.org/current/scale_continuous.html – YaeVo