【发布时间】:2017-06-27 16:27:05
【问题描述】:
我尝试使用 python 重新创建我的一个 excel 图表,但现在不断撞墙:
这是我设法去的代码:
import matplotlib.pyplot as plt
from numpy import arange
myfile = open(r'C:\Users\user\Desktop\Work In Prog\Alpha Data.csv', 'r')
label = [] # this is a string of the label
data = [] #this is some integer, some are the same value
for lines in myfile:
x = lines.split(',')
label.append(x[1])
data.append(x[4])
dataMin = float(min(data))
dataMax = float(max(data))
pos = arange(dataMin, dataMax, 1)
p1 = plt.bar(pos, data, color='red', height=1)
plt.show()
【问题讨论】:
标签: python python-2.7 bar-chart