Search icon CANCEL
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
R Graph Essentials

You're reading from  R Graph Essentials

Product type Book
Published in Sep 2014
Publisher
ISBN-13 9781783554553
Pages 190 pages
Edition 1st Edition
Languages

Table of Contents (11) Chapters

R Graph Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Base Graphics in R – One Step at a Time 2. Advanced Functions in Base Graphics 3. Mastering the qplot Function 4. Creating Graphs with ggplot Index

Creating attractive color schemes


You saw how to use scale_color_brewer to create various color schemes, starting with a range of blues (the default color scheme). While using this function, you must select the palette you wish to use. The scale_color_brewer() function uses syntax like this:

scale_color_brewer(..., type =  , palette = )

You can select either seq (sequential), div (diverging), or qual (qualitative). Within those options, you can then select a particular palette, where the available palettes control color schemes. Further information on scale_color_brewer() can be found at http://docs.ggplot2.org/current/scale_brewer.html.

Try all of the following lines of syntax yourself:

 P + geom_point(aes(color = factor(ETH)), size=I(4)) + scale_color_brewer(type="div") 

 P + geom_point(aes(color = factor(ETH)), size=I(4)) + scale_color_brewer(palette="Greens") 

 P + geom_point(aes(color = factor(ETH)), size=I(4)) + scale_color_brewer(type="seq", palette=3) 

 P + geom_point(aes(color...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}