r - 如何将点添加到 freqpoly 图?
问题描述
我用 geom_freqpoly 绘制频率图:
ggplot(all,aes(x=time,color=type))
+geom_freqpoly(size=1.3,binwidth=2160)
+theme_bw()+scale_x_datetime(breaks = date_breaks("2 hours"), labels=date_format("%H:%M"))
这个怎么做?非常感谢。
解决方案
我有同样的问题,并发现我们可以告诉 geom_point() 使用与 geom_freqpoly() 相同的 bin 和计数,如下所示:
set.seed(8675309)
df <- data.frame(x=rnorm(100))
ggplot(data=df, aes(x=x)) +
geom_freqpoly(binwidth=0.25) +
geom_point(stat="bin", aes(y=..count..), binwidth=0.25)
我希望这有帮助!
推荐阅读
- ios - Swift 隐藏视图 AVPlayerViewController
- android - 在android中以自定义字体显示webview的html内容
- python - xml Schema 验证:如何返回无效元素
- javascript - 从 jSON resp 为搜索结果添加价值
- reactjs - 网站启动时 React Redux 显示未定义
- python - Django 在我的主 url.py 中包含应用程序 url
- html - 将 CSS 文件与版本号链接以进行缓存清除
- google-chrome - UiPath:获取从网页链接的文本文件的内容
- php - 在脚本函数中运行公共函数,而不是在加载 laravel fullcalendar
- plsql - 将单词后面的子字符串提取到字符串中的特定单词