Colour isn't the only way to tell series apart. Line styles (dashed, dotted) and markers (circles, squares) add redundancy — vital for black-and-white printing and accessibility.
Styles & markers
| Argument | Examples |
|---|---|
linestyle | "-" solid, "--" dashed, ":" dotted, "-." dash-dot |
marker | "o" circle, "s" square, "^" triangle, "x", "*" |
linewidth | line thickness (points) |
markersize | marker size (points) |
ax.plot(x, y, linestyle="--", marker="o", linewidth=2, markersize=6)# The shorthand format string: colour + marker + linestyleax.plot(x, y, "r--o") # red, dashed, circle markers
Key takeaways
- 01linestyle (-, --, :, -.) and marker (o, s, ^, x) distinguish series beyond colour.
- 02linewidth and markersize control thickness and point size.
- 03The format string "r--o" sets colour, linestyle and marker compactly.
- 04Combine colour + style for greyscale and colour-blind accessibility.
