2
私はimshow()を使って表示する範囲-70,0のデータを持っており、-70、-60の両方にpaternsがあるのでデータを表すために非線形のカラーバーを使用したいと思います範囲と-70,0の範囲。 任意の関数(例を参照)を使用してカラーバーを再スケール/再正規化する最も簡単な方法は、すべての画像がうまく表示されるようにしたいと思います。ここで任意のカラーバー
は、データと機能の例です。
sample_data=(np.ones((20,20))*np.linspace(0,1,20)**3)*70-70
def renorm(value):
"""
Example of the way I would like to adjust the colorbar but it might as well be an arbitrary function
Returns a number between 0 and 1 that would correspond to the color wanted on the original colorbar
For the cmap 'inferno' 0 would be the dark purple, 0.5 the purplish orange and 1 the light yellow
"""
return np.log(value+70+1)/np.log(70+1)