如何在R中添加重复值

发布于 2025-02-04 14:18:06 字数 394 浏览 2 评论 0原文

我有一个数据集,其中y列中有重复值。当我使用ggplot绘制它们时,重复项将合并在一起,但是我需要分别绘制它们,以便所有数据点显示在图上。我不确定该怎么做,任何帮助将不胜感激!

这是我的代码:

ggplot(data, aes(x=feeding_type,y=dung_count,color=habitat))+   
  geom_point()

编辑:添加geom_point(position =“ jitter”),我得到了此图:

“

是否有有什么方法可以堆叠点,以便更明显地与每个变量一起使用哪个点?

I have a dataset where there are duplicate values in the y column. When I plot them using ggplot the duplicates are merged together, but I need them to be graphed separately so that all data points are shown on the graph. I'm not sure how to do this, any help would be appreciated!

Here is my code:

ggplot(data, aes(x=feeding_type,y=dung_count,color=habitat))+   
  geom_point()

Edit: After adding geom_point(position="jitter") I got this graph:

graph 2

Is there any way to stack the dots so that it is more obvious which points go with each variable?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文