R Geom_点和ggboxplot以及ggplot中所有打印点的配对不正确

R Geom_点和ggboxplot以及ggplot中所有打印点的配对不正确,r,ggplot2,plot,pairing,R,Ggplot2,Plot,Pairing,我正在尝试一些简单的方框图,但是注意到我在数据框中得到的点只是在ggplot中绘制错误,在上述所有类型的图中 我的数据是 structure(list(rownum = 1:74, Device = c("Dexcom", "Dexcom", "Dexcom", "Dexcom", "Dexcom", "Dexcom", "Dexcom", "D

我正在尝试一些简单的方框图,但是注意到我在数据框中得到的点只是在ggplot中绘制错误,在上述所有类型的图中

我的数据是

structure(list(rownum = 1:74, Device = c("Dexcom", "Dexcom", 
"Dexcom", "Dexcom", "Dexcom", "Dexcom", "Dexcom", "Dexcom", "Dexcom", 
"Dexcom", "Dexcom", "Dexcom", "Dexcom", "Dexcom", "Dexcom", "Libreview", 
"Libreview", "Libreview", "Libreview", "Libreview", "Libreview", 
"Libreview", "Libreview", "Libreview", "Libreview", "Libreview", 
"Libreview", "Libreview", "Diasend Manual", "Diasend Manual", 
"Diasend Manual", "Diasend Manual", "Diasend Manual", "Diasend Manual", 
"Diasend Manual", "Diasend Manual", "Diasend CGM", "Diasend Manual", 
"Diasend Manual", "Diasend Manual", "Diasend Manual", "Diasend Manual", 
"Diasend CGM", "Diasend CGM", "Diasend Manual", "Diasend Manual", 
"Diasend Manual", "Diasend Manual", "Diasend CGM", "Diasend Manual", 
"Diasend Manual", "Diasend CGM", "Diasend Manual", "Diasend Manual", 
"Diasend Manual", "Diasend Manual", "Diasend Manual", "Diasend CGM", 
"Diasend Manual", "Diasend CGM", "Diasend Manual", "Diasend Manual", 
"Diasend Manual", "Diasend CGM", "Diasend Manual", "Diasend CGM", 
"Diasend Manual", "Diasend Manual", "Diasend Manual", "Diasend Manual", 
"Diasend Manual", "Diasend Manual", "Diasend CGM", "Diasend Manual"
), PREMean = c(10.0484850182022, 7.84715557883709, 7.28766699205132, 
8.47011442894507, 10.7497970736388, 8.6565711351755, 12.2666572965045, 
12.8489327534292, 9.38152123552124, 9.82593283758822, 9.25191807020791, 
10.590004260355, 10.1991015796402, 8.11500023112837, 9.3887371146612, 
9.05289979902383, 16.3938994229184, 11.2269812823576, 8.46589333710567, 
9.45301483336544, 9.654521175124, 9.17169712793734, 5.90663637838715, 
15.1026720647773, 8.73502786461873, 12.515518913676, 10.2021609195402, 
8.88323924469535, 9.138, 10.5977853492334, 14.7827906976744, 
10.9643874643875, 8.04525252525253, 9.2234693877551, 9.2234693877551, 
13.4109826589595, 8.65916169339799, 9.07101449275362, 10.7026923076923, 
17.9097799511002, 6.05655339805825, 7.24913151364764, 7.84826142795985, 
11.6334796926454, 10.0795389048991, 9.63545878693624, 11.7388888888889, 
11.3917218543046, 8.11740335319385, 9.41461318051576, 12.9295681063123, 
10.2035994083164, 7.68975155279503, 10.249885583524, 5.79714285714286, 
10.0638826185102, 8.44704049844237, 10.6952513150205, 9.36492957746479, 
9.83008799318762, 9.6688654353562, 8.00041753653445, 9.26, 9.38389756944444, 
8.55568181818182, 8.63457241816674, 8.12372881355932, 9.84208494208494, 
11.28828125, 9.04013157894737, 11.6740659340659, 9.61797752808989, 
13.8315843798383, 10.1719101123596), POSTMean = c(8.19190208049315, 
7.61158509359437, 7.20120148352596, 8.57923580164976, 10.6268789167925, 
8.37193152150653, 12.3593220150292, 13.9380512091038, 9.30225121492054, 
8.19597861420017, 8.73307014253563, 8.23531795760565, 10.4691064145347, 
8.78835006435006, 9.48096681373489, 9.12521085925145, 13.1253985706432, 
10.2115876974231, 7.65094314018184, 11.1021567021567, 12.3527429320352, 
8.74159058145123, 6.82408707865169, 9.2207729468599, 8.33679846938776, 
11.2045885361817, 12.2492643845594, 8.41001977587343, 8.24191419141914, 
10.7707317073171, 12.2390334572491, 8.28022598870056, 7.67814207650273, 
9.48614130434783, 9.48614130434783, 11.0455128205128, 8.36162310181728, 
10.2825581395349, 10.1807407407407, 16.3283333333333, 7.56851851851852, 
6.80612244897959, 7.6510029661656, 12.1434984833165, 12.2157894736842, 
11.2797101449275, 19.1619047619048, 13.2472361809045, 8.87069342340552, 
8.40763888888889, 13.5286956521739, 10.4632632632633, 8.76877470355731, 
10.6271903323263, 8.2667701863354, 8.61640378548896, 6.96209386281588, 
8.29738799201886, 8.51794871794872, 8.10574666733237, 8.43217993079585, 
7.7244635193133, 13.9224137931034, 9.19426699426699, 8.15335753176044, 
8.30695218383485, 5.89611231101512, 9.45526315789474, 9.406875, 
9.78860759493671, 9.33200934579439, 9.406875, 11.2342145015106, 
11.2984126984127)), row.names = c(NA, -74L), na.action = structure(c(`19` = 19L, 
`30` = 30L, `38` = 38L, `39` = 39L, `42` = 42L, `44` = 44L, `51` = 51L, 
`62` = 62L, `79` = 79L, `84` = 84L), class = "omit"), class = c("tbl_df", 
"tbl", "data.frame"))
然后

ggplot(数据,aes(x=前均值,y=后均值))+geom_点() 绘制一些明显过低的点-小于5。所有数字都不少于5

用ggboxplot和ggpaired绘图也会给我太低的分数


我真是毛骨悚然,我只是不明白为什么这些点显然画得不对?请帮忙,谢谢。

正如@RichardTelford所说,您的情节与预期相符

我在答案中添加了两个图,以演示
ggplot的
默认轴比例和用户定义比例之间的差异

ggplot不知道您将如何解释轴:它只是获取每个轴的最小值和最大值,并将它们与可用空间相匹配,并尽可能做好标记标记的工作。ggplot依赖于阅读器来计算,在使用
数据的默认版本中,x轴上的次网格线表示2.5,因此x原点略大于5

如果要明确轴值和断点,必须告诉ggplot要打印什么。你有很多的灵活性:你可以设置限制,打破和规模

如果您想要一系列图的一对特定的极限和断点,那么最好创建一个函数来实现这一点;这是另一个问题的主题;您可以看看这个答案,它将刻度从0设置为数据的极限:


图书馆(GG2)
图书馆(拼凑)

我想你可能误读了量表。尝试将geom_hline(yintercept=5)+geom_vline(xintercept=5)添加到绘图中这很奇怪-我从摘要函数中获得绘图点-这是我遇到的问题。在我的原始数据框中,它肯定没有按预期绘制!有人对Summary()收集的数据有这样的问题吗?谢谢大家的帮助,我真的很感激,当我在绘图中加入刻度时,数据会表现出来。但这到底为什么是必要的呢?我不想用一个绘图来指定比例,我想对某些条目灵活一些。不太理想,我真的很担心我在r。为什么ggplot改变了积分的位置?非常感谢你的解释,至少我觉得自己有点像个白痴!你的解释非常有用,谢谢,我真的很感激。 ggplot(data, aes(x=PREMean, y=POSTMean)) + geom_point()