-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Require to explicitly defining optional dimensions such as hue and markersize #7277
Conversation
@jorisvandenbossche, feel free to try out this PR. |
for more information, see https://pre-commit.ci
…ljan/xarray into dont_guess_for_some_kwargs
for more information, see https://pre-commit.ci
…ljan/xarray into dont_guess_for_some_kwargs
I disagree here, even though it runs contrary to what matplotlib does. It's better to ask users to be explicit about what they want. We had this discussion a long time ago in one of my first PRs (!)(#1785) |
@dcherian, as you noted in that PR as well it's not just These are the coords that we currently guess in plot1d: xarray/xarray/plot/dataarray_plot.py Line 154 in d6671dd
Should we remove them, (empty tuple) and let the user explicitly define all of them? If so should we remove any guessing in the other plot functions as well? |
This has stalled for long enough. I'll merge this at the end of next week unless someone disagrees, this pretty much reverts to original ds.plot.scatter behaviour because defining less than x and y in ds.plot.scatter was never allowed before anyway. |
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
* upstream/main: (291 commits) Update error message when saving multiindex (pydata#7475) DOC: cross ref the groupby tutorial (pydata#7555) [pre-commit.ci] pre-commit autoupdate (pydata#7543) supress namespace_package deprecation warning (doctests) (pydata#7548) [skip-ci] Add PDF of Xarray logo (pydata#7530) Support complex arrays in xr.corr (pydata#7392) clarification for thresh arg of dataset.dropna() (pydata#7481) [pre-commit.ci] pre-commit autoupdate (pydata#7524) Require to explicitly defining optional dimensions such as hue and markersize (pydata#7277) Use plt.rc_context for default styles (pydata#7318) Update HOW_TO_RELEASE.md (pydata#7512) Update whats-new for dev (pydata#7511) Fix whats-new for 2023.02.0 (pydata#7506) Update apply_ufunc output_sizes error message (pydata#7509) Zarr: drop "source" and "original_shape" from encoding (pydata#7500) [pre-commit.ci] pre-commit autoupdate (pydata#7507) Whats-new for 2023.03.0 Add `inclusive` argument to `cftime_range` and `date_range` and deprecate `closed` argument (pydata#7373) Make text match code example (pydata#7499) Remove Dask single-threaded setting in tests (pydata#7489) ...
plt.plot(x, y)
wheny
is a 2D array.c
over default colors withplt.plot(x, y, c="blue")
wheny
is a 2D array.hue
overc
, but all plot axes has to be explicit.The plot1d function now follows closer to seaborns example and require explicitly defining optional dimensions such as hue/markersize. Positives and negatives:
+++ Reliable performance, won't accidentally choose large and heavy arrays to plot.
- Loss of dimension information for default values, will essentially flatten the n-dimensional arrays.
- Other xarray plot functions guesses quite a bit as well, API is not consistent.
Required dimensions like the x-axis will still be guessed since the mpl errors weren't very intuitive.
While at it:
plot1
d and facetgrid, use.coords
instead ofgetitem
.