Figure factory: Plot a scalar field with geographical coordinates on map with projection
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 18.8k
- Forks
- 2.8k
- Ø Merge
- 16 Std. 26 Min.
- Gemergte PRs (30 T.)
- 21
Beschreibung
I have an array of global temperatures and associated longitude and latitude coordinates arrays. I would like to plot the temperatures as a heatmap on a map with custom projection and showing coastlines.
A working code example using matplotlib is:
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
f, ax = plt.subplots(subplot_kw={'projection': ccrs.Robinson()})
p = ax.pcolormesh(longitude, latitude, temperature, cmap='RdBu_r', transform=ccrs.PlateCarree())
ax.coastlines()
f.colorbar(p, orientation='horizontal')
The output figure from code block above is (data available here):

At the moment I was only able to use plotly for a simple heatmap with the following code:
from plotly.offline import iplot
import plotly.graph_objs as go
layout = go.Layout(geo={'projection': {'type': 'robinson'}})
data = go.Heatmap(x=longitude, y=latitude, z=temperature)
fig = go.Figure(data=[data], layout=layout)
iplot(fig)
As next figure shows, main issues are:
-
the projection is not working;
-
no coastlines are shown.

Beitragsleitfaden
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
Beginnen Sie mit dem bereitgestellten plotly.graph_objs Heatmap-Beispiel und vergleichen Sie es mit dem Verhalten von matplotlib/cartopy. Die Arbeit ist abgeschlossen, wenn Längengrad-/Breitengrad-Temperaturdaten als Heatmap mit der angeforderten Projektion und sichtbaren Küstenlinien gerendert werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- plotly, python
- Bereich
- data-visualization
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 30/100