【发布时间】:2016-02-02 17:29:25
【问题描述】:
我想在绘图顶部添加一些与 x 轴对齐的标签。如何将 cm3 的位移添加到该图的顶部,以便底部有立方英寸,顶部有立方厘米?我应该用注释来做吗?刻度线呢?我意识到在这种情况下这会产生一个丑陋的图表。 [为清楚起见进行了编辑。]
# Calculate displacement in cm3 -- add this to top of plot
# above 100, 200, 300, 400 ticks and labels for cubic inches on bottom
cm3.lab <- seq(100,400,100) * 16.3871
p <- ggplot(mtcars, aes(disp, mpg))
p + geom_point(size=5) + xlab("Cubic inches")
p
【问题讨论】:
-
p + geom_point(size=5) + xlab("立方英寸") 好像给你想要的