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

add Dataset plot accessor. #36

Open
dcherian opened this issue Jun 18, 2020 · 4 comments
Open

add Dataset plot accessor. #36

dcherian opened this issue Jun 18, 2020 · 4 comments
Labels
good first issue Good for newcomers

Comments

@dcherian
Copy link
Contributor

to wrap _DatasetPlotMethods.

This should be easy → follow what is done with _CFPlotMethods

@dcherian dcherian added the good first issue Good for newcomers label Jun 18, 2020
@jukent
Copy link
Contributor

jukent commented Dec 16, 2020

@dcherian Where does _DatasetPlotMethods exist? I can't find it in this repository's code. And I only see one reference to _CFPlotMethods --

An extra decorator, if necessary. This is used by _CFPlotMethods to set default

Are these upstream in Xarray?

@dcherian
Copy link
Contributor Author

I may have changed design since this was written. I think now we just need to modify _CFPlotMethods appropriately to work.

We want the following to work:

import cf_xarray
import xarray as xr

ds = xr.tutorial.load_dataset("air_temperature").isel(time=slice(2))
ds.air.attrs["standard_name"] = "air_temperature"
ds.plot.scatter(x="air", y="lat")  # works
ds.cf.plot.scatter(x="air_temperature", y="latitude")  # doesn't work

key_mappers=dict.fromkeys(self._keys, (_get_axis_coord_single,)),

We should add the _get_standard_name mapper to the above dictionary. I think that might be all that's needed to get scatter to work.

@jukent
Copy link
Contributor

jukent commented Jan 14, 2021

_get_standard_name

I'm a little iffy on using the dict.fromkeys method with more than one value. Would it look something like:

key_mappers=dict.fromkeys(self._keys, (_get_axis_coord_single, _get_standard_name)), ?

@dcherian
Copy link
Contributor Author

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants