-
Notifications
You must be signed in to change notification settings - Fork 41
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
wrap facetgrid objects #79
Comments
@dcherian I am interested in tackling with this issue, but am not familiar with facetgrid yet. Is this seaborn facetgrid? https://www.tutorialspoint.com/seaborn/seaborn_facet_grid.htm Is there a line of code that works as |
Thanks @jukent . This is xarray's facetgrid which is inspired by seaborn: https://xarray.pydata.org/en/stable/plotting.html#faceting Here's some example code with output. We want the last commented out line to work. It's pretty similar to groupby and other classes... import xarray as xr
import cf_xarray
ds = xr.tutorial.load_dataset("air_temperature")
fg = ds.air.isel(time=slice(6)).cf.plot(col="T", col_wrap=3) # note .cf.plot; so we can wrap the returned object.
fg.map_dataarray(xr.plot.contour, x="lon", y="lat", colors='w', add_colorbar=False)
# fg.map_dataarray(xr.plot.contour, x="longitude", y="latitude", colors='w', add_colorbar=False) This may be a little complicated so let me know if you want to chat (i'm a little fuzzy on how this stuff is working right now) |
Thanks @dcherian! I think what I need to understand the most is the
where both versions of plotting (with and without cf-xarray)already worked even before adding xr.plot.FacetGrid to the wrapped classes. Thank you for this example on how to use |
ah sorry this issue isn't clear at all.
AFTER This is similar to |
Thanks this helps clear it up a lot. |
@dcherian I am confused by the mistake you mention. You are already defining fg ( And we're after |
Sorry for the confusion. I edited the "mistake" to fix it. This is the sequence we want to work
|
So one clue I've found so far is that
returns
but
returns I am looking into the cf-xarray plotting methods now to see why it uses |
does if so we want to look at |
For |
This will allow
fg.cf.map_dataarray(x="longitude", ...)
Adding
xr.plot.FacetGrid
to_WRAPPED_CLASSES
and some tests should be enough (?)The text was updated successfully, but these errors were encountered: