4
test <- data.frame(
y=seq(18,41,1),
x=24:1
)
ggplot(test, aes(y=y, x=x)) + geom_bar(stat="identity", aes(width=1)) +
opts(axis.text.x = theme_blank(), axis.ticks.x = theme_blank()) +
scale_x_continuous(breaks=NULL) +
coord_cartesian(ylim = c(17, 42))
至于旋转和翻转而言,我喜欢在这个情节y轴是沿顶,什么是要倒右手x轴侧。所以酒吧是从情节的右手边出来的,最长/最高的在最上面,最短的在最下面。如果它顺时针旋转90度,然后翻转一条实现它的垂直线。
coord_flip()和scale_y_reverse()沿着正确的路径前进。
编辑:
我想这是非常接近,只需要得到Y轴图表的顶部。
ggplot(test, aes(y=y, x=x)) + geom_bar(stat="identity", aes(width=1)) +
opts(axis.text.y = theme_blank(), axis.ticks.y = theme_blank()) +
scale_x_continuous(breaks=NULL) + scale_y_reverse() + coord_flip() + scale_x_reverse()
@nzcoops对您有帮助呢? – Andrie 2012-07-19 09:05:48