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

Allow binned coordinates on 1D plots y-axis. #3685

Merged
merged 7 commits into from
Jan 22, 2020
Merged

Allow binned coordinates on 1D plots y-axis. #3685

merged 7 commits into from
Jan 22, 2020

Conversation

juseg
Copy link
Contributor

@juseg juseg commented Jan 11, 2020

Currently 1D plot functions only allow binned coordinates (of pd.Interval type, produced with groupby_bins) on the y-axis (issue #3571). This pull request enables plotting intervals on either or both axes of 1D plots.

@juseg
Copy link
Contributor Author

juseg commented Jan 11, 2020

@dcherian Thanks for pointing the problematic code (in #3571). This commit (b8f082b) solves the issue, I think. Or do you think it will be cleaner with a new util _resolve_intervals_1dplot (similar to the existing _resolve_intervals_2dplot)?

Copy link
Contributor

@dcherian dcherian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this @juseg

yes let's refactor that out. It's quite long.

We'll also need tests.

@juseg
Copy link
Contributor Author

juseg commented Jan 17, 2020

@dcherian could you please briefly explain the difference between class TestPlot and class TestPlot1D or point me to docs on that?

@dcherian
Copy link
Contributor

Not sure there is a good difference. It looks like some refactoring may be a good idea. For now I would just stick the test wherever it is easiest.

Also this may be a good time to incorporate the changes from #3274

@juseg
Copy link
Contributor Author

juseg commented Jan 22, 2020

@dcherian Do you mean merge #3274 here (not sure what's the best workflow)? Also am I correct this will break compatibility with matplotlib<3.1? I think I'm done otherwise.

@dcherian
Copy link
Contributor

Great. Thanks @juseg. I've run into this before so it's nice to see it fixed.

@dcherian dcherian merged commit 6d1434e into pydata:master Jan 22, 2020
@juseg juseg deleted the plot_ybins branch January 23, 2020 08:57
dcherian added a commit to fujiisoup/xarray that referenced this pull request Jan 25, 2020
* 'master' of github.com:pydata/xarray: (27 commits)
  bump min deps for 0.15 (pydata#3713)
  setuptools-scm and isort tweaks (pydata#3720)
  Allow binned coordinates on 1D plots y-axis. (pydata#3685)
  apply_ufunc: Add meta kwarg + bump dask to 2.2 (pydata#3660)
  setuptools-scm and one-liner setup.py (pydata#3714)
  Feature/align in dot (pydata#3699)
  ENH: enable `H5NetCDFStore` to work with already open h5netcdf.File a… (pydata#3618)
  One-off isort run (pydata#3705)
  hardcoded xarray.__all__ (pydata#3703)
  Bump mypy to v0.761 (pydata#3704)
  remove DataArray and Dataset constructor deprecations for 0.15  (pydata#3560)
  Tests for variables with units (pydata#3654)
  Add an example notebook using apply_ufunc to vectorize 1D functions (pydata#3629)
  Use encoding['dtype'] over data.dtype when possible within CFMaskCoder.encode (pydata#3652)
  allow passing any iterable to drop when dropping variables (pydata#3693)
  Typo on DataSet/DataArray.to_dict documentation (pydata#3692)
  Fix mypy type checking tests failure in ds.merge (pydata#3690)
  Explicitly convert result of pd.to_datetime to a timezone-naive type (pydata#3688)
  ds.merge(da) bugfix (pydata#3677)
  fix docstring for combine_first: returns a Dataset (pydata#3683)
  ...
dcherian added a commit to dcherian/xarray that referenced this pull request Jan 27, 2020
* master:
  Add support for CFTimeIndex in get_clean_interp_index (pydata#3631)
  sel with categorical index (pydata#3670)
  bump min deps for 0.15 (pydata#3713)
  setuptools-scm and isort tweaks (pydata#3720)
  Allow binned coordinates on 1D plots y-axis. (pydata#3685)
  apply_ufunc: Add meta kwarg + bump dask to 2.2 (pydata#3660)
  setuptools-scm and one-liner setup.py (pydata#3714)
  Feature/align in dot (pydata#3699)
  ENH: enable `H5NetCDFStore` to work with already open h5netcdf.File a… (pydata#3618)
  One-off isort run (pydata#3705)
  hardcoded xarray.__all__ (pydata#3703)
  Bump mypy to v0.761 (pydata#3704)
  remove DataArray and Dataset constructor deprecations for 0.15  (pydata#3560)
  Tests for variables with units (pydata#3654)
  Add an example notebook using apply_ufunc to vectorize 1D functions (pydata#3629)
  Use encoding['dtype'] over data.dtype when possible within CFMaskCoder.encode (pydata#3652)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Binned coordinates (pd.Interval) not plottable on the y-axis.
2 participants