ggplot - 标签=标签时的y ax限制

时间:2017-08-31 12:07:20

标签: r ggplot2 axis percentage

我有一个情节,其中y轴以百分比变换;我想限制它只显示高百分比(从50%到100%),但它不起作用:

  ggplot(myData,aes(x=A_factor, y=some_numeric_data, fill=factor(Another_factor))) + 
  geom_bar(position = position_fill(reverse = TRUE),stat = "identity", color="white") +
  scale_y_continuous(labels = scales::percent, limits=c(50,100))

我也试过过labels = percent_format。

感谢。

1 个答案:

答案 0 :(得分:0)

标签下面的值是十进制表示。您的限制应设置在0和1之间。在您的情况下:

limits = c(0.5, 1)
相关问题