matplotlib总结

主要使用matplot.pyplot

import matplot.pyplot as plt

plt.figure(1)

plt.subplot(211)

plt.plot(x,y, 'rs')

plt.xlabel('x')

plt.ylabel('y')

plt.axis( [-1,1, -1, 1])

 

输出文本

plt.text(-0.9, 0.5, r'$\mu=100,  \sigma=15$')

Tex公式

plt.title('$\sigma_i=15$')

 

设置x y坐标轴的缩放单位

plt.yscale('log')

 

import numpy as np
import matplotlib.pyplot as plt

'''t = np.arange(0.0, 5.0, 0.2)
plt.plot(t, t, 'r--', t, t**2, 'bs', t, t**3, 'g^')
plt.ylabel('number')
plt.show()
'''


t = np.arange(0.0, 5.0, 0.2)
y1 = t
y2 = t**2
y3 = t**3


plt.figure(1)
plt.plot(t, y1, 'r--')

#plt.title('title')
plt.title('$\sigma_i=15$')
plt.xlabel('x')
plt.ylabel('y')

plt.axis( [-1, 1, -1, 1] )
plt.grid(True)


plt.text(0.025, 0.5, r'$\mu=100,\sigma=15$')



plt.figure(2)
plt.subplot(221)
plt.yscale('linear')
plt.plot(t, y2, 'gs')

plt.subplot(222)
plt.yscale('log')
plt.plot(t, y2, 'gs')

plt.subplot(223)
plt.yscale('symlog', linthreshy=0.05)
plt.plot(t, y2, 'gs')

plt.subplot(224)
plt.yscale('logit')
plt.plot(t, y2, 'gs')


plt.show()

 

posted @ 2016-11-03 17:31  liuhuiwisdom  阅读(174)  评论(0编辑  收藏  举报