Skip to content
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

[ENH]: Z-axis/3D support for Figure options #23566

Closed
oscargus opened this issue Aug 5, 2022 · 11 comments
Closed

[ENH]: Z-axis/3D support for Figure options #23566

oscargus opened this issue Aug 5, 2022 · 11 comments
Labels
Difficulty: Hard https://matplotlib.org/devdocs/devel/contribute.html#good-first-issues Good first issue Open a pull request against these issues if there are no active ones! GUI: Qt New feature topic: mplot3d
Milestone

Comments

@oscargus
Copy link
Member

oscargus commented Aug 5, 2022

Problem

The QT backend do have a figure option dialogue which allows changing a few parameters for the x and y axes, but not the z axes (when there is one).

Proposed solution

Add support for z axes (when there is one).

@oscargus
Copy link
Member Author

Probably a quite good way to solve it is to loop over the possible axis rather than have everything hard coded like it is now.

Also, changing the limits to "Min" and "Max" rather than "Left"/"Bottom" and "Right"/"Top" should be a thing.

@oscargus oscargus added Difficulty: Hard https://matplotlib.org/devdocs/devel/contribute.html#good-first-issues Good first issue Open a pull request against these issues if there are no active ones! labels Sep 12, 2022
@oscargus
Copy link
Member Author

This may be a good first issue, but requires quite a bit of understanding of how Python works with naming etc to change it into loops and some understanding of Qt.

@chahak13
Copy link
Contributor

Hi @oscargus ! I was taking a look at this and would try to work on it. Is this open for contributions?

@oscargus
Copy link
Member Author

Sure! You are very welcome to give it a go!

@chahak13
Copy link
Contributor

Thanks! Do you have any suggested starting points for me? I took a look at backend_qt.py and I believe that this is for the Configure subplots tool? The toolbox that sets the Configure subplots tool uses SubplotParams names (top, bottom, left, right) to set attributes.

@oscargus
Copy link
Member Author

This is the file that contains the figure options dialog:

https://github.com/matplotlib/matplotlib/blob/main/lib/matplotlib/backends/qt_editor/figureoptions.py

I'd start by making it general so that there is no need to hardcode x and y, so calling functions with a dynamic name and loop over x and y. When that works, it would "just" be to also loop over z as well (if there is a z).

Note that even if you do not pull it off completely, just modifying the code to be more modular would be a step.

From a quick look it seems like the general list could be split into a dictionary containing the general information and then the specific information for each axis.

A problem here is that there are no automatic tests for it, so one will need to manually test after changing something to make sure it still works.

@oscargus
Copy link
Member Author

Making a dict may not be a good idea as it seems like the underlying GUI expects a list of tuples:
https://github.com/matplotlib/matplotlib/blob/main/lib/matplotlib/backends/qt_editor/_formlayout.py

So maybe conditionally extend general with zdata if there exists and then try to expand it correctly.

@oscargus
Copy link
Member Author

axes._axis_map will get you a dictionary with axis names and axes.

You can replace, say, axes.get_xlabel() with getattr(axes, f"get_{axis}label")() if axis = 'x' and so on.

@chahak13
Copy link
Contributor

Thanks, @oscargus, this is really helpful. I'll get to working on it today.

@melissawm
Copy link
Member

Hi @chahak13 - is this issue fixed by your PR?

@chahak13
Copy link
Contributor

Yep! @melissawm

@QuLogic QuLogic closed this as completed Dec 13, 2022
@QuLogic QuLogic added this to the v3.7.0 milestone Dec 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Difficulty: Hard https://matplotlib.org/devdocs/devel/contribute.html#good-first-issues Good first issue Open a pull request against these issues if there are no active ones! GUI: Qt New feature topic: mplot3d
Projects
None yet
Development

No branches or pull requests

4 participants