【问题标题】:show percentage scale in ggMarginal plot [duplicate]在ggMarginal图中显示百分比比例[重复]
【发布时间】:2017-12-07 03:55:17
【问题描述】:

使用此代码:

ggMarginal(p1, margins = "x", size = 2, type = "histogram",
       col = "blue", fill = "orange")

我可以制作这种类型的情节:

但我想在直方图的 y 轴上显示百分比值,您能帮帮我吗?

【问题讨论】:

标签: r ggplot2


【解决方案1】:

你应该导入包(scales),应该看起来像这样

...
library('scales')
ggMarginal(p1, margins = "x", size = 2, type = "histogram",
       col = "blue", fill = "orange") + scale_y_continuous(labels=percent)

【讨论】:

  • 谢谢,但它给了我这个错误:错误 ggMarginal(p1, margins = "x", size = 2, type = "histogram", col = "blue", : non-numeric argument到二元运算符
猜你喜欢
  • 1970-01-01
  • 2018-03-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-08-08
  • 2016-07-24
  • 2023-04-02
  • 1970-01-01
相关资源
最近更新 更多