I'm plotting a simple heatmap with a skewed distribution of values
import numpy as np
import matplotlib.pyplot as plt
import random
import matplotlib
size=100
data=np.array([[random.expovariate(1) for _ in range(size)] for _ in range(size)])
fig, ax=plt.subplots()
heatmap=ax.pcolormesh(data, cmap=matplotlib.cm.Reds)
fig.colorbar(heatmap)
It would be great, if I could change the color scaling such that values below some threshold are a fixed color (for example lowest color in the cmap) and all other values are scaled to show a more uniform distribution of colors (for example exponential or power rescaling with some parameter).
Is there an easy way to rescale my colormap without changing my data values?