Locked learning resources

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

Unlock This Lesson

Locked learning resources

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

Unlock This Lesson

Graph Your Data With Python and ggplot (Summary)

Using ggplot in Python allows you to build data visualizations in a very concise and consistent way. As you’ve seen, even complex and beautiful plots can be made with a few lines of code using plotnine.

In this course, you’ve learned how to:

  • Install plotnine and Jupyter Notebook
  • Combine the different elements of the grammar of graphics
  • Use plotnine to create visualizations in an efficient and consistent way
  • Export your data visualizations to files

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.

If you want to learn more about building data visualizations in Python and the underlying libraries that plotnine relies on, then you can check out:

Also, make sure to consult the plotnine documentation and take a look at the data visualization learning resource for R’s ggplot2 library, which plotnine is based on.

Download

Sample Code (.zip)

148.7 KB
Download

Course Slides (.pdf)

4.5 MB

00:00 You’ve made it all the way to the end of this course about using ggplot in Python, where you learned how to visualize your data using the plotnine library, which is a port of the ggplot2 library from the R programming language to Python.

00:14 You’ve covered a bunch of topics. We started off just talking about what is a grammar of graphics and what is a layered grammar of graphics that is applied here in programming. Then you got set up with installing plotnine, either using Anaconda or a virtual environment.

00:29 Then you started to learn about the different layers that are present in a grammar of graphics. You learned about the data layer, you learned about the aesthetics layer, and also about the geometric objects layer—these three being the most important ones that you always have to arrange if you want to display some data with plotnine.

00:48 And then you learned about a couple of other layers as well: for example, the statistical transformations you can apply, or also scales, as well as coordinate systems.

00:58 And then you also learned about different themes that you can put on top of this just to give your graphs a different look and feel. Finally, you learned how you can export those graphs that you created to save them as separate files.

01:11 This sums up the course about working with plotnine in Python, and check out the description on this lesson for a couple of links that lead you forward for your next steps if you want to learn more about the grammar of graphics or data visualization with Python. Thanks for joining! My name is Martin, and have a good day!

01:29 See you around!

Become a Member to join the conversation.