I am plotting multiple time series (17) in which there are 2 variables, which means 2 values for each year for each time series, and I want to plot one variable according to the other. And then I want to join the points with lines in order of year, so that each time series will have a corresponding line joining all their points. Does anyone know how to do the line-joining part?
I am working with ggplot, here's some script, a plot I have and a screenshot of my data:
moyvar_plot <- ggplot(moyvar, aes(x=value, y=var$value, group=programme, col=variable)) +
geom_text(aes(label=variable), size=3) +
xlim(0.85, 1.4) +
ylim(0, 1.0) +
ggtitle("Variances sur 5 ans glissants des taux de croissance des nombres de couples \n en fonction des moyennes sur 5 ans glissants des taux de croissance des nombres de couples") +
xlab("Moyenne") +
ylab("Variance")
print(moyvar_plot)
In which "variable" is the year number, and I am trying to plot var$value
according to "value".
I have tried grouping my data according to "programme", which is the identifier of my different time series, and adding a geom_line, but it connects the point in order of the x axis, and I want them connected in order of year...
This is the dataset:
variable
, so do you want them to be grouped byprogramme
as well? As in, some lines are supposed to connect thevariable
numbers sequentially for eachprogramme
group? – LC-datascientist