0.98.4版本图例新特性
创建图例并使用阴影和长方体对其进行调整。
import matplotlib.pyplot as pltimport numpy as npax = plt.subplot(111)t1 = np.arange(0.0, 1.0, 0.01)for n in [1, 2, 3, 4]:plt.plot(t1, t1**n, label="n=%d"%(n,))leg = plt.legend(loc='best', ncol=2, mode="expand", shadow=True, fancybox=True)leg.get_frame().set_alpha(0.5)plt.show()

参考
此示例显示了以下函数、方法、类和模块的使用:
import matplotlibmatplotlib.axes.Axes.legendmatplotlib.pyplot.legendmatplotlib.legend.Legendmatplotlib.legend.Legend.get_frame
