Python学习笔记:Matplotlib绘图基础

Matplotlib绘图(https://matplotlib.org/gallery.html):

1、绘图API--pyplot模块

折线图:

import numpy as np
import matplotlib.pyplot as plt
t=np.arange(0,4,0.1)
plt.plot(t,t,t,t+2,t,t**2)

散点图:

import numpy as np
import matplotlib.pyplot as plt
t=np.arange(0,4,0.1)
plt.plot(t,t,'o',t,t+2,'o',t,t**2,'o')

2、集成库--pylab模块(包含numpy和pyplot中的常用函数)

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

























































你可能感兴趣的:(Python学习笔记:Matplotlib绘图基础)