Re: [問題] python繪圖問題

作者: MasterChang (我愛ASM)   2016-12-21 22:52:08
※ 引述《GNRobicheaux (晚安羅比修)》之銘言:
: 請問python要怎麼把資料提取要的畫製圖表呢?
: http://i.imgur.com/j6PSWjC.jpg
: 學的都是單筆數據畫圖
: 如果內容是一筆資料 x軸是另外一筆
: 要怎麼寫呢?
import numpy as np
import matplotlib.pyplot as plt
dataX = [6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0]
dataY = [21,25,28,31,36,41,45,51,54,58]
width = 0.4
for v in range(len(dataX)):
dataX[v] = dataX[v] - (width/2)
plt.grid()
plt.xlim(5,16)
plt.ylim(0,70)
plt.bar(dataX, dataY, width = width, label="summary")
plt.xlabel("Age")
plt.ylabel("Weight")
plt.legend()
作者: tn00364361 (小氵斿)   2016-12-22 20:57:00
summary

Links booklink

Contact Us: admin [ a t ] ucptt.com