このコードを使用すると、「3d」配列[X、Y、Z]のカラーマップをプロットすることができます(3つの単純なnp要素の配列です)。しかし、カラーバーの凡例の右側に縦書きのラベルを追加することはできません。matplotlibに垂直ラベルを追加するカラーマップの凡例
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure("Color MAP 2D+")
contour = plt.tricontourf(X, Y, Z, 100, cmap="bwr")
plt.xlabel("X")
plt.ylabel("Y")
plt.title("Color MAP 2D+")
#Legend
def fmt(x, pos):
a, b = '{:.2e}'.format(x).split('e')
b = int(b)
return r'${} \times 10^{{{}}}$'.format(a, b)
import matplotlib.ticker as ticker
plt.colorbar(contour, format=ticker.FuncFormatter(fmt))
plt.show()
それはGoogleからの簡単な答えが得られないためにanoyingだ...誰かが私を助けることができますか?
あなたのコードは、matplotlibの2.1.0を使用して私のために動作します。 –
問題の説明を忘れてしまった。あなたが表示するコードの問題は何ですか?結果は何ですか?あなたが何を期待しているかは、どれくらいの距離であるのでしょうか。 [ask]と[mcve]を参照してください。 – ImportanceOfBeingErnest
私は画像 –