R:如何在 R 散点图中的“点"上叠加饼图 [英] R: How to overlay pie charts on 'dots' in a scatterplot in R

查看:36
本文介绍了R:如何在 R 散点图中的“点"上叠加饼图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 R,我想用显示附加值的饼图替换二维散点图中的点.

Using R I would like to replace the points in a 2d scatter plot by a pie chart displaying additional values.

背后的原因是,我有数百种元素(蛋白质)的时间序列数据,这些数据来自对 4 种条件进行监测的生物实验.我想在 y 轴上绘制元素(分类数据)并在 x 轴上及时绘制事件.为了可视化这 4 个条件之间的相对发生,我想以饼图或圆环图的形式将其可视化,叠加到散点图中的相应点上.整体数据密度低,因此重叠不会成为问题.

The rational behind is that I have time series data for hundreds of elements (proteins) derived from a biological experiment monitored for 4 conditions. I would like to plot the elements (categorial data) on the y axis and occurrence of a event in time on the x axis. To visualize the relative occurrence between the 4 conditions I would like to visualize this in form of a pie chart or doughnut chart overplayed onto the respective point in the scatter plot. The overall data density is low so overlapping won't be an issue.

这在 R 中可能吗?我想在 ggplot2 中使用手动比例尺,但无法弄清楚如何将饼图定义为比例尺.

Is this possible in R? I was thinking of using a manual scale in ggplot2 but could not figure out how to define a pie chart as a scale.

同样令人感兴趣的是如何最好地聚类这些数据并相应地对其进行排序.

Also of interest would be how to best cluster this data and sort it accordingly.

推荐答案

是的.pieGlyph()Rgraphviz 包中的一个现成函数.

Yes. pieGlyph() is one ready-to-go function from the Rgraphviz package.

此外,我会查看此问答以了解如何更一般地执行此类操作:

Also, I would check out this Q/A for how to do things like this more generally:

如何用两种颜色填充图上的单个pch"点?

特别要查看 TeachingDemos 包中的 ?my.symbols.

Especially check out ?my.symbols from the TeachingDemos package.

最后,关于 ggplot2,您应该查看这篇关于可能即将推出的功能的博客文章:

Lastly, in regards to ggplot2, you should check out this blog post about possible upcoming features:

http://blog.revolutionanalytics.com/2011/10/ggplot2-for-big-data.html

这篇关于R:如何在 R 散点图中的“点"上叠加饼图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆