Learning path

Intermediate Matplotlib

Control axes and ticks, annotate what matters, show spread and uncertainty, stack data, plot pandas DataFrames and save figures for reports.

7 lessons

Start the path →
  1. Lesson Axis Limits, Ticks, and Log Scale Set axis limits, choose tick positions and labels, and switch to a log scale with set_yscale.
  2. Lesson Annotations, Text, and Reference Lines Point at important values with ax.annotate, add notes with ax.text and mark targets with axhline.
  3. Lesson Box Plots and Violin Plots Compare the spread of several groups with ax.boxplot and ax.violinplot.
  4. Lesson Stacked Bars and Area Charts Show how parts add up over time with stacked bars (bottom=) and ax.stackplot.
  5. Lesson Error Bars and Uncertainty Show measurement uncertainty with ax.errorbar and a shaded band with fill_between.
  6. Lesson Plotting pandas DataFrames Turn a pandas DataFrame into a chart with df.plot and customize it with Matplotlib.
  7. Lesson Saving Figures: savefig, DPI, and Size Save charts as PNG or SVG with fig.savefig and control their size, resolution and margins.