I'm following the example at https://mapbox.github.io/rasterio/topics/plotting.html
And am using this geotiff file http://download.osgeo.org/geotiff/samples/spot/chicago/SP27GTIF.TIF
Here is my code:
import rasterio
from matplotlib import pyplot
tif_file = "SP27GTIF.TIF"
src = rasterio.open(tif_file)
pyplot.imshow(src.read(1), cmap='pink')
pyplot.show = lambda : None # prevents showing during doctests
pyplot.show()
I run the code and don't get any errors, but I also don't see any plots. Any ideas?
The line pyplot.show = lambda : None
assigns a lambda function to pyplot.show
. From that point on, when calling pyplot.show()
, the usual behviour of showing a plot is replaced by this nonsense lambda function.
Removing this line should make your plot appear as usual.