Reputation: 147
If I have the following data set
How can I use the data above to draw a graph like the one below? Where the x-axis is for each year and the y-axis draws 10 data for each year and gives a qu shi of their data
Upvotes: 0
Views: 124
Reputation: 1614
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')
Upvotes: 1