每日一图Marginal Histogram/Boxplot

原文链接Top 50 ggplot2 Visualizations - The Master List (With Full R Code)

If you want to show the relationship as well as the distribution in the same chart, use the marginal histogram. it has a histogram of the X and Y avriables at the margins of the scatterplot.(如果你想要在同一幅图中既展示数据之间的关系,又展示数据的分布,便可以使用marginal histogram(边缘直方图?),它可以在散点图的边缘画出X和Y变量的分布直方图)

this can be implemented using the ggMarginal() function from the 'ggExtra' package. Apart from a histogram, you could choose to draw a marginal boxplot or density plot by setting the repective type option.(marginal histogram可以通过ggExtra包的ggMarginal()函数实现,除了直方图,还可以选择画箱线图和密度图通过设置ggMarginal()函数各自的画图参数)。

完整代码

geom_count()函数 :overcome the problem of data points overlap. whereever there is more points overlap, the size of the circle gets bigger.

PS:以前一直想通过library()函数加载包之后如果不在使用这个包有没有办法将其关闭加载,今天查到了一篇文章R语言-查看加载包、卸除加载包及安装包与卸载包 - CSDN博客,可以通过detach()函数实现,比如我想关闭ggplot2,就可以使用detach("package:ggplot2")命令;如果我想查看当前环境一共加载了哪些包,可以用(.packages())命令实现(括号和点号都有哈)。

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容