国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 編程 > Python > 正文

python用matplotlib畫折線圖

2019-11-08 03:06:47
字體:
供稿:網(wǎng)友

折線圖: import matplotlib.pyplot as plt y1=[10,13,5,40,30,60,70,12,55,25] x1=range(0,10) x2=range(0,10) y2=[5,8,0,30,20,40,50,10,40,15] plt.plot(x1,y1,label='Frist line',linewidth=3,color='r',marker='o', markerfacecolor='blue',markersize=12) plt.plot(x2,y2,label='second line') plt.xlabel('Plot Number') plt.ylabel('Important var') plt.title('Interesting Graph/nCheck it out') plt.legend() plt.show() 這里寫圖片描述

條形圖

import matplotlib.pyplot as plty1=[10,13,5,40,30,60,70,12,55,25]x1=range(0,20,2)x2=range(1,21,2)y2=[5,8,0,30,20,40,50,10,40,15]plt.bar(x1,y1,label='Frist line')#plt.bar(x2,y2,label='second line',color='r')plt.xlabel('Plot Number')plt.ylabel('Important var')plt.title('Interesting Graph/nCheck it out')plt.legend()plt.show()

這里寫圖片描述

直方圖:

import matplotlib.pyplot as pltpopulation_ages = [22,55,62,45,21,22,34,42,42,4,99,102, 110,120,121,122,130,111,115,112,80,75, 65,54,44,43,42,48]x=range(0,130,10)plt.hist(population_ages,x,rwidth=0.8,color='r',histtype='stepfilled')plt.xlabel('Plot Number')plt.ylabel('Important var')plt.title('Interesting Graph/nCheck it out')plt.legend()plt.show()

這里寫圖片描述

散點(diǎn)圖:

import matplotlib.pyplot as pltpopulation_ages = [22,55,62,45,21,22,34,42,42,4,99,102, 110,120,121,122,130,111,115,112,80,75, 65,54,44,43,42,48]x=range(0,len(population_ages))plt.scatter(x,population_ages,label='frist label',s=20)help(plt.scatter)plt.xlabel('x')plt.ylabel('y')plt.title('Interesting Graph/nCheck it out')plt.legend()plt.show()

這里寫圖片描述


發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 尉氏县| 远安县| 常德市| 贺州市| 永修县| 东乌珠穆沁旗| 嘉义市| 柳江县| 定兴县| 宝山区| 唐河县| 盐津县| 禄劝| 皮山县| 且末县| 新巴尔虎右旗| 乌什县| 屏东市| 玉环县| 兖州市| 长寿区| 忻城县| 涞源县| 凤城市| 正宁县| 台中市| 建德市| 麻城市| 延庆县| 图木舒克市| 仙游县| 沂水县| 河池市| 呼玛县| 兴和县| 丽江市| 吕梁市| 通河县| 临澧县| 民县| 信宜市|