0

In R, I have a dataframe like this:

dataframe

and the following function:

doMatchPlotError<-function(errorCalculated,title){
  errorCalculated[,1]<-as.yearmon(errorCalculated[,1])
  plot<-ggplot(data = errorCalculated,aes(x=dates,y=error,group=name,colour=name,linetype=variante))+
geom_line()+
scale_x_yearmon()+
ylab("Error")+
ggtitle(title)
plot
}

but, when I execute the code, i get this error:

Error: geom_path: If you are using dotted or dashed lines, colour, size and linetype must be constant over the line

can someone please tell my where is the error?

  • Please include an example dataset that we can copy and paste instead of including the dataset as a picture. See [this question and answer](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) for some ideas on how to do that. – aosmith Nov 28 '16 at 21:56
  • What do you want to achieve? In the example above, "variante" is constant. Can you just remove ```linetype=variante```? Perhaps replace it with ```linetype="dashed"``` outside of ```aes()```? – Ott Toomet Nov 28 '16 at 23:47

0 Answers0