用重复点绘制数据 [英] Plot data with duplicate points

查看:124
本文介绍了用重复点绘制数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你能告诉我,有没有其他方法可以比这个更好地绘制重复数据?这个图中的重复不清楚。



 p + geom_text(aes(x =抖动(输出$经度),y = 
抖动(输出$纬度)),check_overlap = FALSE,size = 5)
p + geom_point(position =jitter)

在一个特定点上显示重复的目的是显示出现的次数。

解决方案

为了可视化重复点,您可以: b

  • 添加抖动(例如,使用 geom_jitter
  • 降低 alpha alpha = 0.1

  • 减小点的大小(例如, size = 1

  • 更改点的形状(例如, shape = 21



  • 代码:

     #生成数据$ b $ (b)(b = rep(1,1e3)))
    #绘制数据
    库(ggplot2)
    ggplot(df,aes(variable,value))+
    geom_jitter(alpha = 0.5,size = 2,shape = 21)+
    theme_classic()

    剧情:

    p>

    Can you please tell me that is there any other way to plot data with duplication in more better way than this one ? The duplication is not clear in this plot.

     library(ggplot2)
     p <- ggplot(output, aes(output$Longitudes, output$Latitudes))
     p + geom_text(aes(x = jitter(output$Longitudes), y = 
     jitter(output$Latitudes)),check_overlap = FALSE, size =5)
     p + geom_point(position =  "jitter")
    

    The purpose of showing the duplication on a particular point is to show the occurrences.

    解决方案

    To visualize duplicate points you can:

    • Add jitter (eg., use geom_jitter)
    • Lower alpha (eg., alpha = 0.1)
    • Decrease size of points (eg., size = 1)
    • Change shape of points (eg., shape = 21)

    Code:

    # Generate data
    df <- reshape2::melt(data.frame(A = rep(0, 1e3), B = rep(1, 1e3)))
    # Plot data
    library(ggplot2)
    ggplot(df, aes(variable, value)) +
        geom_jitter(alpha = 0.5, size = 2, shape = 21) +
        theme_classic()
    

    Plot:

    这篇关于用重复点绘制数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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