-
-
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
Cannot plot multiindexed (stacked) coordinate as hue variable #4562
Comments
That might be my doing here: #3938 It makes sense to allow a MultiIndex as a label but probably not as a coordinate. So this may need some thinking. |
To elaborate a little more on my particular use case, as it might give insight or an alternative solution: I often have time data taken under different experimental parameters, which are my coordinates. However, often the coordinate matrix is very sparse, meaning that my coordinate matrix might be 5x5x5, but I only have 10 data points or so somewhat randomly sampling this space. So being able to see all my 'test cases' with respect to hue/col etc is very useful to quickly examine the data and coordinate combinations, which helps once I want to unstack the array deal with all of the empty parameter space. |
Yes seems a sems like a sensible approach. Maybe you can use |
I tested this ( I get the following error on 0.15.1:
and on 0.16.1:
(also, sorry, I accidentally clicked close and comment) |
You have to specify |
Note that we're planning to depreciate multi-index dimension (tuple) coordinates and keep only the multi-index levels as coordinates. The main reason is that this will better fit within Xarray's (forthcoming) updated data model with explicit indexes (so far we kept those tuple coordinates to make multi-index work with the concept of a "dimension" index coordinate, but this will no longer be necessary). I see how convenient it is here to use those tuple coordinates as hue (legend) labels to show the value combinations, but there must be other ways to do that. For example, you could simply assign a new coordinate to the |
I tested the method of adding a new level with
It seems like this potentially happen behind the scenes, but I'm not sure. |
It appears since version 0.16.0, that plotting with a multindex coordinate as a hue dimension no longer works. In version 0.15.1 I get a plot like this:
However, when upgrading to 0.16.0 or 0.16.1 I get the following traceback:
Setting x='x' does not fix the problem
Output of xr.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.8.3 (default, Jul 2 2020, 17:30:36) [MSC v.1916 64 bit (AMD64)]
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 142 Stepping 12, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: English_United States.1252
libhdf5: 1.10.4
libnetcdf: 4.7.3
xarray: 0.16.0
pandas: 1.0.5
numpy: 1.18.5
scipy: 1.5.0
netCDF4: 1.5.3
pydap: None
h5netcdf: None
h5py: 2.10.0
Nio: None
zarr: None
cftime: 1.2.1
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: 1.3.2
dask: 2.20.0
distributed: 2.20.0
matplotlib: 3.2.2
cartopy: None
seaborn: 0.10.1
numbagg: None
pint: 0.16.1
setuptools: 49.2.0.post20200714
pip: 20.1.1
conda: None
pytest: 5.4.3
IPython: 7.16.1
sphinx: 3.1.2
The text was updated successfully, but these errors were encountered: