R 在ggplot2中使用镶嵌面_包裹时,通过两个轴上的相同值跟踪线性线

R 在ggplot2中使用镶嵌面_包裹时,通过两个轴上的相同值跟踪线性线,r,ggplot2,facet-wrap,R,Ggplot2,Facet Wrap,我有这个数据框: df <- structure(list(Real = c(5, 11, 11, 17, 6, 7, 11, 11, 10, 11, 13, 11, 7, 8, 8, 9, 10, 7, 7, 6, 5, 13, 8, 10, 7, 11, 4, 6, 5, 7, 9, 4, 8), Predicted = c(7.53104960942489, 8.48933218073805, 6.53527751338467, 15.5681067019339, 6.1628

我有这个数据框:

df <- structure(list(Real = c(5, 11, 11, 17, 6, 7, 11, 11, 10, 11, 
13, 11, 7, 8, 8, 9, 10, 7, 7, 6, 5, 13, 8, 10, 7, 11, 4, 6, 5, 
7, 9, 4, 8), Predicted = c(7.53104960942489, 8.48933218073805, 
6.53527751338467, 15.5681067019339, 6.16286447784273, 9.60252366514763, 
9.42571629457248, 10.2524454322055, 9.32847653546665, 9.77523370651072, 
10.3625498760624, 14.275897279353, 7.69457109139684, 7.26906167591947, 
8.07512249762137, 7.36859387534307, 10.357436237549, 7.87435765638371, 
8.74311433109198, 7.29886361235044, 7.2713976024488, 7.55669872113011, 
7.43176240945188, 13.9422570019077, 9.88336055293638, 9.63284506089816, 
5.5285713215912, 10.4119762640024, 4.76896313240313, 8.45958527511939, 
5.65034115485842, 4.12733609483675, 4.27125334429662), Tooth = c("Incisor", 
"Incisor", "Incisor", "Incisor", "Incisor", "Canine", "Canine", 
"Canine", "Canine", "Canine", "Canine", "Canine", "Premolar", 
"Premolar", "Premolar", "Premolar", "Premolar", "Premolar", "Premolar", 
"Premolar", "Premolar", "Premolar", "Premolar", "Premolar", "Premolar", 
"Premolar", "Molar", "Molar", "Molar", "Molar", "Molar", "Molar", 
"Molar")), .Names = c("Real", "Predicted", "Tooth"), row.names = c("167", 
"174", "176", "315", "321", "105", "148", "241", "272", "305", 
"314", "337", "115", "118", "131", "141", "144", "224", "227", 
"249", "253", "258", "275", "306", "323", "338", "228", "295", 
"299", "311", "312", "317", "326"), class = "data.frame")

df使用
geom\u abline
的这种方法对您不适用吗

library(ggplot2)
ggplot(data = df, aes(x = Real, y = Predicted)) +
  geom_point(color = "red") +
  geom_abline(slope = 1, intercept = 0) +
  facet_wrap(~factor(Tooth, levels = c("Incisor", "Canine", "Premolar", "Molar")), scales = "free") +
  scale_y_continuous(breaks = int_breaks) +
  scale_x_continuous(breaks = int_breaks)

不知道为什么,但在犬科动物的情节中只画了艾布琳。看我编辑的问题很奇怪,我尝试重新启动,但没有结果。我将尝试重新安装ggplot2,以防万一……就是这样,用最新版本的更新解决了问题!谢谢你,伊恩!
library(ggplot2)
ggplot(data = df, aes(x = Real, y = Predicted)) +
  geom_point(color = "red") +
  geom_abline(slope = 1, intercept = 0) +
  facet_wrap(~factor(Tooth, levels = c("Incisor", "Canine", "Premolar", "Molar")), scales = "free") +
  scale_y_continuous(breaks = int_breaks) +
  scale_x_continuous(breaks = int_breaks)