カラーバー値と互換性があるようにIプロットを作成します。これどうやってするの?以下の詳細を参照してください。グラデーションバープロット値とカラーバーの互換性を確認する
Y1、Y2、Y3の値がある:-1.7 -1.62 -1.53 -1.43 -1.32 -1.2 -1.09 -0.97 -0.85]、 [-1.43 -1.28 -1.09 -0.88 -0.66 -0.44 -0.21 0.03 0.27]、[-3.65 -3.58 -3.48 -3.38 -3.27 -3.16 -3.04 -2.92 -2.8]
import matplotlib.pyplot as plt
import numpy as np
#plot
fig = plt.figure(figsize=(9.6,6), dpi=300, linewidth=3.0)
ax = fig.add_subplot(311)
y1 = y.transpose() #y should be the first data I gave out in the beginning
gradient = [ y1,y1 ]
plt.imshow(gradient, aspect='auto', cmap=plt.get_cmap('hot'))
ax.set_xticklabels(data[list[1]])
ax2 = fig.add_subplot(312)
y2 = y.transpose() #y should be the second data I gave out in the beginning
gradient = [ y2,y2 ]
plt.imshow(gradient, aspect='auto', cmap=plt.get_cmap('hot'))
ax2.set_xticklabels(data[list[5]])
ax3 = fig.add_subplot(313)
y3 = y.transpose() #y should be the third data I gave out in the beginning
gradient = [ y3,y3 ]
plt.imshow(gradient, aspect='auto', cmap=plt.get_cmap('hot'))
ax3.set_xticklabels(data[list[9]])
sm = plt.cm.ScalarMappable(cmap=plt.get_cmap('hot'),norm=plt.Normalize(-6.39,9.29))
sm._A = []
plt.colorbar(sm,ax=[ax,ax2,ax3])
#fig.set_tight_layout(True) #how can I use this? If I use this it generates a warning and the plot overlaps
plt.savefig('CuxOxi.png',dpi=300,format='png', orientation='landscape')
あなたがグラフからわかるように、カラーバーが-6.39からの範囲9.29。各サブプロットは、完全なカラーバー範囲のほんの一部にすぎません。どのように私は(ほとんどは赤です)カラーバーで定義された色の範囲を持つことが-1.2に例-1.62のために作ることができます
あなたは[-1.7 -1.62 -1.53 -1.43 -1.32 -1.2 -1.09 -0.97 -0.85]データセットを検討している場合、xticklabelsは-1.7から-0.85の範囲全体にまたがることはありません。むしろ、私は-1.62、-1.53、-1.43、-1.32、-1.2のxticklabelsの範囲を見る。 'ax.set_xticklabels(data [list [c]])'を削除すると、0,2,4,6,8のティックを持つプロットが表示されます。したがって、データセットの5つのデータだけがプロットされ、残りは除外されているように見えます。ティックラベルを正しく扱うにはどうすればいいですか? – gogo