バックエンドを使用すると、 (かどうかに関係なく)Agg
画像ウィンドウを開いたままにすることができません---それらは事実上すぐに閉じます。を使用しない場合、警告が表示されます。show()
block=True
Agg
/Library/Python/2.7/site-packages/matplotlib-1.2.0-py2.7-macosx-10.8-intel.egg/matplotlib/tight_layout.py:225: UserWarning: tight_layout : falling back to Agg renderer warnings.warn("tight_layout : falling back to Agg renderer")
サンプルコード:
import matplotlib as mpl
mpl.use('Agg') # With this line = figure disappears; without this line = warning
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(111)
mu, sigma = 0, 0.5
x = np.linspace(-3, 3, 100)
plt.plot(x, mlab.normpdf(x, mu, sigma))
fig.tight_layout()
plt.show()
使用すべき別のバックエンドまたは方法論はありますか?