Figure factory: Plot a scalar field with geographical coordinates on map with projection
See original GitHub issueI 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.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:10
- Comments:11 (1 by maintainers)
Top Results From Across the Web
Geographical plotting of maps with Plotly | by Jenny Dcruz
Geographical plotting is a method of displaying data on a global scale as well as for states of a country, often in a...
Read more >Choropleth maps in Python - Plotly
A Choropleth Map is a map composed of colored polygons. It is used to represent spatial variations of a quantity. This page documents...
Read more >Import Raster Data in Projected Coordinate Reference System
This example illustrates how to import and display geographic data that contain coordinates in a projected coordinate reference system. In particular, this ...
Read more >Create Points Tool | Alteryx Help
Fields are Projected Floating Points: The coordinates are displayed in a geographic projection. By default, Designer uses WGS84.
Read more >fields.pdf - The Comprehensive R Archive Network
A classic use of this function is to depict a vector field. ... with a map projection or a scaling and rotation of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
A geographic heatmap figure factory would be really nice!
This blog should help: How to Create 2D and 3D Interactive Weather Maps in Python and R