basemap
basemap copied to clipboard
pcolormesh actually requires the X,Y to be +1 size of the data array
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.
Hi Daryl,
It works like this, pcolormesh fills space between the point defined by X,Y, so this way you get the number of intervals less than the number of points... I read it somewhere in matplotlib docs.
Cheers
Oleksandr (Sasha) Huziy
2013/5/30 daryl herzmann [email protected]
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.
— Reply to this email directly or view it on GitHubhttps://github.com/matplotlib/basemap/issues/107 .
Thanks guziy, I agree that it is necessary for X,Y to be one larger than the data. I would just like to see it documented in the function and the basemap examples fixed to properly account for this.
Anyone want to submit a pull request for this?
Hi Jeff:
I've sent the pull request, though I do not know how to connect it with the issue... Please, see if it is really of interest.
https://github.com/matplotlib/basemap/pull/132
Cheers
2013/11/5 Jeff Whitaker [email protected]
Anyone want to submit a pull request for this?
— Reply to this email directly or view it on GitHubhttps://github.com/matplotlib/basemap/issues/107#issuecomment-27799326 .
Sasha
Ok, I see you want the examples also to be fixed, that'll probably take a bit more effort))
2013/11/5 Oleksandr Huziy [email protected]
Hi Jeff:
I've sent the pull request, though I do not know how to connect it with the issue... Please, see if it is really of interest.
https://github.com/matplotlib/basemap/pull/132
Cheers
2013/11/5 Jeff Whitaker [email protected]
Anyone want to submit a pull request for this?
— Reply to this email directly or view it on GitHubhttps://github.com/matplotlib/basemap/issues/107#issuecomment-27799326 .
Sasha
Sasha
Recently my friend asked me for a pcolormesh example and referred to this issue, and reminded me that I completely forgot to work on an example. So I've created one for him and thought maybe it could be useful for someone else: http://nbviewer.ipython.org/github/guziy/PyNotebooks/blob/master/pcolormesh_example.ipynb
Cheers
It would be good if get_array()
(or some other, similar method, get_data()
?) returned the original data. Otherwise, modifying the data in get_array()
and re-plotting would keep truncating the data upon each iteration.