![](https://i.imgur.com/j6PSWjC.jpg)
Re: [問題] python繪圖問題
![](https://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()
--
不要問我從哪來,我只是一個浪跡天涯的工程師....
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 118.232.57.227
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1482331932.A.FB6.html
→
12/22 20:57, , 1F
12/22 20:57, 1F
Thanks!!
※ 編輯: MasterChang (118.232.57.227), 12/23/2016 15:51:11
討論串 (同標題文章)