matplotlib / matplotlib/basemap
pcolormesh plot is blank; pcolor plot works
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 817
- Forks
- 395
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
I am experiencing strange behavior using mpl_toolkits.basemap.Basemap.
My understanding is that pcolormesh is faster than pcolor, and thus
preferable. Here is a minimal example (below) where I get a different
plot from pcolormesh than from pcolor.
On two systems (mac os x 10.9.5; Ubuntu 11.04 (GNU/Linux 2.6.32.28
x86_64); basemap 1.0.7 on the mac and 1.0.8 on the Ubuntu machine; both
using matplotlib 1.4.2) I get the expected grid of random colors from
pcolor, but a monochrome plot from pcolormesh.
Is this expected? Are there circumstances in which I should be using
pcolor instead of pcolormesh? Is this a bug in matplotlib or in
basemap?
``` python
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
import numpy as np
def setup_map(ax):
m = Basemap(width=8.0e6,
height=6.5e6,
projection='aeqd',
lat_0=54,
lon_0=-105,
resolution='l',
area_thresh=1000,
rsphere=6371007.181000,
fix_aspect=True,
ax=ax)
m.drawcoastlines()
m.drawcountries()
m.drawstates()
return(m)
# create pseudo-data with longitudes and latitudes
lon, lat = np.meshgrid(np.arange(-180, 180),
np.arange(90, -90, -1))
data = np.random.rand(*lon.shape) * 100
# two-panel figure
fig, ax = plt.subplots(nrows=1, ncols=2)
# plot pseudodata in left panel using pcolormesh
m0 = setup_map(ax[0])
cm = m0.pcolormesh(lon, lat, data, latlon=True,
vmin=0.0, vmax=100.0, cmap=plt.cm.get_cmap("Blues"))
plt.colorbar(cm, ax=ax[0])
ax[0].set_title('pcolormesh')
# plot pseudodata in left panel using pcolor
m1 = setup_map(ax[1])
cm = m1.pcolor(lon, lat, data, latlon=True,
vmin=0.0, vmax=100.0, cmap=plt.cm.get_cmap("Blues"))
plt.colorbar(cm, ax=ax[1])
ax[1].set_title('pcolor')
plt.show()
```
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Start with the supplied minimal Python example and compare Basemap.pcolormesh(..., latlon=True) with Basemap.pcolor(..., latlon=True) using the reported projection and data. Determine whether the blank or monochrome result is expected, and whether the needed change belongs in Basemap or matplotlib; done means the behavior is explained and a reproducible fix or clear upstream diagnosis is established.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- data-visualization
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 35/100