matplotlibでグラデーションカラーを作成してから、サブプロットのパラメーターをこれに設定するにはどうすればよいaxisbg
ですか?
f = plt.figure()
ax = f.add_subplot(111, axisbg='green')
matplotlibでグラデーションカラーを作成してから、サブプロットのパラメーターをこれに設定するにはどうすればよいaxisbg
ですか?
f = plt.figure()
ax = f.add_subplot(111, axisbg='green')
これはaxisbg
パラメータを使用しませんが、あなたが望むことをするかもしれません。
グラデーションのmatplotlibの例があります:http://matplotlib.sourceforge.net/examples/pylab_examples/gradient_bar.html。自分で試してみましたが、この簡略化されたバージョンでは、緑と白のグラデーションの背景が表示されます(何らかの理由で、インタラクティブなPythonシェルでこれを行う場合draw()
、画像を表示するために呼び出す必要があります)。
import matplotlib.pyplot as mplt
fig = mplt.figure()
ax = fig.add_subplot(111)
mplt.plot([1,2,3],[1,2,1])
plotlim = mplt.xlim() + mplt.ylim()
ax.imshow([[0,0],[1,1]], cmap=mplt.cm.Greens, interpolation='bicubic', extent=plotlim)
mplt.draw()
さまざまなグラデーションの別のカラーマップを選択します。'bicubic'
補間なしでも機能しますが、その場合は醜いです。