用重复点绘制数据 [英] Plot data with duplicate points
本文介绍了用重复点绘制数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你能告诉我,有没有其他方法可以比这个更好地绘制重复数据?这个图中的重复不清楚。
p + geom_text(aes(x =抖动(输出$经度),y =
抖动(输出$纬度)),check_overlap = FALSE,size = 5)
p + geom_point(position =jitter)
在一个特定点上显示重复的目的是显示出现的次数。
解决方案
为了可视化重复点,您可以: b 代码: 剧情: geom_jitter
)
alpha $ c $ (例如,
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屋!
查看全文