Question

I have a matrix and I plot it with imshow.

The colorbar is created like this:

cbar=pl.colorbar(shrink=0.3, aspect=10)
tick_locator = ticker.MaxNLocator(nbins=5)
cbar.locator = tick_locator
cbar.ax.yaxis.set_major_locator(matplotlib.ticker.AutoLocator())
cbar.update_ticks()

As you can see in my example there are lots of zeros in my scale... I want to multiply the number in the scale with a factor (so that I can cange e.g. the units from K(elvin) to mK)

Was it helpful?

Solution

The simplest solution would be to multiply your data with a certain factor,

pl.imshow(factor*numpy.array(matrix))

Or

pl.imshow(factor*matrix)

If your matrix already is a numpy array.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top