Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

A Summary of Layers in the Grammar of Graphics

If you want to learn more about grammars of graphics, you can check out the following resources on the topic:

Leland Wilkinson’s book is a standard lecture on this topic. Hadley Wickham’s paper, which you can read as a free PDF online, describes the basics for the implementation of a grammar of graphics in the R library ggplot2 that serves as the base for Python’s plotnine library.

00:00 At this point in the course, I want to have a quick check-in with you about the different layers of the grammar of graphics that you’ve learned about so far.

00:07 The first three were the most important ones that you saw in every case and that you always have to define. It starts off with the data layer, then you have the aesthetics layer that decides on which values you want to map to the plot, and then you also looked at geometrical objects, which is how to represent the data on your plot.

00:26 These three are the most important layers, and then there’s a couple of other ones that are often taken care of for you with reasonable defaults by plotnine.

00:35 And the ones that you looked at here were statistical transformations, then scales, and finally, in the previous video, you looked at coordinate systems. And these are six layers of the grammar of graphics, of which, again, the most important ones are 1 through 3: data, aesthetics, and geometrical objects.

00:52 And this kind of rounds off the exploration into the different layers that are accessible for you. If you’re really interested in the theory of grammars of graphics, there’s great books that we’re also going to link to in this course that you can explore some more. And in terms of layers, that’s it!

01:08 But there’s also more things that you can do with plotnine, of course, and in the next lesson, you’re going to look at themes that you can use to give your plots a different look and feel, again with just changing a small thing in your code.

01:21 See you there!

Become a Member to join the conversation.