Hello,
I'm plotting using ggplot and geom_line. The data is a data frame. It has this structure:
> str(dg100)
'data.frame': 78 obs. of 3 variables:
$ date_g1: Factor w/ 116 levels "jan-mar 2010",..: 91 92 93 94 95 96 97 98 99 100 ...
$ y : num 6.7 6.74 6.47 6.36 6.51 ...
$ type : chr "rate1" "rate1" "rate1" "rate1...
I had three rates (rate1, rate2, rate3) and in order to plot using the same data frame, I just used rbind and append the columns. Type, obviously, specify if the rate is 1, 2, or 3.
ggplot(data=dg100,aes(x=date_g1,y=y,col=type))+geom_line(group=1)
As you can see, the lines are not plotting in the right way. in fact, I have no idea why I don't have three colours showing the three rates. Also, I have doubts about the x-axis.
I declared the x-axis, date_g1, as factor. Can you guide me with this error? I know how to handle multiple columns and plots using one data frame, but no with geom_line.
Thanks for your time and interest.