tags:

views:

212

answers:

1

Hi,

I am trying to generate a 3d histogram using python.. i tried the following code but i am getting an error too many values to unpack.

from matplotlib import pyplot
import pylab
from mpl_toolkits.mplot3d import Axes3D
import numpy



fig = pylab.figure()
ax = Axes3D(fig)

data_filename = 'C:\csvfiles\luxury.txt'

data_file = numpy.loadtxt(data_filename, delimiter=',')

X = data_file[:,1]
Y = data_file[:,2]
Z = data_file[:,3]




ax.hist(X, Y, Z)
pyplot.show()

What am i doing wrong

thanks

+1  A: 

"Too many values to unpack" happens when you do something like this:

(a, b) = (1, 2, 3)

That is, not enough variables on the left to accept all of the values on the right of the =.

Update:

Try: ax.hist( (X, Y, Z) )

The hist function wants a tuple as the first argument.

Seth