相关疑难解决方法(0)

ggplot2查找最大直方图中的计数数

我有一个简短的R脚本,使用ggplot2绘制一些直方图.如何根据直方图中的最大频率(加10%)自动设置直方图中的ymax限制,即

scale_y_continuous(limits= c(0,ymax*1.1)

plot = ggplot(data, aes(myo_activity)) +
  geom_histogram(binwidth=0.5, aes(fill=..count..))
plot + scale_x_continuous(expand = c(0,0), limits = c(30,90)) + 
  scale_y_continuous(expand = c(0,0), limits = c(0,140))
Run Code Online (Sandbox Code Playgroud)

r ggplot2

7
推荐指数
1
解决办法
7166
查看次数

标签 统计

ggplot2 ×1

r ×1