Python Histogram Plotting: NumPy, Matplotlib, Pandas & Seaborn (Overview)
In this course, you’ll be equipped to make production-quality, presentation-ready Python histogram plots with a range of choices and features.
If you have introductory to intermediate knowledge in Python and statistics, then you can use this article as a one-stop shop for building and plotting histograms in Python using libraries from its scientific stack, including NumPy, Matplotlib, Pandas, and Seaborn.
A histogram is a great tool for quickly assessing a probability distribution that is intuitively understood by almost any audience. Python offers a handful of different options for building and plotting histograms. Most people know a histogram by its graphical representation, which is similar to a bar graph:
This course will guide you through creating plots like the one above as well as more complex ones. Here’s what you’ll cover:
- Building histograms in pure Python, without use of third party libraries
- Constructing histograms with NumPy to summarize the underlying data
- Plotting the resulting histogram with Matplotlib, Pandas, and Seaborn
Free Bonus: Short on time? Click here to get access to a free two-page Python histograms cheat sheet that summarizes the techniques explained in this tutorial.
00:00 Welcome to the Real Python guide to plotting histograms with Python. In this set of videos, you’re going to learn how to put together professional looking histograms using a variety of methods. First, you’ll see how to make a histogram with pure Python and no third-party libraries.
00:16 Next, you’ll expand on that by using NumPy to set up your histogram data. Once you have your data structured properly, you’ll plot this using a couple different libraries. First, you’ll see how Matplotlib generates histograms.
00:30 Then you’ll see how Pandas uses Matplotlib to make histograms, as well as generate kernel density estimates. Finally, you’ll take a look at Seaborn, which is a plotting library that produces very nice looking charts. To wrap up, you’ll see some other Pandas tools to give you better control over your histograms.
00:49 These videos assume a basic understanding of histograms and what they’re used for, but as a quick refresher, histograms are statistical tools that allow you to quickly look at the distribution of a set of data along an axis.
01:02 They’re an excellent way to get a quick feel for your data, beyond things like mean and standard deviation. All right! Time to get to the text editor and get started.
Become a Member to join the conversation.