如果我有以下数据集
#venice {VGAM}
data(venice)
#Year Largest values
1931 103 99 98 96 94 89 86 85 84 79
1932 78 78 74 73 73 72 71 70 70 69
1933 121 113 106 105 102 89 89 88 86 85
1934 116 113 91 91 91 89 88 88 86 81我如何使用上面的数据来绘制像下面这样的图表呢?其中x轴为每年,y轴为每年绘制10个数据,并给出其数据的曲施。

七年移动平均数:

根据这些评论,
df_long <- reshape2::melt(data = venice, id.vars = 'Year');
plot(value ~ Year, data = df_long, bty = 'n', type = 'p', pch = 19) 产出:

发布于 2022-11-11 19:35:55
library(VGAM)
data(venice)
df_long <- reshape2::melt(data = venice, id.vars = 'year')
plot(value ~ year, data = df_long, bty = 'n', type = 'p', pch = 19)

plot(value ~ year, data = df_long, bty = 'n', type = 'p', pch = '*')
lines(venice[ , 1 ], venice[ , -1 ] |> rowMeans(), lwd = 2, col = 'blue')

https://stackoverflow.com/questions/74406604
复制相似问题