473,324 Members | 2,257 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Re: Histogram of floating point values.

On Fri, Jul 25, 2008 at 5:02 PM, aditya shukla
<ad**************@gmail.comwrote:
Hello folks,

I have a list say

data=[0.99,0.98,0.98,0.98,0.97,0.93,0.92,0.92,0.83,0.66, 0.50,0.50]

i am trying to plot histogram of these values

i have installed numpy and matplotlib and this is what i am doing*
import numpy
import pylab
from numpy import *
from pylab import *

input_hist=array(data)
pylab.hist(input_hist,bins=0.1)
and this is the error that i am getting

(array([], dtype=int32), array([ 0.5]), <a list of 0 Patch objects>)
does this mean that i cannot plot a histogram of floating point values ? or
is there a way around
the 'bins' argument to pylab.hist() is supposed to be an integer or a
list of the bins' lower edges. The default value is 10, more than
that gives smaller bins, as one would expect. Take a look at the
pylab.hist documentation (you can do 'print pylab.hist.__doc__' from
the command interpreter).

You should have no problem plotting a hist of floats. Try this:

import numpy
import pylab
from numpy import *
from pylab import *

data=[0.99,0.98,0.98,0.98,0.97,0.93,0.92,0.92,0.83,0.66, 0.50,0.50]

input_hist=array(data)
pylab.hist(input_hist)
pylab.show()

The last line will display the actual histogram. See the difference
pylab.show and pylab.ion functions.

In the future, it is advisable to post these questions to the
matplotlib or the numpy/scipy users mailing lists.

Kurt
>
Thanks in advance

Aditya

--
http://mail.python.org/mailman/listinfo/python-list
Jul 25 '08 #1
0 1430

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: bleh | last post by:
....to include a removeData(datatoremove) function, to mirror the existing addData(datatoadd) function. If anybody knows of somewhere where this has been done already, if you could point me in...
2
by: kevin parks | last post by:
hi. I've been banging my head against this one a while and have asked around, and i am throwing this one out there in the hopes that some one can shed some light on what has turned out to be a...
5
by: Anton Noll | last post by:
We are using Visual Studio 2003.NET (C++) for the development of our software in the fields digital signal processing and numerical acoustics. One of our programs was working correctly if we are...
687
by: cody | last post by:
no this is no trollposting and please don't get it wrong but iam very curious why people still use C instead of other languages especially C++. i heard people say C++ is slower than C but i can't...
15
by: michael.mcgarry | last post by:
Hi, I have a question about floating point precision in C. What is the minimum distinguishable difference between 2 floating point numbers? Does this differ for various computers? Is this...
12
by: KraftDiner | last post by:
Hi, I wrote a C++ class that implements an n dimensional histogram in C++, using stl maps and vectors. I want to code this up now in Python and would like some input from this group. The C++...
7
by: thisismyidentity | last post by:
Hi all, I am trying to predict the behaviour of floating point load and store operations on integer locations. I ve written a small piece of code having some inline assembly code which I am...
0
by: Fredrik Lundh | last post by:
aditya shukla wrote: Extracting is easy; you can do something like data = for line in open("test.txt"): line = line.split("|") data.append(float(line))
0
by: Terry Reedy | last post by:
aditya shukla wrote: Ask the pylab (matplotlib?) people what their error message means.
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.