【问题标题】:Switching axis in R histogram在 R 直方图中切换轴
【发布时间】:2013-09-17 01:32:52
【问题描述】:

直方图中的X轴和Y轴应该如何切换?:

hist(Minimum)

另外,我想让 X 轴范围从 0 到 30。 我对 R 编程非常陌生,非常感谢这里的任何帮助。

【问题讨论】:

  • 使用hist 的输出然后构造一个水平条形图。见?hist
  • 展开:figs <- hist(Minimum); barplot(figs$counts,horiz=TRUE);
  • function hist 来自基本图形,但您的问题标有 ggplot。我下面的回答只适用于后者。

标签: r graphics plot ggplot2 visualization


【解决方案1】:

使用函数 coord_flip 添加到您的 ggplot 直方图中:

plot = ggplot(...) + ...

plot + coord_flip()

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多