Jump to ratings and reviews
Rate this book

R Graphics Cookbook: Practical Recipes for Visualizing Data

Rate this book
This practical guide provides more than 150 recipes to help you generate high-quality graphs quickly, without having to comb through all the details of R's graphing systems. Each recipe tackles a specific problem with a solution you can apply to your own project, and includes a discussion of how and why the recipe works.

Most of the recipes use the ggplot2 package, a powerful and flexible way to make graphs in R. If you have a basic understanding of the R language, you're ready to get started.


Use R's default graphics for quick exploration of data
Create a variety of bar graphs, line graphs, and scatter plots
Summarize data distributions with histograms, density curves, box plots, and other examples
Provide annotations to help viewers interpret data
Control the overall appearance of graphics
Render data groups alongside each other for easy comparison
Use colors in plots
Create network graphs, heat maps, and 3D scatter plots
Structure data for graphing

416 pages, ebook

First published January 1, 2012

66 people are currently reading
484 people want to read

About the author

Winston Chang

4 books3 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
136 (45%)
4 stars
118 (39%)
3 stars
35 (11%)
2 stars
10 (3%)
1 star
3 (<1%)
Displaying 1 - 21 of 21 reviews
Profile Image for Jesse Smith.
41 reviews
May 27, 2020
This book inspired some of the nicest plots in my Master's thesis, and helped me out of a few coding jams. The "recipe" structure is really effective: problems are organized logically between the chapters, making their solutions easy to index.

I guess its major problem is that for a book about programming graphics it might age especially fast. Most of the recipes are based on the ggplot2 package, which is very in vogue for now. It might've been wise to include more base alternatives to keep this book relevant after ggplot2 is eclipsed by something else.
228 reviews6 followers
May 9, 2018
This book is about leveraging R for all your graphical needs. It starts with the graphing functions in base R using the plot function. Starting chapter 3, ggplot2 takes over.

The provides great amount of detail on how to use the ggplot and geom_* functions for most types of graphs. I don't think the author expects us to learn the syntax in one go, so for me, it'll be a go-to reference book.

I would've preferred the appendix to be one of the early chapters. I think that would help understand the basics better.
Profile Image for Daniel Morgan.
714 reviews24 followers
January 3, 2021
This was a very helpful guide to learning how to make graphics - I was surprised at the quality!
Profile Image for Michael Scott.
770 reviews159 followers
April 23, 2016
Similarly to R in a Nutshell, I picked up Winston Chang's R Graphics Cookbook because (i) I wanted to learn about R for a long time, (ii) I had a visualization project for which I needed a good automated graphing tool, and (iii) I was too sick to do anything else that day. But how to start quickly with addressing goals (i) and (ii)? Luckily for me, after about an hour of Quora- and Google-ing, I bumped into Joseph Adler's book, R in a Nutshell. Overall, and perhaps also due to (iii), I did not like this book, and I would recommend to starters (and also experienced users) to read R in a Nutshell instead.

R Graphics Cookbook tries to address the practical problems of graphing with R, which is a programming environment for building data processing and visualization pipelines. Expectedly, the recipes are only a subset of what one can readily find on Quora, and sometimes outdated. That's ok and the book remains useful for the Google-shy. However, for me the big issue of this book is the shallow level with which it treats the issues--not only it explains also why things should happen a certain way, but R in a Nutshell also tackles similar problems in greater depth. For example, consider installing packages, which R Graphics Cookbook explains with roughly the same text in its Preface, in its introduction to Chapter 1, and in Section 1.1; vs. R in a Nutshell, which explains it briefly in its Preface, then explains in detail as an example of using "The R Console", and then explains the entire family of commands related to installing/uninstalling/checking the installation of a package in "Finding and Installing Packages Inside R". (The same happens related to graphics and visualization commands.)
Profile Image for Louis.
226 reviews30 followers
February 8, 2013
If using the grammer of graphics as implemented in ggplot2 is like learning a new language, the R Graphics Cookbook is not a book that tries to teach you a new language, rather it is like learning a language through using it and is a different take on ggplot2 and graphics in R than other ggplot2 books.

ggplot2 has always presented itself as learning another language. And while it seems that a grammer of graphics is the right way to go I have always had a hard time getting a handle on it. But while the idea that you can build graphs through a grammer with a consistent meaning is elegant, sometimes you need to start by accomplishing a task. R Graphics Cookbook becomes very much like a phrase book you need to get started. Some of the earlier chapters cover categories of graphs and work you through the variations. Other chapters focus on the graph annotations, titles, axis, labels, etc. And since this is a grammer, you are assured that this is applicable to all of the types of graphs that were covered earlier.

Another aspect of this book that is helpful is the chapter on data munging. While this book focuses on graphics, the principle library, ggplot2, requires that data has been shaped into data frames before using it. But this becomes an overhead that I'm not used to coming from other graphics and plotting paradigms such as in Matlab, Python, Excel, etc. So the chapter on getting data into shape is important. This includes creating data frames, creating new data frames for purposes of generating graphics, and modifying data frames so that they yield more elegant graphics.

I still think I will have to understand the gglot2 book to understand the grammer of graphics in detail, but this book is better for me to get work done, and may make the difference between using ggplot with its elegance rather than other graphics libraries that I use when I get frustrated by the overhead to get started.


Note: I received a free electronic copy of this book through the Oreilly Bloggers program.
Profile Image for Nattawut Phetmak.
75 reviews35 followers
February 8, 2017
สำหรับคนที่รู้เรื่องทางสถิติและใช้งานภาษา R เป็นอยู่แล้ว หนังสือเล่มนี้จะช่วยให้พล๊อตกราฟได้สวยขึ้นเป็นกองผ่านไลบรารี ggplot2 ใครจะเอาดีด้านการพล๊อตกราฟไม่ควรพลาด ... แม้ว่าจะไม่ได้ใช้ภาษา R ก็ตามที เพราะแค่เปิดดูรูปผ่านๆ ก็น่าจะทำให้ได้ไอเดียของการพล๊อตกราฟที่สวยงามไปไม่น้อยเลยทีเดียว
Profile Image for Brian Romanchuk.
Author 9 books5 followers
June 8, 2015
Good quick reference

I was new to R, but wanted to set up good-looking charts. This book covered the options needed to properly format most types of charts that I used, as well as set up the annotations. I found it easier to look things up here, and then experiment with options, than too try to go through the ggplot documentation.
Profile Image for Jerzy.
555 reviews133 followers
December 3, 2015
Somewhat mistitled: should specify that it's mostly about ggplot2, not all R graphics. But it does have a few sections on specific kinds of graphs that are better done in base R or lattice than in ggplot2.

If you're trying to learn ggplot2, and find yourself constantly googling for help, it'd probably help you to take 1-2 hrs to skim this book and get a holistic feel for how things work.
Profile Image for JDK1962.
1,421 reviews20 followers
March 23, 2013
Excellent. This joins Paul Teetor's R Cookbook on my desk as a standard reference when working with R. Chapter 15 is kind of a bonus dealing with plyr and some other Hadley Wickham packages.

My "work book" for March. Trying to do one a month.
31 reviews2 followers
September 21, 2014
Not only is Winston a local hero here in the Twin Cities R community, but he's a great author and lecturer.

His book is clear, concise, and his examples are easy to follow.

If you use R and have to present information to other human beings, buy and read this book.
Profile Image for Katjp.
42 reviews
January 22, 2015
An absolute must have for anyone who produces plot using R. It will save you hours of fiddling with plotting options to get the desired result.
Profile Image for Frank.
36 reviews2 followers
August 2, 2015
really nice reference book. if you haven't been using ggplot2 for long, this will serve pretty well as your map.
Displaying 1 - 21 of 21 reviews

Can't find what you're looking for?

Get help and learn more about the design.