图形问题

时间:2012-05-09 12:46:41

标签: python graph plot matplotlib

我的代码目前看起来像这样:

a = 3
b = 4
c = 0
d = 1
e = 7
f = 6
g = 5

y = (0,1,2,3,4,5,6)
x = (a,b,c,d,e,f,g)
bar(y, x, linewidth = 3)
show()

但我一直收到错误:

ValueError: setting an array element with a sequence.

任何想法出了什么问题?

1 个答案:

答案 0 :(得分:2)

我的水晶球暗示你正在尝试使用matplotlib。在这种情况下,将xytuples更改为lists

y = [0,1,2,3,4,5,6]
x = [a,b,c,d,e,f,g]