Re: [R] Change the legend order by order function

2018-05-23 Thread S Ellison
> -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Jeff Newmiller > Subject: Re: [R] Change the legend order by order function > > [snip] > > I cannot fathom why you think name_b, name_c, name_a is a > natural result of

Re: [R] Change the legend order by order function

2018-05-23 Thread PIKAL Petr
legally binding disclaimer: https://www.precheza.cz/en/01-disclaimer/ > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Jeff > Newmiller > Sent: Wednesday, May 23, 2018 12:56 PM > To: John <miao...@gmail.com>; r-help <r-help@r-proje

Re: [R] Change the legend order by order function

2018-05-23 Thread Jeff Newmiller
There are two key concepts you seem to be unaware of regarding ggplot: 1) you really need to put your data in long format to work with multiple curves, and 2) the column containing the names of the curves should be a factor with levels in the order you wish them to be presented in the legend

[R] Change the legend order by order function

2018-05-23 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_c", "name_a". I'd like to legend to present in the order: the "name_b" at the top, and "name_a" at the bottom. Could it be done by order function