Skip to content

Matplotlib parity for subplots: format strings, shared axes, scale options, axes-coordinate text, legend() - #99

Merged
max-models merged 1 commit into
develfrom
cloud/funny-ptolemy-qm9zqn
Nov 23, 2026
Merged

max-models merged 1 commit into
develfrom
cloud/funny-ptolemy-qm9zqn

Conversation

@max-models

@max-models max-models commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

Porting a set of Matplotlib plot scripts to a Canvas (to save them with the TikZ backend) showed a few calls that Matplotlib accepts and maxplotlib did not. This adds them.

  • Format strings and short keyword names: ax.plot(x, y, "o--"), ax.plot(y) against the index, and c, ls, lw, ms, mfc, mec next to the long names (utils/plot_format.py: parse_plot_format, canonical_line_kwargs, apply_plot_format, draws_no_line). A marker-only format draws no line in the Plotly and plotext backends as well.
  • Shared axes: Canvas(sharex=..., sharey=...) with True, "all", "row", "col", in the Matplotlib, TikZ and Plotly backends.
  • Scale options: set_xscale / set_yscale pass keyword arguments through, e.g. set_yscale("symlog", linthresh=1.0).
  • Text in axes or figure coordinates: ax.text(..., transform="axes" | "figure" | "data").
  • ax.legend(**kwargs) as a method (location, font size, columns), in place of the boolean property.

Tests and docs

  • tests/test_matplotlib_parity.py: 30 tests over the backends.
  • test_plot_rejects_wrong_ndim is removed: canvas.plot(y) with a single 1D array is now valid and plots against the index.
  • Tutorial 14 (axis and layout controls) shows the new calls.

The full test suite and the pre-commit hooks pass locally.

…s, shared axes, scale options, text in axes coordinates, legend()
@max-models
max-models merged commit e16f8c7 into devel Nov 23, 2026
29 checks passed
@max-models
max-models deleted the cloud/funny-ptolemy-qm9zqn branch November 23, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant