Python学习笔记:Matplotlib图像属性控制

色彩和样式(借鉴MATLAB):

import numpy as np
import pylab as pl
t=np.arange(0,4,0.4)
pl.plot(t,t,'rD',t,t+2,t,t**2,'g--')

文字:

import numpy as np
import pylab as pl
t=np.arange(0,4,0.4)
pl.title('ABC')
pl.xlabel('Month')
pl.ylabel('Average')
pl.plot(t,t,'rD',t,t+2,t,t**2,'g--')

其他属性:

import numpy as np
import pylab as pl
pl.figure(figsize=(8,6),dpi=100)
t=np.arange(0,4,0.4)
pl.plot(t,t,color='red',linestyle='-',linewidth=3,label='Line1')
pl.plot(t,t+2,color='green',linestyle='',marker='*',linewidth=3,label='Line2')
pl.plot(t,t**2,color='blue',linestyle='',marker='+',linewidth=3,label='Line3')
pl.legend(loc='upper left')

多子图(与MATLAB类似)

子图axes





























你可能感兴趣的:(Python学习笔记:Matplotlib图像属性控制)