This section covers:
- Creating simple plots using Matplotlib.
- Labeling plotted data.
- What is a probability distribution?
- Plotting and comparing multiple probability distributions.
Data plots are among the most valuable tools in any data scientist’s arsenal. Without good visualizations, we are effectively crippled in our ability to gleam insights from our data. Fortunately we have at our disposal the external Python Matplotlib library, which is fully optimized for outputting high-caliber plots and data visualizations.In this section, we will leverage Matplotlib to better comprehend the coin-flip probabilities that we computed in Section One.
Lets begin by installing the Matplotlib library.
Note
Call "pip install matplotlib" from the command-line terminal in order to install the Matplotlib library.
Once installation is complete, we’ll proceed to import matplotlib.pyplot
, which is the library’s main plot generation module. According to convention, the module is commonly imported using the shortened alias plt
.
Listing 2.1. Importing Matplotlib
import matplotlib.pyplot as plt