2
我想在x軸的頂部添加一些標籤。我怎樣才能將cm3的位移添加到這個圖的頂部,這樣我的底部有立方英寸,頂部是立方厘米?我應該用註釋去做嗎?那麼刻度線呢?我意識到這在這種情況下會產生一個醜陋的圖。 [編輯的清晰度。]ggplot頂部有一個x軸,帶有不同的標籤
# 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(「Cubic inches」)似乎讓你想要 – MLavoie