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