2
是否可以在两侧将x轴限制增加1。例如,在下面的图中可以将xlimits更改为3和9?即xlim(3,9)
使用因子作为您的x轴缩放时,更改x轴限制
p <- ggplot(mtcars, aes(factor(cyl), mpg))
p + geom_boxplot()
当试图xlim()
我得到:
Error: Discrete value supplied to continuous scale
,当我尝试scale_x_continuous(limits = c(3,9))
我得到:
Error in if (zero_range(from) || zero_range(to)) return(rep(mean(to), :
missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In loop_apply(n, do.ply) :
no non-missing arguments to min; returning Inf
2: In loop_apply(n, do.ply) :
no non-missing arguments to max; returning -Inf
3: In loop_apply(n, do.ply) :
position_dodge requires constant width: output may be incorrect
是否有可能使得极限低于4(3)并且高于8(9)而不会出现错误?这样做的理由是将其与条形图进行对照。 – Getch