Languages

Matplotlib Cheat Sheet

Print-ready cheat sheet for Matplotlib, organized for fast lookup, study, and desk-side use

Source
Matplotlib Documentation (matplotlib.org)
License
MIT
Variants
3 download options
Updated
2026-03-27

Sample

What's in this cheat sheet

Line Plot

import matplotlib.pyplot as plt
x = [1, 2, 3, 4, 5]
y = [2, 4, 1, 8, 3]
plt.plot(x, y)
plt.show()

Quick Plot Shortcuts

plt.plot(y)              # x auto 0..N-1
plt.plot(x, y, "ro--")  # red circles, dashed
plt.plot(x, y, "bs-")   # blue squares, solid

Format String Codes

`r` `g` `b` `k`Red, green, blue, black
`o` `s` `^` `D`Circle, square, triangle, diamond markers
`-` `--` `-.` `:`Solid, dashed, dash-dot, dotted lines

Download the full cheat sheet for all sections, formatted for print

Download PDF

Downloads

Choose the treatment that matches how you read

Text formats

Copy or download as plain text

Download Markdown

Best for copying commands, snippets, and config into notes, prompts, or docs

Download Markdown

Preview

The web preview is for quick browsing. The PDF remains the authoritative print artifact

Open in Browser