我试图找到一种方法来创建一个图,其中每个点与图中的每个点相连。像这样:
我尝试了一些基本的ggplot几何体(线,路径,线段),但似乎我必须在绘图之前以某种方式操纵数据集。
有没有办法不编辑数据框?
示例数据框:
dput(df)
structure(list(x = c(180704, 180114, 179618, 179489, 180627),
y = c(332717, 330803, 330458, 331633, 330190), cadmium = c(2.8,
0.2, 0.8, 7, 2.7), copper = c(35, 27, 23, 65, 27), lead = c(123,
64, 66, 141, 124), zinc = c(402, 192, 199, 659, 375), elev = c(8.99,
9.404, 7.61, 7.2, 8.261), dist = c(0.0975136, 0.575752, 0.30971,
0.0316663, 0.0122243), om = c(7.2, 7.5, 6.5, 14.8, 5.5),
ffreq = structure(c(1L, 2L, 2L, 1L, 3L), .Label = c("1",
"2", "3"), class = "factor"), soil = structure(c(1L, 3L,
1L, 1L, 3L), .Label = c("1", "2", "3"), class = "factor"),
lime = structure(c(2L, 1L, 1L, 2L, 1L), .Label = c("0", "1"
), class = "factor"), landuse = structure(c(5L, 10L, 15L,
15L, 15L), .Label = c("Aa", "Ab", "Ag", "Ah", "Am", "B",
"Bw", "DEN", "Fh", "Fw", "Ga", "SPO", "STA", "Tv", "W"), class = "factor"),
dist.m = c(140, 500, 420, 20, 40)), .Names = c("x", "y",
"cadmium", "copper", "lead", "zinc", "elev", "dist", "om", "ffreq",
"soil", "lime", "landuse", "dist.m"), row.names = c("22", "114",
"105", "64", "164"), class = "data.frame")