Re: [Matplotlib-users] histograms : xmax

2009-07-09 Thread Sebastian Busch
hey there!



Pau wrote:
 ...
 0.00e+00   1.00e-04 81039
 1.00e-04   2.00e-04 4472
 2.00e-04   3.00e-04 2033
 ...
 
 The bins are given by the two first number columns.
 
 For instance, the first bin is from 0.00e+00 to 1.00e-04 and has the
 number of data 81039

hey pau!

i do not understand hist well myself, but i think it might be doing
something different from what you want. i think that if you run hist on
e.g. the numbers
100, 11, 10, 9, 0, 0, 0, 0, 0

and make 10 bins, it will give you

x   y
0   5
10  3
20  0
30  0
40  0
50  0
60  0
70  0
80  0
90  0
100 1

if you histogram the data on the y-axis, there is no reason why this
should be still connected to the x-axis.

you have already a histogramm -- if you want to rebin, i guess you
should use histogram on the x-axis and weight with the y-data.

 H = load ( './histo3.dat')
 h =  H[:, 2]  # the third column
 
 n, bins, patches = hist(h, 997, normed=0, log=0,
 facecolor='lightblue', alpha=0.75)

 0 - 9 -- on x axis
 Notice in the data file that x does not get further than 9.96e-02
 So the maximum should be 0.0996 and I am getting 9

if you pass only the third column to hist, it is a bit unfair to expect
it to know the other two ;)


good luck,
sebastian.



signature.asc
Description: OpenPGP digital signature
--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] histograms : xmax

2009-07-07 Thread Pau
Hello,

two days ago Sebastian helped me to finish in a hurry a histogram with bar()

I would like now to understand how to make the plot with hist()

First of all, my data (after a massage) looks like :

-
0.00e+00   1.00e-04 81039
1.00e-04   2.00e-04 4472
2.00e-04   3.00e-04 2033
3.00e-04   4.00e-04 1155
4.00e-04   5.00e-04  823
5.00e-04   6.00e-04  643
6.00e-04   7.00e-04  534
7.00e-04   8.00e-04  361
8.00e-04   9.00e-04  313
9.00e-04   1.00e-03  269
1.00e-03   1.10e-03  230
1.10e-03   1.20e-03  195
1.20e-03   1.30e-03  178
1.30e-03   1.40e-03  165
1.40e-03   1.50e-03  175
1.50e-03   1.60e-03  125
1.60e-03   1.70e-03  109
1.70e-03   1.80e-03  112
1.80e-03   1.90e-03   90
.
.
.
.
9.86e-02   9.87e-020
9.87e-02   9.88e-020
9.88e-02   9.89e-020
9.89e-02   9.90e-020
9.90e-02   9.91e-020
9.91e-02   9.92e-020
9.92e-02   9.93e-020
9.93e-02   9.94e-020
9.94e-02   9.95e-020
9.95e-02   9.96e-021
-

The bins are given by the two first number columns.

For instance, the first bin is from 0.00e+00 to 1.00e-04 and has the
number of data 81039

Then I run the following script on them:

--
#!/usr/bin/env python

from pylab import *

H = load ( './histo3.dat')

h =  H[:, 2]  # the third column

n, bins, patches = hist(h, 997, normed=0, log=0,
facecolor='lightblue', alpha=0.75)

show()
--

The number 997 is because this is the number of lines I have in my
file (and, thus, the number of bins)

But the plot is ranging between

0 - 9 -- on x axis
0 - 1000   -- on y axis

Notice in the data file that x does not get further than 9.96e-02

So the maximum should be 0.0996 and I am getting 9

Why is that?

What am I doing wrong?

I have tried to substitute lower-case e with E in the data file but
this did not help

Any help would be appreciated.

thanks,

Pau

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users