欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Python使用matplotlib 模塊scatter方法畫散點(diǎn)圖示例

 更新時間:2019年09月27日 11:41:11   作者:tony2278  
這篇文章主要介紹了Python使用matplotlib 模塊scatter方法畫散點(diǎn)圖,結(jié)合實(shí)例形式分析了Python數(shù)值運(yùn)算與matplotlib模塊圖形繪制相關(guān)操作技巧,需要的朋友可以參考下

本文實(shí)例講述了Python使用matplotlib 模塊scatter方法畫散點(diǎn)圖。分享給大家供大家參考,具體如下:

# -*-coding:utf-8-*-
import matplotlib.pyplot as plt
y = [12, 7, 1, 2, 6, 3, 7, 5, 12, 6, 14, 10, 6, 7, 1, 2, 9, 3, 4, 4, 4, 5, 4, 6, 9, 5, \
  2, 1, 2, 1, 7, 6, 43, 15, 18, 52, 39, 53, 39, 17, 12, 10, 1, 28, 59, 20, 49, \
  44, 41, 72, 31, 40, 28, 18, 59, 50, 65, 72, 100, 100, 42, 110, 86, 76, 88, 62, 50]
print(len(y))
x = []
for i in range(0, len(y)): #x and y must be the same size
  x.append(i*5)
plt.scatter(x, y, s=16, c = 'r',marker = 'o')
#設(shè)置標(biāo)題并加上軸標(biāo)簽
plt.title("Numbers",fontsize=12)
plt.xlabel("X", fontsize=12)
plt.ylabel("Y", fontsize=12)
#設(shè)置刻度標(biāo)記的大小
plt.tick_params(axis='both',which='major',labelsize=10)
#設(shè)置每個坐標(biāo)的取值范圍
plt.axis([0,380,0,180])
plt.show()

更多關(guān)于Python相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《Python數(shù)學(xué)運(yùn)算技巧總結(jié)》、《Python數(shù)據(jù)結(jié)構(gòu)與算法教程》、《Python函數(shù)使用技巧總結(jié)》、《Python字符串操作技巧匯總》及《Python入門與進(jìn)階經(jīng)典教程

希望本文所述對大家Python程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評論