import matplotlib.pyplot as plt(引用模塊的別名)
pyplot的plot()函數
plt.plot(x,y,format_string,**kwargs)
x???????? :x軸數據,列表或數組,可選
y???????? :y軸數據,列表或數組
format_string??? :控制曲線的格式字符串,可選
**kwargs?????????? :第二組或更多(x,y,format_string)
當繪制多條曲線時,各條曲線的x不能省略
plt.plot(x,y,format_string,**kwargs)
**kwargs??? :第二組或更多(x,y,format_string)
color?????????? :控制顏色,color =‘green’
linestyle????? :線條風格,linestyle =‘dashed’
marker???????? :標記風格,marker = ‘o’
markerfacecolor :標記顏色,markerfacecolor = 'blue'
markersize????? :標記尺寸,markersize=20
rcParams的屬性
font.family?? 用于顯示字體的名字
font.strle????? 字體風格,正常‘normal’? 或斜體‘italic’
font.size???? 字體大小,整數字號或者'large'、'x-small'
pyplot的文本顯示函數
plt.xlabel()?????? 對x軸增加文本標簽
plt.ylabel()??????? 對y軸增加文本標簽
plt.title()?????????? 對圖形整體增加文本標簽
plt.text()??????????? 在任意位置增加文本
plt.annotate()???? 在圖形中增加帶箭頭的注解
pyplot的子繪圖區域
pyplot基礎圖標函數概述
plt.plot(x,y,fmt,...)???????????????????????????????? 繪制一個坐標圖
plt.boxplot(data,notch,position)????????? 繪制一個箱形圖
plt.bar(left,height,width,bottom) ? ? ? ? 繪制一個條形圖
plt.barh(width,bottom,left,height) ? ? ? 繪制一個橫向條形圖
plt.polar(theta,r) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 繪制極坐標圖
plt.pie(data,explode) ? ? ? ? ? ? ? ? ? ? ? ? ?? 繪制餅圖
?plt.psd(x,NFFT=256,pad_to,Fs) ? ? ? 繪制功率譜密度圖
plt.specgram(x,NFFT=256,pad_to,F)? 繪制譜圖
plt.cohere(x,y,NFFT=256,Fs)???????????? 繪制X-Y的相關性函數
plt.scatter(x,y)?????????????????????????????????????? 繪制散點圖,其中,x和y長度相同
plt.step(x,y,where)??????????????????????????????? 繪制步階圖
plt.hist(x,bins,normed)????????????????????????? 繪制直方圖
plt.contour(X,Y,Z,N)????????????????????????????? 繪制等值圖
plt.vlines()????????????????????????????????????????????? 繪制垂直圖
plt.stem(x,y,linefmt,markerfmt)???????????? 繪制柴火圖
plt.plot_date()??????????????????????????????????????? 繪制數據日期