[R] Change default order of colors & line types

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Sat Feb 2 00:56:19 CET 2013


Sure. Start by reading [1] and take its advice to heart.
Then study the many ways to create factors with values ordered in sync with the color ordering. The color ordering can be set using the default, using any of the various color picker functions, or manually.

[1] http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

Soyeon Kim <yunni0731 at gmail.com> wrote:

>Dear R users,
>
>I'd like to change the default order of colors & line types.
>Especially I am using ggplot2 and using color Set1.
>In Set1, the default color order is red, blue, green, violet,.. ect.
>However, I want to put red in fourth (not first).
>Likewise, I want to change the order of default linetype. I want to
>put "solid" line in fourth.
>How can I do thses?
>
>R code to draw the graph is
>qplot(variable, power, data = m.powers, colour = method,
>linetype=method,  ylab = "Power") + geom_line(aes(group = method),
>ylim = c(0,1)) +
>  scale_colour_brewer(palette="Set1")
>
>Thank you,
>
>______________________________________________
>R-help at r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list