2

座標を反転し、比例棒として積み上げた棒グラフで、y スケール (現在は x スケール位置) を変更して、有意でないゼロを持たないようにしたいと思います。

私の試み:

ggplot(diamonds, aes(color, fill=cut)) + 
    geom_bar(position='fill') + coord_flip() +
    scale_y_discrete(breaks = c(0, .25, .5, .75, 1), 
        labels=c("0", ".25", ".5", ".75", "1"))

現在のプロット: ここに画像の説明を入力

4

1 に答える 1

4

私にとっては、次のように動作しscale_y_continuousます:

ggplot(diamonds, aes(color, fill=cut)) +
 geom_bar(position='fill') +
 coord_flip() +
 scale_y_continuous(breaks = c(0, .25, .5, .75, 1),
                    labels=c("0", ".25", ".5", ".75", "1"))

ここに画像の説明を入力

于 2012-10-05T06:06:17.540 に答える