matplotlib / matplotlib/basemap

pcolormesh actually requires the X,Y to be +1 size of the data array

Open
#107 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
817
Forks
395
PR merge metrics
No merged PRs in 30d

Description

Kind of ran into an unexpected quirk with pcolormesh that perhaps could be improved to save users like me from themselves!

The X, Y arrays to this function need to be 1 larger than the data array so that the bounds of the grid cell are known. Matplotlib's code silently trims the array and will drop the rightmost column and top row.

The examples/plotsst.py suffers from this issue as X,Y,data are all (720, 1440), so the plot is not complete.

I am not sure what to suggest for a fix to this, perhaps simply documenting it is sufficient or maybe basemap should complain when this happens? If you think I should take my whining upstream to matplotlib, that's understandable :)

thank you.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with examples/plotsst.py and inspect how its X, Y, and data arrays are passed to pcolormesh. Compare the example's dimensions with the pcolormesh expectations described in the issue, then determine whether the project should document the requirement or report mismatched dimensions. Done means the example no longer silently omits its top row and rightmost column, with the chosen behavior documented or enforced.

Written by the indexing model from the issue text.

Assessment

Tech stack
matplotlib, 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.