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

Avoid default plotting of matplotlib figures inside the methods. #4704

Closed
Devin-Crawford opened this issue May 21, 2024 · 3 comments
Closed
Assignees
Labels
enhancement New features or code improvements

Comments

@Devin-Crawford
Copy link
Contributor

Description of the current limitations

Rendering matplotlib figures inside some methods can cause delays and unexpected behavior. This also appears to have caused some random time-out failures in unit tests. The issue can be addressed by explicitly exposing the "show" keyword in all methods that return Matplotlib.pyplot Figure objects.

Code sample expected

See for example pyaedt.generic.plot. The method plot_2d_chart() generates a plot if the snapshot_path is not passed as an argument. The behavior in plot_polar_chart() is different. It will render the plot if the keyword show=True. The behavior should be consistent cross methods and show should be exposed for all methods that return Matplotlib Figure objects.

Useful links and references

No response

@Devin-Crawford Devin-Crawford added the enhancement New features or code improvements label May 21, 2024
@Devin-Crawford Devin-Crawford self-assigned this May 21, 2024
@SMoraisAnsys
Copy link
Collaborator

@dcrawforAtAnsys FYI I just started working on #4702 to ease our way of working with plotting figures. Current changes are a WIP (as I didn't looked at the impact on the documentation side) but they should ease the way of testing plot methods in our CI CD. The main idea is to use the backend Agg which is a non-GUI backend and would avoid us having test ending in timeout as no one closed the opened figure!

@gmalinve
Copy link
Contributor

@dcrawforAtAnsys I think this one is linked to the closed PR #4708. Correct?

@Devin-Crawford
Copy link
Contributor Author

@gmalinve Yes. Exposing the keyword show in all methods makes it possible to disable rendering of Matplotlib figures. I'm closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features or code improvements
Projects
None yet
Development

No branches or pull requests

3 participants