Skip to content

FacetGrid with coords error #7333

Open
Open
@TomNicholas

Description

There may perhaps be a small bug anyway, as DataArrays with and without coords are handled differently. Contrast:

da=xr.DataArray(data=np.random.randn(2,2,2,10,10),coords={'A':['a1','a2'],'B':[0,1],'C':[0,1],'X':range(10),'Y':range(10)})

p=da.sel(A='a1').plot.contour(col='B',row='C') 
try:
    p.map_dataarray(xr.plot.pcolormesh, y="B", x="C");
except Exception as e:
    print('An uninformative error:')
    print(e)
An uninformative error:
tuple index out of range

with:

da=xr.DataArray(data=np.random.randn(2,2,2,10,10))

p=da.sel(dim_0=0).plot.contour(col='dim_1',row='dim_2') 
try:
    p.map_dataarray(xr.plot.pcolormesh, y="dim_1", x="dim_2");
except Exception as e:
    print('A more informative error:')
    print(e)
A more informative error:
x must be one of None, 'dim_3', 'dim_4'

Originally posted by @joshdorrington in #7310 (comment)

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions