python - Is there a way to return same length arrays in numpy.hist? -


i'm trying create histogram plot in python, normalizing custom values y-axis values. this, thinking this:

import numpy np import matplotlib.pyplot plt  data = np.loadtxt('foo.bar') fig = plt.figure() ax = fig.add_subplot(111)  hist=np.histogram(data, bins=(1.0, 1.5 ,2.0,2.5,3.0)) x=[hist[0]*5,hist[1]] ax.plot(x[0], x[1], 'o') 

but of course, last line gives:

valueerror: x , y must have same first dimension 

is there way force np.hist give same number of elements x[0] , x[1] arrays, example deleting first or last element 1 of them?

hist[1] contains limits in have made histogram. guess want centers of intervals, like:

x = [hist[0], 0.5*(hist[1][1:]+hist[1][:-1])] 

and plot should ok, right?


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -