I wish to display custom colours for the pixel values in my raster. How can I create a custom colormap (cmap)?
In the example below, I have specified "magma" as the colour map. However, I wish to define my own colors for specific range/values.
import rasterio
from rasterio.plot import show,show_hist
if __name__ == "__main__":
input_Dir = 'generated_46.tif'
src = rasterio.open(input_Dir)
show(src,cmap="magma")
Here the result of the above code
Best Answer
This worked for me