Layering a heatmap onto a map from a data array - python

I am trying to generate a heatmap (if possible layered on top of a map of my area of interest). I have an array of data (Sea surface temperatures) for the Mediterranean Sea and I would like to generate a heatmap (red for hotter, blue for colder regions) and if possible layer this onto a map (such as google maps or similar) in order to make my data more readable. Are there any packages that can help me with this/does anyone know where I could look to find some sample scripts? Thanks for you help!
I have tried using plotly and matplotlib, however these do not give the desired heatmap (it is all one colour).

Related

How to keep edgecolor for shapefile but make fill transparent matplotlib

Hi I was wondering if there was a way to only include a border around a shapefile? I am layering shapefiles over each other on my graphs and I want a border showing an area inside the base shapefile but don't want it to be filled. This image is what my maps currently look like.
Since you tagged geopandas, you can plot boundaries directly from the geodataframe.
gdf.boundary.plot(color='k')
See plotting documentation, it's about halfway down: https://geopandas.org/en/stable/docs/user_guide/mapping.html

Heatmap generation in Python using different heat intensity

I am trying to generate a Hit map of a scatter plot using matplotlib's hist2d. Can I change the heat level intensity for that? I looks like heat color gets changes linearly. I want to do it exponentially? Is there any other tool in python other than matplotlib's hist2d that I can use.
I think you probably want to use color normalization

contour plot in bokeh

I would like to use pyplot.contour feature in bokeh. Is there any way I can use it?? I know pyplot.pcolormesh and bokeh.plotting.image. Can I use conotur plot with it?
pyplot.contour is part of Matplotlib, not Bokeh. As of Bokeh 2.3.0 there is no built-in contouring function or capability. Recently a MultiPolygons glyph that can support "polygons with holes" was added. This is a first necessary step to being able to have real contour plots in Bokeh. A next step would be for someone to write a set of functions that can accept array inputs and generate the multi-polygon data necessary to drive Bokeh graphics, but this has not been done by anyone yet.
If image contour plots (similar to pcolormesh) or line (unfilled) contours suit your needs, that you can consider using Holoviews, which can generate Bokeh contour plots for those kinds of cases:
http://holoviews.org/reference/elements/bokeh/Contours.html

Overlay a figure on top of Openstreet map using Bokeh?

How do I overlay a figure over a map(not google maps but OpenStreet maps) using Bokeh?
Figure 1: Austin city watershed to be plotted over map
currently my code generates figure 1 which is poor and needs to be overlaid over a map to make better sense.
Pandas DataFrame which is converted into figure shown in figure 1
Convert the shapefile coordinates of lat and long to web mercator coordinates and use any available WMTS tile source to overlay the data on the map. Also provide the x and y range of the city you are interested in mercator coordinates.

How to place country boarders as background for a plot with matplotlib?

I have some data made of coordinates and the count of each coordinate which I plot in a heatmap like this:
pyplot.subplot(211)
pyplot.scatter(longitudes, latitudes, c=counts)
pyplot.colorbar()
which is inspired by this great answer here in SO.
If you look closely you can see, that the dots shape the worldmap somehow. To underline this effect I'd like to put the real country boarders (simply drawn would be enough) as background to my plot. Is this possible with matplotlib? Maybe there is some (hidden) builtin in matplotlib?
You can likely achieve this if you have some image of the world map that you want as a background. You can read this into a numpy array and plot the image. Then you should be able to add your scatter plot overtop of the image. This matplotlib cookbook example shows how to insert images and such. There is also the matplotlib image tutorial that may be of use.
I've not used it, but you may also be interested in the basemap toolkit for matplotlib. In particular, the section on drawing a map background mentions specifically a drawcountries() method.

Categories

Resources