html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue https://github.com/pydata/xarray/issues/4562#issuecomment-970851123,https://api.github.com/repos/pydata/xarray/issues/4562,970851123,IC_kwDOAMm_X8453gMz,20617032,2021-11-16T23:39:09Z,2021-11-16T23:39:09Z,NONE,"I tested the method of adding a new level with `mi.values`, which worked, though `x='x'` must still be specified: ``` import numpy as np import pandas as pd import xarray as xr data = np.random.rand(50,5) x_idx = np.linspace(0, 50) mi_idx1 = ['a','b','c','d','e'] mi_idx2 = [1,2,3,4,5] mi = pd.MultiIndex.from_arrays([mi_idx1,mi_idx2], names=['mi_idx1', 'mi_idx2']) coords = { 'x': x_idx, 'mi': mi } da = xr.DataArray(data, coords=coords, dims = ['x', 'mi']) da = da.assign_coords(mi_plot = ('mi', da.indexes['mi'].values)) # add a level for plot display da.plot(hue='mi_plot', x='x') ``` It seems like this potentially happen behind the scenes, but I'm not sure. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,735523592 https://github.com/pydata/xarray/issues/4562#issuecomment-929295038,https://api.github.com/repos/pydata/xarray/issues/4562,929295038,IC_kwDOAMm_X843Y-q-,4160723,2021-09-28T14:39:43Z,2021-09-28T14:39:43Z,MEMBER,"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 `DataArray` with tuple values (i.e., `mi.values`) without attaching any index to it.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,735523592 https://github.com/pydata/xarray/issues/4562#issuecomment-729275558,https://api.github.com/repos/pydata/xarray/issues/4562,729275558,MDEyOklzc3VlQ29tbWVudDcyOTI3NTU1OA==,10194086,2020-11-17T23:27:47Z,2020-11-17T23:27:47Z,MEMBER,"You have to specify `x` as well: `da.plot(hue='mi_idx1', x=""x"")`. But yes, this is not ideal - would be nice to get this working with `hue=""mi""`.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,735523592 https://github.com/pydata/xarray/issues/4562#issuecomment-728363355,https://api.github.com/repos/pydata/xarray/issues/4562,728363355,MDEyOklzc3VlQ29tbWVudDcyODM2MzM1NQ==,20617032,2020-11-16T22:17:28Z,2020-11-16T22:18:28Z,NONE,"I tested this (`hue=""mi_idx1""`) and it does not work. I get the following error on 0.15.1: `ValueError: y must be a dimension name if x is not supplied` and on 0.16.1: `ValueError: ('mi', 'mi') must be a permuted list of ('x', 'mi'), unless `...` is included` (also, sorry, I accidentally clicked close and comment)","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,735523592 https://github.com/pydata/xarray/issues/4562#issuecomment-721855875,https://api.github.com/repos/pydata/xarray/issues/4562,721855875,MDEyOklzc3VlQ29tbWVudDcyMTg1NTg3NQ==,10194086,2020-11-04T17:04:28Z,2020-11-04T17:04:28Z,MEMBER,"Yes seems a sems like a sensible approach. Maybe you can use `hue=""mi_idx1""` and set the label manually as a workaround. (Can't test right now) ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,735523592 https://github.com/pydata/xarray/issues/4562#issuecomment-721360380,https://api.github.com/repos/pydata/xarray/issues/4562,721360380,MDEyOklzc3VlQ29tbWVudDcyMTM2MDM4MA==,20617032,2020-11-03T20:34:02Z,2020-11-03T20:34:02Z,NONE,"> It makes sense to allow a MultiIndex as a label but probably not as a coordinate 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. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,735523592 https://github.com/pydata/xarray/issues/4562#issuecomment-721348538,https://api.github.com/repos/pydata/xarray/issues/4562,721348538,MDEyOklzc3VlQ29tbWVudDcyMTM0ODUzOA==,10194086,2020-11-03T20:06:33Z,2020-11-03T20:06:33Z,MEMBER,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. ,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,735523592