R 如何填充ggplot中多条线段之间的空间?

R 如何填充ggplot中多条线段之间的空间?,r,ggplot2,graph,charts,R,Ggplot2,Graph,Charts,假设在ggplot2中有以下绘图: p <- ggplot() + geom_point(aes(x=15,y=50),shape=19,fill="gray0", size=5)+ geom_point(aes(x=28, y=75),shape=19, fill="gray0", size=5)+ geom_point(aes(x=13, y=100),shape=19, fill="gray0", size=5)+ geom_segment(aes(x = 15, y

假设在ggplot2中有以下绘图:

p <- ggplot() +
  geom_point(aes(x=15,y=50),shape=19,fill="gray0", size=5)+
  geom_point(aes(x=28, y=75),shape=19, fill="gray0", size=5)+
  geom_point(aes(x=13, y=100),shape=19, fill="gray0", size=5)+
  geom_segment(aes(x = 15, y = 50, xend = 28, yend = 75), size=1)+
  geom_segment(aes(x = 13, y = 100, xend = 28, yend = 75), size=1)+
  geom_segment(aes(x = 15, y = 50, xend = 13, yend = 100), size=1)

p您可以改用几何多边形:

df <- data.frame(x = c(15, 28, 13), y = c(50,75,100))

ggplot() +
      geom_point(df, mapping = aes(x = x, y = y), size = 5) +
      geom_polygon(df, mapping=aes(x = x, y = y), fill="grey")

df您可以改用几何多边形:

df <- data.frame(x = c(15, 28, 13), y = c(50,75,100))

ggplot() +
      geom_point(df, mapping = aes(x = x, y = y), size = 5) +
      geom_polygon(df, mapping=aes(x = x, y = y), fill="grey")

df假设我需要使用一系列geom_段进行形状构造。有没有办法填充几何图形段之间的空间?假设我需要使用一系列几何图形段进行形状构造。那么,有没有办法填充几何图形段之间的空间呢?我建议先退后一步,阅读一些ggplot教程。在线文档提供了几个链接
ggplot
通常在数据帧上工作,而不仅仅是手动输入单个数字,它还可以处理长格式的数据,这样您就不会多次调用同一个geom来执行相同的操作。现在没有任何信息表明一个片段与另一个片段有任何关系,或者对其中的空间有任何意义。我建议先退后一步,阅读一些ggplot教程。在线文档提供了几个链接
ggplot
通常在数据帧上工作,而不仅仅是手动输入单个数字,它还可以处理长格式的数据,这样您就不会多次调用同一个geom来执行相同的操作。现在没有任何信息表明一个片段与另一个片段有任何关系,或者说它们内部的空间有任何意义