How can I use SymLogNorm with matplotlib but still have colorbar appear linear?

Viewed 628

Is there a way to use SymLogNorm with imshow, but make the colorbar basically stretch the colors so that the colorbar actually appears linear?

Below is a short code

from pylab import *  
import numpy as np 
from matplotlib.colors import SymLogNorm
data = np.random.uniform(low=-10, high=10, size=(10,10))
norm = SymLogNorm(2,vmin=-10,vmax=10)
fig, axes = plt.subplots()
im = axes.imshow(data,extent=[-10,10,-10,10],cmap=plt.cm.jet,norm=norm)
cb = fig.colorbar(im) 

that produces this

sample imshow image

I basically want this image, but want to stretch the colorbar so the ticks appear linear, not log.

0 Answers
Related