Skip to content

[MNT]: Rename axis3d.Axis to Axis3D #30075

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
oscargus opened this issue May 19, 2025 · 1 comment
Open

[MNT]: Rename axis3d.Axis to Axis3D #30075

oscargus opened this issue May 19, 2025 · 1 comment

Comments

@oscargus
Copy link
Member

Summary

Currently, axis3d.Axis inherits from axis.XAxis which inherits from axis.Axis. This is a bit strange and possibly inconvenient. Especially if we think that the 3D stuff will make it into the main library at some stage.

Proposed fix

Rename axis3d.Axis to Axis3D.

One will have to check it there is anything in XAxis that is actually needed and then consider how to proceed. (One may guess that anything needed in XAxis is so generic that it can go in Axis since it then would be needed for YAxis as well?)

Possibly, one should also rename axis3d.XAxis to axis3d.XAxis3D etc. for consistency.

@timhoffm
Copy link
Member

There are two separate topics in your description:

Currently, axis3d.Axis inherits from axis.XAxis

This is the awkward part. axis3d.Axis is basically monkey-patched on top of XAxis ("take what works for a special case and add 3d 3D functionality and make it the tempate for all concrete 3d Axis). Basically, what you need to do is

  1. Copy axis.XAxis to axis3d.AxisBase let axis3d.Axis inherit from that. This already decouples the 3d stuff from concrete axis.XAxis.
  2. Go through all functions and decide whether they are (i) needed as is in 3d (ii) should be implemented differently in 3d (iii) are not needed at all
  3. For each function, decide whether it could be pushed to axis3d.Axis or it's subclasses axis3d.XYZAxis.
  4. Eventually axis3d.AxisBase should be empty again and can be removed.

There's a lot of footwork in this and you may decide to leave some things untidied, e.g. _init() takes some rcParams from the direction-dependent rcParam variants. Since all 3d Axis inherit from XAxis they all currently use the 'x' axis rcParams. Changing that would be a backward-compatibility issue and if at all should be investigated later.

Rename axis3d.Axis to Axis3D.

I would not do this right now. It's slightly inconvenient/confusing to have the same class name twice, but they are clearly separated through namespaces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants