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