Skip to content

Type trace axis ids#392

Open
RedZapdos123 wants to merge 2 commits intoplotly:mainfrom
RedZapdos123:axis-id-enums
Open

Type trace axis ids#392
RedZapdos123 wants to merge 2 commits intoplotly:mainfrom
RedZapdos123:axis-id-enums

Conversation

@RedZapdos123
Copy link
Copy Markdown

@RedZapdos123 RedZapdos123 commented Apr 28, 2026

Description:

Add typed axis-id enums for trace x_axis and y_axis setters so the API accepts explicit axis values instead of raw strings. The derive macro now uses the typed axis ids, and the affected trace tests and contour setters were updated to match.

This keeps serialization unchanged while making axis selection clearer, and less error prone.

Fixes: plotly/plotly.py#5583

Checklist:

  • I have reviewed all changes in this PR myself.
  • I have added relevant regression test cases for this fix.
  • I have run linting and formatting checks in WSL using rustfmt --check on the touched files and cargo clippy on the touched crates.
  • I have run focused tests in WSL using cargo test -p plotly --features static_export_default axis_id.

The validation screenshot of the test run, locally on WSL:

image

RedZapdos123 and others added 2 commits May 1, 2026 11:33
Signed-off-by: RedZapdos123 <redzapdos123@example.com>
- Export WEBDRIVER_PATH to reuse pre-installed runners drivers.

- Remove harmful stub fallback causing OS Error 193.

Signed-off-by: Mridankan Mandal <xerontitan90@gmail.com>
@andrei-ng
Copy link
Copy Markdown
Collaborator

andrei-ng commented May 5, 2026

Hi @RedZapdos123,

Thank you for the PR. And thank you for the work on the CI fixes.

I propose that you make a new PR with the CI fixes to separate it from this PR.

Concerning the original issue, the axis IDs, can you give me a bit more context on why you opened an issue in plotly.py repo and referenced it here ? I didn't and don't understand the connection.

Regarding the fix itself. This crate is trying to follow plotly.py and plotly.js as much as possible. While using an Enum is indeed type safe, clear and idiomatic, it has the downside that it doesn't generalize well for the purpose of plots. There is already a long standing issue in this crate/repo that axis numbers are hardcoded for subplots up to only 8 axes (#184). This is an artifiial limit.

So I don't think using an Enum here brings much improvement but rather more complexity and I would prefer not to follow this approach.

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.

Non idiomatic method y_axis

3 participants