1
有了這個代碼:如何啓用x軸和y軸線GGPLOT theme_classic()
library(ggplot2)
ToothGrowth$dose <- as.factor(ToothGrowth$dose)
p <- ggplot(ToothGrowth, aes(x=dose, y=len, color=dose, shape=dose)) +
geom_jitter(position=position_jitter(0.2))+
labs(title="Plot of length by dose",x="Dose (mg)", y = "Length")
p + theme_classic()
我希望得到像這樣的:
但是怎麼來的我得到這個代替:
公告缺少的x軸和y軸線。 如何啓用它?
這是theme_classic()
的具體問題。
確定一個解決方案,我也一樣:'[R版本3.3.0'和'ggplot2_2.1.0' – Jimbou
如果你看看theme_classic你會看到的定義axis.line.x和axis.line.y都設置爲element_blank。要麼自己改變這個定義,要麼你可以在包裝中使用theme_classic2。 –