문제

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)

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top