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()