matplotlib / matplotlib/basemap

pcolormesh can't shiftdata when X,Y are 1 larger than data

Open
#182 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
817
Forks
395
PR merge metrics
No merged PRs in 30d

Description

The pcolormesh docs (as noted in this issue https://github.com/matplotlib/basemap/issues/107) explain that:

"Ideally the dimensions of x and y should be one greater than those of data; if the dimensions are the same, then the last row and column of data will be ignored."

However when I actually try and use Basemap pcolormesh with this shape array, the shiftdata method sometimes fails because the data is not the same shape:

```
import numpy as np
from mpl_toolkits.basemap import Basemap
x = np.arange(-179, 191, 10)
y = np.array([50, 51, 52])
data = np.ones((2, 36))
xv, yv = np.meshgrid(x, y)
map = Basemap()
map.pcolormesh(xv, yv, data, latlon=True)
```

results in this error (in 1.0.7):

IndexError: Inconsistant shape between the condition and the input (got (3, 37) and (2, 36))

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the reported example and trace Basemap.pcolormesh into shiftdata, the entry points named in the issue. Compare the coordinate shape (3, 37) with the data shape (2, 36); done means this documented pcolormesh shape no longer raises the reported IndexError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.