473,732 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Phython and graphing

Hello,

Can someone lead me to an easy way to create a graph in Python.

For example, I have a script running that creates a list of dates,
times and values. I would like to turn this into a graph.

I can grep the info into a new file creating two columns (x,y) but the
issue is the graph.

P.S. I'm a Python newbie so keep that in mind.

Thanks in advance...

Apr 20 '06 #1
3 3227
In article <11************ **********@v46g 2000cwv.googleg roups.com>,
"mostro" <Ad******@gmail .com> wrote:
Hello,

Can someone lead me to an easy way to create a graph in Python.

For example, I have a script running that creates a list of dates,
times and values. I would like to turn this into a graph.

I can grep the info into a new file creating two columns (x,y) but the
issue is the graph.

P.S. I'm a Python newbie so keep that in mind.

Thanks in advance...


google matplotlib nice package. I've been told that another package
called wsMpl.py also puts a nice API on the matplotlib. You might want
to check that, too.

-- Lou Pecora (my views are my own) REMOVE THIS to email me.
Apr 21 '06 #2
mostro wrote:
Hello,

Can someone lead me to an easy way to create a graph in Python.

For example, I have a script running that creates a list of dates,
times and values. I would like to turn this into a graph.

I can grep the info into a new file creating two columns (x,y) but the
issue is the graph.

P.S. I'm a Python newbie so keep that in mind.

Thanks in advance...

Another possibility would be ReportLab Graphics (www.reportlab.com).
It can create bar charts, line graphs, etc. It is lesser known than
its big brother ReportLab PDF generator, but works equally well. In
addition, it works well if you want to put graphs into .PDF documents.

-Larry Bates
Apr 21 '06 #3
>>>>> "mostro" == mostro <Ad******@gmail .com> writes:

mostro> Hello, Can someone lead me to an easy way to create a
mostro> graph in Python.

mostro> For example, I have a script running that creates a list
mostro> of dates, times and values. I would like to turn this into
mostro> a graph.

mostro> I can grep the info into a new file creating two columns
mostro> (x,y) but the issue is the graph.

mostro> P.S. I'm a Python newbie so keep that in mind.

Here's an example from the matplotlib examples dir

http://matplotlib.sf.net/examples

that does just that. It loads dates and values from a file using the
load function, and then plots them with the plot_date command

The delimiter directive in the load command says to use comma
separated values. The converters arg is a dictionary mapping column
number to a function that converts that column to a float (datestr2num
converts date strings to matplotlib dates using the wonderful
dateutil.parser .parse function that can convert just about any date
string -- the default column converter is 'float'). skiprows
indicates that there is a single line of header to convert, and
usecols says to take the first and third columns.

The rest is easy -- just call plot_dates:

from pylab import figure, show, datestr2num, load
dates, closes = load(
'data/msft.csv', delimiter=',',
converters={0:d atestr2num}, skiprows=1, usecols=(0,2),
unpack=True)

fig = figure()
ax = fig.add_subplot (111)
ax.plot_date(da tes, closes)
show()
Here is a brief look at the data file being plotted:

Date,Open,High, Low,Close,Volum e,Adj. Close*
19-Sep-03,29.76,29.97, 29.52,29.96,924 33800,29.79
18-Sep-03,28.49,29.51, 28.42,29.50,672 68096,29.34
17-Sep-03,28.76,28.95, 28.47,28.50,472 21600,28.34
16-Sep-03,28.41,28.95, 28.32,28.90,520 60600,28.74
15-Sep-03,28.37,28.61, 28.33,28.36,414 32300,28.20
..... and many more
JDH
Apr 21 '06 #4

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

Similar topics

1
2349
by: Michael T. Peterson | last post by:
Would anyone care to recommend a good graphing package (commercial or otherwise)? I've looked at some of the PEAR Image packages - The only graphing package is still alpha quality. One particularly interesting feature would be to display data as in a 'strip chart' recorder, i.e., the graph scrolls across the web page. Any suggestions/pointers would be much appreciated. Michael
4
1923
by: FGO | last post by:
Hi all, I use jpgraph as a graphing tool and it is very slow. Is there a solution to tune it or will I have to use another graphing solution, and which one? (My graphs are simple line stocks quotes) thanks!
2
2329
by: john | last post by:
Are there any charting or graphing modules for python that can write PNG, JPEG, or GIF graphics? I have found a couple of nice looking packages that can make beautiful postscript, PDF, or SVGs (PyChart and ReportLab) but they can't make PNGs, GIFs, or JPEGs. (On my Solaris machine with Python 2.2 they don't.) Or are there any simple UNIX filters to convert SVG, PDF, or ps files to PNG?
22
14354
by: Kenneth Miller | last post by:
Hello All, I am new to Python and i was wondering what graphing utlities would be available to me. I have already tried BLT and after weeks of unsuccesful installs i'd like to find something else. Anything someone would recommend? Regards, Ken
6
1596
by: Michael Hill | last post by:
Hello, all. I am considering writing an online graphing utility. I plan it to be of good quality, such that an undergraduate university student can print it out and include it with a lab report. Data points will be entered, having been generated by another program; the utility will NOT accept functions for plotting--just the data points. As far as I know, Javascript does not provide graphing functionality.
1
1169
by: Mudcat | last post by:
Hi, I have looked through the previous suggestions on graphing modules and have been able to find some good suggestions. However I was wondering about something more specific. I am going to write a program that tracks stock prices and other financial related charts, so I need to use the classic stock chart. From the ones I've seen, the graphing modules deal mostly with scientific plotting and do not have the "high/low" type charts.
1
2974
by: robby.walker | last post by:
Hi, I've just released a full-featured online graphing calculator at http://www.e-tutor.com/et2/graphing/ It requires no downloads or plugins - just JavaScript. You can track points on the curve, graph multiple functions, and more. A lot of this functionality is implemented in JavaScript. I'm very interested in hearing people's feature requests.
0
1351
by: Dexter | last post by:
GraphEasyRect was previously available as an applet. Now we have converted it to a desktop standalone application that runs on multiple platforms Windows, Mac, and Linux This tool allows graphing functions in cartesian plane, points of discontinuity having limits are encircled on graph line. You may view and copy the values of the function between a range of x values
2
2185
by: sydneytroz | last post by:
I am writing a program to simulate a double displacement reaction getting to equilibrium, but I am having some trouble graphing the particles' concentrations. It seems that it's only possible to pan and zoom the graph once the program exits (when running it from IDLE), but I don't want to have to kill the sim every time I want to view the graph (besides, when I do, the graph window dissappears). The following code contains all the graphing...
1
1785
by: skeates | last post by:
Hey all - I'm attempting to write a program that accesses a database, runs some calculations according to user input, and then creates some graphs from the results. The first two steps were pretty simple, but I was disappointed to discover that VB.NET (at least the express edition) doesn't have any sort of built in graphing controls. My original thought is that one could snag the class library from excel and create one's own chart object on a...
0
8946
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9447
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9235
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9181
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6031
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3261
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.