473,386 Members | 1,706 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,386 software developers and data experts.

Plotting histograms, scatter plots in Python

What is the easiest way to generate some plots and graphs in Python ?

Specifically interested in simple histograms and scatter plots with
circles and regression lines.

Thanks for your suggestions.
Jul 18 '05 #1
9 12768
Dr. Colombes wrote:
What is the easiest way to generate some plots and graphs in Python ?

Specifically interested in simple histograms and scatter plots with
circles and regression lines.


google('matplotlib')
google('gnuplot.py')

hth,

f
Jul 18 '05 #2

One module is Matplotlib, that seems to model the Matlab way of doing
things .... its at sourceforge.

Peter W.

At 02:18 PM 8/6/2004, Dr. Colombes wrote:
What is the easiest way to generate some plots and graphs in Python ?

Specifically interested in simple histograms and scatter plots with
circles and regression lines.

Thanks for your suggestions.
--
http://mail.python.org/mailman/listinfo/python-list


Jul 18 '05 #3
>>>>> "Colombes" == Colombes <Dr********@yahoo.com> writes:

Colombes> What is the easiest way to generate some plots and
Colombes> graphs in Python ? Specifically interested in simple
Colombes> histograms and scatter plots with circles and regression
Colombes> lines.

Here's a little example of a histogram and regression plot using
matplotlib - looks easy enough to me! Output image at
http://nitace.bsd.uchicago.edu:8080/...share/demo.png

from matplotlib.matlab import *

x = randn(10000) # some gaussian noise

subplot(211) # a subplot
hist(x, 100) # make a histogram
grid(True) # make an axes grid
ylabel('histogram')

# now do the regression...
x = arange(0.0, 2.0, 0.05)
y = 2+ 3*x + 0.2*randn(len(x)) # y is a linear function of x + nse

# the bestfit line from polyfit
m,b = polyfit(x,y,1) # a line is 1st order polynomial...

# plot the data with blue circles and the best fit with a thick
# solid black line
subplot(212)
plot(x, y, 'bo', x, m*x+b, '-k', linewidth=2)
ylabel('regression')
grid(True)

# save the image to hardcopy
savefig('demo')
show()

Jul 18 '05 #4
> What is the easiest way to generate some plots and graphs in Python ?

Pychart:
http://www.hpl.hp.com/personal/Yasushi_Saito/pychart/
Jul 18 '05 #5


Paramjit Oberoi wrote:
What is the easiest way to generate some plots and graphs in Python ?

Pychart:
http://www.hpl.hp.com/personal/Yasushi_Saito/pychart/


The charts look good, but the source code links fail.

Colin W.

Jul 18 '05 #6
>> Pychart:
http://www.hpl.hp.com/personal/Yasushi_Saito/pychart/


The charts look good, but the source code links fail.


I just tried downloading it, and they seem to work for me...
Jul 18 '05 #7
Colin J. Williams wrote:


Paramjit Oberoi wrote:
What is the easiest way to generate some plots and graphs in Python ?

Pychart:
http://www.hpl.hp.com/personal/Yasushi_Saito/pychart/


The charts look good, but the source code links fail.


I found it funny that the author makes a comment about poor PostScript quality
in Gnuplot, touting his as an alternative. If the examples on that page are to
be believed, that stuff looks like low-quality Excel-type business charts,
while Gnuplot has been producing publication quality EPS for a loooong time
(ask the many thousands of scientists using it since the early 90's).

I'd say that matplotlib is the _real_ contender to gnuplot today, not that toy
with horrible font scaling, no apparent real symbol/math support, ugly legend
boxes...

Best,

f
Jul 18 '05 #8
Dr********@yahoo.com (Dr. Colombes) wrote in message news:<d1**************************@posting.google. com>...
What is the easiest way to generate some plots and graphs in Python ?

Specifically interested in simple histograms and scatter plots with
circles and regression lines.

Thanks for your suggestions.


For high quality scientific plot I suggest
ppgplot and plplot.

pgplot (original)
http://www.astro.caltech.edu/~tjp/pgplot/

ppgplot (python module)
http://efault.net/npat/hacks/ppgplot/

plplot
http://plplot.sourceforge.net/
Jul 18 '05 #9
John, Peter et al:

Thanks very much for your useful tips on MathPlotLib.

I've begun using MatPlotLib and I like it.

Others suggested GnuPlot, which I hope to try sometime in the
future.

Thanks all. This is a good example of very useful information
exchanged over an Internet newsgroup.

Dr. Colombes

John Hunter <jd******@ace.bsd.uchicago.edu> wrote in message news:<ma**************************************@pyt hon.org>...
>> "Colombes" == Colombes <Dr********@yahoo.com> writes:


Colombes> What is the easiest way to generate some plots and
Colombes> graphs in Python ? Specifically interested in simple
Colombes> histograms and scatter plots with circles and regression
Colombes> lines.

Here's a little example of a histogram and regression plot using
matplotlib - looks easy enough to me! Output image at
http://nitace.bsd.uchicago.edu:8080/...share/demo.png

from matplotlib.matlab import *

x = randn(10000) # some gaussian noise

subplot(211) # a subplot
hist(x, 100) # make a histogram
grid(True) # make an axes grid
ylabel('histogram')

# now do the regression...
x = arange(0.0, 2.0, 0.05)
y = 2+ 3*x + 0.2*randn(len(x)) # y is a linear function of x + nse

# the bestfit line from polyfit
m,b = polyfit(x,y,1) # a line is 1st order polynomial...

# plot the data with blue circles and the best fit with a thick
# solid black line
subplot(212)
plot(x, y, 'bo', x, m*x+b, '-k', linewidth=2)
ylabel('regression')
grid(True)

# save the image to hardcopy
savefig('demo')
show()

Jul 18 '05 #10

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

Similar topics

9
by: rhmd | last post by:
I need to create image files (eg bmp or jpeg) of xy scatter graphs (i.e., graphs in which markers denote individual points; the markers need to be small polygons of various sizes, shapes, colors,...
6
by: Gerrit Holl | last post by:
Hi, I have a dictionairy containing DateTime objects as keys and integers as values. What would be the easiest way to create a simple plot of these, with a number axis versus a time axis? What...
1
by: Andy Salnikov | last post by:
Hi all, does anybody knows any plotting library which can do nice timeline plots? Python is preffered, but not strictly necessary. Standalone utility might also be OK if one can feed some data...
3
by: John Hunter | last post by:
matplotlib is a 2D plotting library for python. You can use matplotlib interactively from a python shell or IDE, or embed it in GUI applications (WX, GTK, and Tkinter). matplotlib supports many...
2
by: KevinGPO | last post by:
I am making a monitor program for the PC. My monitor program will grab statistics about CPU and memory every 1 or 5 seconds. Then I want to store this data so I have a history and hence be able to...
8
by: Derek Basch | last post by:
Can anyone give any suggestions on how to make a logarithmic (base 10) x and y axis (loglog) plot in matplotlib? The scatter function doesn't seem to have any log functionality built into it. ...
7
by: diffuser78 | last post by:
My python program spits lot of data. I take that data and plot graphs using OfficeOrg spredsheet. I want to automate this task as this takes so much of time. I have some questions. 1. Which is...
14
by: amitsoni.1984 | last post by:
hi, I have some values(say from -a to a) stored in a vector and I want to plot a histogram for those values. How can I get it done in python. I have installed and imported the Matplotlib package...
1
by: Lee | last post by:
Hi, thank your for your reply. I will try iPython. I did try sage for a while, but I found it quite heavy, and I'm not sure whether it's easy to expand like python or not. New libraries can be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.