使用ggplot 2,我可以在軸上插入一個(gè)斷點(diǎn)嗎?我想制作一個(gè)條形圖,其中一個(gè)值比所有其他值都大得多。有不連續(xù)y軸的方法嗎?我的數(shù)據(jù)如下:df <- data.frame(a = c(1,2,3,500), b = c('a1', 'a2','a3', 'a4'))p <- ggplot(data = df, aes(x = b, y = a)) + geom_bar() p
<- p + opts(axis.text.x=theme_text(angle= 90, hjust=1)) + coord_flip()p有什么方法可以讓我的軸從1-10,然后490-500開(kāi)始運(yùn)行嗎?我想不出任何其他方法來(lái)繪制數(shù)據(jù)(除了轉(zhuǎn)換數(shù)據(jù),這是我不想做的)。[編輯2019-05-06]:8年后,需要對(duì)上述代碼進(jìn)行修改,使其與ggplot2為了創(chuàng)建相同的圖表:library(ggplot2)ggplot(df) +
aes(x = b, y = a) +
geom_col() +
coord_flip()
- 3 回答
- 0 關(guān)注
- 506 瀏覽
添加回答
舉報(bào)
0/150
提交
取消