Draft
Conversation
As a first pass, I allow Collections to contain matplotlib.figure.Figure objects. Collection.plot() requires a variable argument (for now a string, but perhaps a list of variables to plot would be better?) and also allows the user to pass isel_dict to help reduce dimensions. There is a trello card about introducing sel / isel functionality, and once that's done the isel_dict argument can be removed. I like the idea of being able to super-impose line plots (time series of scalar quantities, or vertical profiles) in a single figure, but I have not made any progress on that front yet. I also should add a test for this function.
for more information, see https://pre-commit.ci
Author
|
I was on the fence about what ds = xr.tutorial.open_dataset('rasm')
dsa = xr.tutorial.open_dataset('air_temperature')
collection = xc.Collection({'rasm': ds, 'air_temp': dsa, 'air_temp_to_Tair': dsa.rename({'air': 'Tair'})})
plot_col = collection.plot('Tair', {'time': 0})
plot_col['rasm'].savefig('Tair.png') |
After thinking about it more, it didn't make sense to let matplotlib Figures be valid objects in a Collection, so I stripped that logic out and now Collection.plot() returns a dict
Better support for Collections that contain DataArrays
If isel_dict contains dim names that are not in the dataset, then we don't try to plot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As a first pass, I allow
Collectionsto containmatplotlib.figure.Figureobjects.
Collection.plot()requires a variable argument (for now a string, butperhaps a list of variables to plot would be better?) and also allows the user
to pass
isel_dictto help reduce dimensions. There is a trello card aboutintroducing
sel/iselfunctionality, and once that's done theisel_dictargument can be removed.
I like the idea of being able to super-impose line plots (time series of scalar
quantities, or vertical profiles) in a single figure, but I have not made any
progress on that front yet.
I also should add a test for this function.
Fixes #13