Apply standard plot formatting on draw_contours
PR Description
This PR fixes the lack of standard plot formatting in GenericMap.draw_contours().
Adds an annotate keyword (default True) and Title field to draw_contours() so that axis labels, titles, and aspect ratio are applied consistently, similar to plot().
Fixes #8331
Thanks for the PR @bhavyaKhatri2703, I have asked Albert to take a deeper look into the PR.
For now I just have a few comments and the need for us to add a few test cases to ensure this is working as intended. See https://docs.sunpy.org/en/latest/dev_guide/contents/tests.html#figure-unit-tests for some guidance on how to add them.
If you get stuck, please do ask.
Thanks for creating this PR! Some of your code has issues, but it's moot because I think we should implement the better handling of formatting I suggested above. Here's a branch showing my draft implementation: https://github.com/sunpy/sunpy/compare/main...ayshih:sunpy:plot_formatting
Let me know if you want to incorporate my code changes into your PR – and then you can do the important stuff of adding corresponding figure tests – or if you instead want me to take over your PR.
Thanks for creating this PR! Some of your code has issues, but it's moot because I think we should implement the better handling of formatting I suggested above. Here's a branch showing my draft implementation: main...ayshih:sunpy:plot_formatting
Let me know if you want to incorporate my code changes into your PR – and then you can do the important stuff of adding corresponding figure tests – or if you instead want me to take over your PR.
Thanks for reviewing my PR! Can i merge your changes into my branch? and I'll try to work on adding the figure tests.
Can i merge your changes into my branch? and I'll try to work on adding the figure tests.
Yes, please go ahead!
I did not do anything about the aspect ratio. Upon further thought, it may not make sense to impose a default aspect ratio for draw_* methods, so I think that should be deferred to a potential future PR.
Can i merge your changes into my branch? and I'll try to work on adding the figure tests.
Yes, please go ahead!
I did not do anything about the aspect ratio. Upon further thought, it may not make sense to impose a default aspect ratio for
draw_*methods, so I think that should be deferred to a potential future PR.
just a question do I need to add test functions for every draw_* function for checking auto formatting?
Rather than writing a separate figure test for each method, you can probably set it up as a parametrized figure test, where the values for the parameter are the methods to be tested.
@ayshih can u please review this pr now?
@ayshih can u please review this pr now?
Please do not @ people for reviews. Albert is aware of this PR and will review it when he gets a chance.
so i am struggling with passing the test for the draw_grid method it keeps giving me the warning :
"The conversion of these 2D helioprojective coordinates to 3D is all NaNs because off-disk coordinates need an additional assumption to be mapped to calculate distance from the observer. Consider using the context manager SphericalScreen()"
I am not sure if https://docs.sunpy.org/en/stable/generated/gallery/plotting/offdisk_contours.html will be helpful reading.