xarray
xarray copied to clipboard
Add option to define custom format of units in plots
- [x] Tests added
- [x] User visible changes (including notable bug fixes) are documented in
whats-new.rst - [ ] New functions/methods are listed in
api.rst
We encountered the issue that we should plot units as (unit) instead of [unit].
This PR enables us to do exactly this, easier to change this at the source ;)
I think setting this as a global option is the correct approach, but feel free to propose alternatives :)
yeah I'm not sure we should do this. Is there a more matplotlib-native way through pint perhaps?
I have simplified this approach, now you define directly the format string instead of the brackets. Much simpler and more flexible.
If you decide to scrap this, also fine by me :)
Is the current approach still too specific? I'm fine with closing this.
(no particularly strong view from me, I would generally avoid global options as much as possible. I'm not sure whether this is viable on .plot though...)
I'm also inclined to avoid more global options. Our general suggestion in this case is to simply fix up the plot after. I also wonder if there's a way to control formatting by passing pint arrays through.