【发布时间】:2015-04-16 14:30:57
【问题描述】:
我在 Python 3 中使用最新版本的 iPython Notebook 来显示使用 %matplotlib inline 的绘图。情节中的传说没有背景,底层数字显示出来。当我使用终端或 IDE 创建图时,图例是不透明的。如何使 iPython Notebook 中的图例也变得不透明?
py.rcParams['xtick.major.pad'] = 8
py.rcParams['ytick.major.pad'] = 8
py.rcParams['lines.linewidth'] = 2
py.rcParams['legend.fontsize'] = 12
py.rcParams['legend.fancybox'] = True
py.rcParams['axes.grid'] = True
py.figure(2, figsize=(14,6))
py.subplot(1,2,1)
py.plot(t, co, label='co')
py.plot(t, co2, label='co2')
py.plot(t, ch2o, label='ch2o')
py.plot(t, hcooh, label='hcooh')
py.plot(t, ch4, label='ch4')
py.plot(t, glyox, label='glyox')
py.plot(t, c2h4o, label='c2h4o')
py.title('Cellulose Species, T = {} K'.format(Tinf))
py.xlabel('Time (s)')
py.ylabel('Mass Fraction')
py.legend(loc='best', numpoints=1)
py.subplot(1,2,2)
py.plot(t, haa, label='haa')
py.plot(t, c3h6o, label='c3h6o')
py.plot(t, hmfu, label='HMFU')
py.plot(t, lvg, label='LVG')
py.plot(t, h2, label='h2')
py.plot(t, h2o, label='h2o')
py.plot(t, char, label='char')
py.title('Cellulose Species, T = {} K'.format(Tinf))
py.xlabel('Time (s)')
py.legend(loc='best', numpoints=1)
py.show()
【问题讨论】:
标签: python-3.x matplotlib plot ipython-notebook