Skip to content
R for the Rest of Us: A Statistics-Free Introduction comes out June 25th. Or you can read the online version today. Check it out →
R for the Rest of Us Logo

The Grammar of Graphics

If the video is not playing correctly, you can watch it in a new window

Transcript

Click on the transcript to go to that point in the video. Please note that transcripts are auto generated and may contain minor inaccuracies.

Learn More

To learn more about the grammar of graphics, start with Chapter 1 of R for Data Science or Chapter 1 of ggplot2: Elegant Graphics for Data Analysis, both of which show the basics of ggplot. The RStudio primers on visualizing data provide another great place to get started.

Two great books on the fundamentals of data visualization that include ggplot2 code are Fundamentals of Data Visualization by Claus Wilke and Data Visualization: A Practical Introduction by Kieran Healy.

Another good reference book is the R Graphics Cookbook by Winston Chang, which has “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.”

To see ggplot2 in action, check out the ggplot2 flipbook by Gina Reynolds, which shows each step in building various plots. Both the R Graph Gallery and From Data to Viz show examples of plots and provide code to make them.

Have any questions? Put them below and we will help you out!

You need to be signed-in to comment on this post. Login.

Valliappan Muthu

Valliappan Muthu

May 21, 2024

Hello

I was trying to use ggplot for a data

Figure1 <- gglplot(boxplotdata, aes (x = "name", y = "value"))+ geom_boxplot()

and I keep getting the following error:

Error in gglplot(boxplotdata, aes(x = "name", y = "value")) :

I have tried installing dependencies, removing ggplot2, reinstalled and loaded it. Still it does not work. Any solutions?'

could not find function "gglplot"

Valliappan Muthu

Valliappan Muthu

May 21, 2024

The error message was:

Error in gglplot(boxplotdata, aes(x = "name", y = "value")) : could not find function "gglplot"

David Keyes

David Keyes Founder

May 21, 2024

You've got a typo. You wrote gglplot() instead of ggplot(). Fix that and you should be good!

Valliappan Muthu

Valliappan Muthu

May 21, 2024

Oh!!

Yes Thanks

David Keyes

David Keyes Founder

May 21, 2024

Happens to me all the time. :)