how to display a image over a map with imshow?
matplotlib, matplotlib-basemap, python
Solution
m.imshow(im, extent=extent, alpha=0.6)
Problem
I have a geotif with 9 different colour values (0-9) and want to display it over a map. I'm trying to use it with basemap from the matplotlib package. ``` from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt im = plt.imread('a.tif') extent = [-18, 52, -38, 38] # [left, right, bottom, top] m = Basemap(projection='merc', llcrnrlon=extent[0], urcrnrlon=extent[1], llcrnrlat=extent[2], urcrnrlat=extent[3], resolution='c') m.drawcountries() plt.imshow(im, extent=extent, alpha=0.6) plt.show() ``` I only get a black and white image. When I uncomment drawcountries() I see the data from the tif. How can I draw the colors of the tif on a map and add there country borders?