4
有沒有什麼辦法可以在沒有定義序列的情況下在ggplot中設置斷點步長。例如:改變軸斷點而不定義序列 - ggplot
x <- 1:10
y <- 1:10
df <- data.frame(x, y)
# Plot with auto scale
ggplot(df, aes(x,y)) + geom_point()
# Plot with breaks defined by sequence
ggplot(df, aes(x,y)) + geom_point() +
scale_y_continuous(breaks = seq(0,10,1))
# Plot with automatic sequence for breaks
ggplot(df, aes(x,y)) + geom_point() +
scale_y_continuous(breaks = seq(min(df$y),max(df$y),1))
# Does this exist?
ggplot(df, aes(x,y)) + geom_point() +
scale_y_continuous(break_step = 1)
你可能會說我是懶惰,但也出現了幾次,我不得不改變我的seq
的min
和max
限制由於添加的錯誤吧。所以我只想說...使用x的中斷大小,並帶有自動縮放限制。
尼斯一個,那真是棒極了。謝謝 – Pete900