Search⌘ K

Basic Plotting

Explore how to use Matplotlib's pyplot module to generate high-quality 2-D and 3-D plots suitable for scientific publications. Learn to create line plots, customize figures programmatically, and apply keyword arguments for colors, markers, and line styles. This lesson helps you build reproducible and clear scientific graphs by controlling all aspects of the plot.

We'll cover the following...

Python’s 2-D and 3-D plotting library Matplotlib produces high-quality figures in a variety of formats and interactive environments. Using this library, you can generate simple plots, bar charts, scatter plots, contour plots, error charts, etc. Matplotlib makes these things a lot easier because it is easy to get started with. It has support for LaTeX formatted labels and texts.

What makes Matplotlib highly suitable for generating figures for scientific publications, is that all aspects of the figure can be controlled programmatically. This is important for reproducibility and is convenient when one needs to regenerate the figure with updated data or change its appearance.

The submodule matplotlib.pyplot provides an object-oriented interface for the plotting library.

In this course, we will import the matplotlib.pyplot module under the standard alias plt.

import matplotlib.pyplot as plt
...