Skip to content

Upgrading matplotlib 2 to 3

Breaking2.2.5 → 3.11.2Breaking2Security2Deprecated1New34Changed17Fixed80Other12

Fetching 75 releases from GitHub…29 / 75
BreakingUpgrade verdict

2 breaking changes and 2 security fixes.

  • Rendered text can differ slightly from older versions, so image comparison tests may need looser tolerances.
  • When you add several subfigures at once, they are now laid out left to right, then top to bottom, instead of column by column.
  • Cycler validation no longer uses eval, reducing the risk of code execution from untrusted input.
  • LaTeX and PostScript handling no longer uses shell escapes, reducing the risk of command injection.
5 items need code or config changes

Requires Python >=3.11 from 3.11.0rc1 (none stated before).

Adds contourpy >=1.0.1, fonttools >=4.28.2, packaging >=20.0, pillow >=9.

Drops pytz, six.

Installs 11 packages in all (was 8).

Breaking2
Text may no longer be bit-for-bit identical to previous releases due to the font rendering stack update, so tests may need a tolerance.
Adds subfigures in row-major order, changing the order they are created.
Security2
Hardens validation of cyclers by removing eval usage.
Hardens Latex and PS calls by removing shell escapes.
Deprecated1
Re-adds matplotlib.cm.get_cmap, which will still be removed at a later date.
matplotlib.cm.get_cmap