FacetGrid with coords error
Open
Nobody has claimed this yet.
bug
contrib-good-first-issue
topic-error reporting
- Dominant language
- Python
- Stars
- 4.2k
- Forks
- 1.4k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 14
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 https://github.com/pydata/xarray/discussions/7310#discussioncomment-4257643
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the two reproductions in the issue and compare how FacetGrid.map_dataarray handles DataArrays with and without coordinates. Trace the plotting entry points for contour, pcolormesh, and map_dataarray; done means the coordinate case produces an informative validation error consistent with the no-coordinate case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100