Convert matplotlib step drawstyles to plotly line shapes - #5697
robertoffmoura wants to merge 4 commits into
Conversation
f01fba3 to
50aeed7
Compare
35d697e to
bcbabbc
Compare
camdecoster
left a comment
There was a problem hiding this comment.
Looks good! Could you please add a changelog entry? Also, I've noticed that these tests don't run in CI. Do you know if that's intentional? It's not from a recent change that you made, but I'm curious if you know the history.
495037c to
204ed77
Compare
|
Thanks! I've added the changelog entry. Regarding the history: It looks like the original tests (in tests/test_optional/test_matplotlylib/) were intentionally skipped in 2022 (b7ba00b) because they were failing. When I added the test_renderer suite (plotly/matplotlylib/tests/test_renderer.py) (#5312), I unintentionally never wired it into run-pytest.yml. I added a dedicated test-matplotlylib job to run-pytest.yml that installs matplotlib and runs the tests across all supported Python versions (3.8–3.13). Happy to keep it in this PR, or spin it off into a separate PR if you prefer to keep this one focused purely on step plots. Let me know what you think! |
204ed77 to
bf290b2
Compare
bf290b2 to
fff1d2a
Compare
mpl_to_plotly converts plt.step plots (and any drawstyle="steps-*" line) as ordinary straight lines, connecting the points with diagonals instead of the vertical/horizontal step segments matplotlib draws.
Before: the converted trace has line.shape = None, so plotly draws diagonal connections between consecutive points.
After: the drawstyle is mapped to plotly's step shapes, matching matplotlib's geometry exactly:
Steps to reproduce: