小编use*_*709的帖子

散点图显示具有相同值的所有点

如何在R中创建散点图,以便即使在某些类别中具有相同的值,也会显示所有点.除了数据点,我希望每个类别都有平均值.

例如,如果我有两个变量的数据集,其中一个(棉花重量百分比)是因素:

dat <- structure(list(`Tensile Strength` = c(12L, 19L, 17L, 7L, 25L, 
7L, 14L, 12L, 18L, 22L, 18L, 7L, 18L, 18L, 15L, 10L, 11L, 19L, 
11L, 19L, 15L, 19L, 11L, 23L, 9L), `Cotton weight percent` = c(20L, 
30L, 20L, 35L, 30L, 15L, 25L, 20L, 25L, 30L, 20L, 15L, 25L, 20L, 
15L, 35L, 35L, 25L, 15L, 25L, 35L, 30L, 35L, 30L, 15L)), .Names = c("Tensile Strength", 
"Cotton weight percent"), class = "data.frame", row.names = c(NA, 
-25L))
Run Code Online (Sandbox Code Playgroud)

如何制作像这样的散点图:在此输入图像描述

这里,实心点是单独的观察结果,空心圆是平均观察到的拉伸强度.

statistics plot r scatter-plot

1
推荐指数
1
解决办法
2043
查看次数

标签 统计

plot ×1

r ×1

scatter-plot ×1

statistics ×1