Re: [R] legend order in ggplot2

2018-05-27 Thread Tom Hopper
John, The order of legends in ggplot2 depends on the order of factor levels in the data frame. The linetype can be matched to the factor levels using a named vector (ggplot2 basically does a lookup). The biggest problem you have here is that you’re not passing data in the right form or format

Re: [R] legend order in ggplot2

2018-05-22 Thread PIKAL Petr
eza.cz/01-dovetek/ | This email and any documents attached to it may be confidential and are subject to the legally binding disclaimer: https://www.precheza.cz/en/01-disclaimer/ From: John [mailto:miao...@gmail.com] Sent: Wednesday, May 23, 2018 3:25 AM To: PIKAL Petr Cc: r-help Subject: Re: [R] lege

Re: [R] legend order in ggplot2

2018-05-22 Thread John
ot;solid", "dashed", "dotted", "blank"), > labels=c("name_b","name_a","name_c", "other")) > > Cheers > Petr > > > -Original Message- > > From: R-help [mailto:r-help-boun...@r-project.o

Re: [R] legend order in ggplot2

2018-05-22 Thread PIKAL Petr
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of John > Sent: Tuesday, May 22, 2018 5:17 AM > To: r-help > Subject: [R] legend order in ggplot2 > > Hi, > >I'd like to graph three lines on ggplot2 and I intend the lines to be > "solid

[R] legend order in ggplot2

2018-05-21 Thread John
Hi, I'd like to graph three lines on ggplot2 and I intend the lines to be "solid", "dashed", and "dotted". The legend names are "name_b", "name_a", "name_c". I'd like to legend to present in the order: the "name_b" at the top, and "name_c" at the bottom. As a consequence, the legend is indeed i