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

Dynamically Generating a Graph in Python

Hi
I want to dynamically generate a graph in python that would be
displayable on a web page. What would be the best way to do this?

The reason I want to do this, is because I am making a program to
convert data from scientic probes into web pages. I have been able to
do every thing except the graph generation.

Your help would be much appriciated

---
Tim Henderson
Jul 18 '05 #1
13 4617
Tim Henderson wrote:
I want to dynamically generate a graph in python that would be
displayable on a web page. What would be the best way to do this?


See if you can run graphviz in the background.

http://www.research.att.com/sw/tools/graphviz/

If yes you'll need to create an input file
based on your data then run the dot utility
on it to generate a graphics file.

There is pydot module that generates graphviz
files:

http://dkbza.org/pydot.html

IMO is a little bit too complicated, and might not be worth the trouble.

The dot file format is fairly simple and you might be better off
just understanding it and then generating directly
in that format. You will need to understand the format
anyhow if you want to customize the output.

Istvan.
Jul 18 '05 #2
Hi Tim,

Try looking into Matplotlib. There was some discussion on this recently in
their user forum:

http://sourceforge.net/mailarchive/f...forum_id=33405

Darren

Tim Henderson wrote:
Hi
I want to dynamically generate a graph in python that would be
displayable on a web page. What would be the best way to do this?

The reason I want to do this, is because I am making a program to
convert data from scientic probes into web pages. I have been able to
do every thing except the graph generation.

Your help would be much appriciated

---
Tim Henderson


Jul 18 '05 #3
On 2004-09-30, Tim Henderson <ti******@gmail.com> wrote:
I want to dynamically generate a graph in python that would be
displayable on a web page. What would be the best way to do this?
I'd use gnuplot-py:

http://gnuplot-py.sourceforge.net/
The reason I want to do this, is because I am making a program
to convert data from scientic probes into web pages. I have
been able to do every thing except the graph generation.


gnuplot can generate a huge number of different file formats,
including png, svg, eps, pdf, ppm, gif, and so on.

--
Grant Edwards grante Yow! I will SHAVE and
at buy JELL-O and bring my
visi.com MARRIAGE MANUAL!!
Jul 18 '05 #4
>>>>> "Istvan" == Istvan Albert <ia*****@mailblocks.com> writes:

Istvan> Tim Henderson wrote:
I want to dynamically generate a graph in python that would be
displayable on a web page. What would be the best way to do
this?


Istvan> See if you can run graphviz in the background.

Istvan> http://www.research.att.com/sw/tools/graphviz/

I think he means the other kind of graph, aka a plot/chart.

JDH
Jul 18 '05 #5
ti******@gmail.com (Tim Henderson) writes:
Hi
I want to dynamically generate a graph in python that would be
displayable on a web page. What would be the best way to do this? The reason I want to do this, is because I am making a program to
convert data from scientic probes into web pages. I have been able to
do every thing except the graph generation.

http://newcenturycomputers.net/projects/gdmodule.html

is what I use.
Jul 18 '05 #6
>>>>> "Eddie" == Eddie Corns <ed***@holyrood.ed.ac.uk> writes:
Hi I want to dynamically generate a graph in python that would
be displayable on a web page. What would be the best way to do
this? The reason I want to do this, is because I am making a program
to convert data from scientic probes into web pages. I have
been able to do every thing except the graph generation.

Eddie> http://newcenturycomputers.net/projects/gdmodule.html

gdmodule is really more of a low level drawing program than a graphing
module. Of course you can draw graphs with it, as you can with any
drawing program, but it's a lot easier to make scientific graphs (the
OP's interest) with a program designed for that purpose. matplotlib
has a gdmodule backend.

http://matplotlib.sourceforge.net/backends.html#GD

JDH
Jul 18 '05 #7
John Hunter wrote:
>>"Istvan" == Istvan Albert <ia*****@mailblocks.com> writes:

Istvan> Tim Henderson wrote: >> I want to dynamically generate a graph in python that would be
>> displayable on a web page. What would be the best way to do
>> this?

Istvan> See if you can run graphviz in the background.

Istvan> http://www.research.att.com/sw/tools/graphviz/

I think he means the other kind of graph, aka a plot/chart.


If this is indeed what he means:-) I began to use PyChart last week:

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

I is o.k. for relatively simple statistical charts, and may produce output in SVG, PS,
PDF, PNG, and interactive X11 display

Ivan
JDH


Jul 18 '05 #8
John Hunter <jd******@ace.bsd.uchicago.edu> wrote in message news:<ma**************************************@pyt hon.org>...
>> "Eddie" == Eddie Corns <ed***@holyrood.ed.ac.uk> writes: >> Hi I want to dynamically generate a graph in python that would
>> be displayable on a web page. What would be the best way to do
>> this?


Check out chartdirector.
http://www.advsofteng.com/
Jul 18 '05 #9
Ivan Herman wrote:
If this is indeed what he means:-) I began to use PyChart last week:

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

I is o.k. for relatively simple statistical charts, and may produce output in
SVG, PS, PDF, PNG, and interactive X11 display


With all due respect for the author of this tool, I have a really hard time with
comments like this on his page:

Gnuplot.
A long-time favorite of researchers. But its output is not up to publishing
standard, in my opinion.

Gnuplot has been around for many years (I've used it since 1991), and its
postscript is extremely good. Definitely far better than any of the examples
shown in the pychart page, all of which have that god-awful look of Excel cheap
charts.

In python, for the last few years I've been using (yes, for real research)
gnuplot with much success (with Gnuplot.py and the enhancements which ipython
ads), and right now I'm in the process of switching to matplotlib (and doing
much work so that ipython supports matplotlib for interactive work).

IMHO, matplotlib has a very clean design which makes it a great tool to bet on
for the future, with very good functionality, high quality output, and is being
actively developed by a strong team (not just John Hunter, but also the good
folks from the Hubble Space Telescope Science Institute).

Just my $.02,

f

Jul 18 '05 #10
Fernando Perez wrote:
being actively developed by a strong team (not just John Hunter, but also the
good folks from the Hubble Space Telescope Science Institute).


Just to clarify the above. John is a great coder, but he is obviously busy and
his professional research also demands much of his time beyond matplotlib. The
point I was trying to make is that matplotlib is not a one-man effort.
Instead, it has the support of a strong team of scientists who use it in a real
production environment.

Best,

f

Jul 18 '05 #11
You put me in a strange situation... it is not my goal to compare gnuplot and pychart, I
am just a messenger... I am not even sure that the two are comparable, to be fair (to both).

Pychart (as far as I am concerned) is a small and lean package to do statistical charts
and nothing else. Gnuplot is *much* more than that, it is more powerful and, consequently,
complex. Personally, my problem with gnuplot was that it lacked, for example, any
pie-chart facility (it is a topic of debates on the relevant mailing lists, b.t.w.) and I
was simply too lazy;-) to do start learning gnuplot and do it myself. In any case: I am
afraid we are comparing apples and oranges here.

As for the remark of the author you quote below... I let him defend himself if he reads
these lines. Personally, I do not care about it.

Ivan
Fernando Perez wrote:
Ivan Herman wrote:

If this is indeed what he means:-) I began to use PyChart last week:

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

I is o.k. for relatively simple statistical charts, and may produce output in
SVG, PS, PDF, PNG, and interactive X11 display

With all due respect for the author of this tool, I have a really hard time with
comments like this on his page:

Gnuplot.
A long-time favorite of researchers. But its output is not up to publishing
standard, in my opinion.

Gnuplot has been around for many years (I've used it since 1991), and its
postscript is extremely good. Definitely far better than any of the examples
shown in the pychart page, all of which have that god-awful look of Excel cheap
charts.

In python, for the last few years I've been using (yes, for real research)
gnuplot with much success (with Gnuplot.py and the enhancements which ipython
ads), and right now I'm in the process of switching to matplotlib (and doing
much work so that ipython supports matplotlib for interactive work).

IMHO, matplotlib has a very clean design which makes it a great tool to bet on
for the future, with very good functionality, high quality output, and is being
actively developed by a strong team (not just John Hunter, but also the good
folks from the Hubble Space Telescope Science Institute).

Just my $.02,

f

Jul 18 '05 #12
You put me in a strange situation... it is not my goal to compare gnuplot and pychart, I
am just a messenger... I am not even sure that the two are comparable, to be fair (to both).

Pychart (as far as I am concerned) is a small and lean package to do statistical charts
and nothing else. Gnuplot is *much* more than that, it is more powerful and, consequently,
complex. Personally, my problem with gnuplot was that it lacked, for example, any
pie-chart facility (it is a topic of debates on the relevant mailing lists, b.t.w.) and I
was simply too lazy;-) to do start learning gnuplot and do it myself. In any case: I am
afraid we are comparing apples and oranges here.

As for the remark of the author you quote below... I let him defend himself if he reads
these lines. Personally, I do not care about it.

Ivan
Fernando Perez wrote:
Ivan Herman wrote:

If this is indeed what he means:-) I began to use PyChart last week:

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

I is o.k. for relatively simple statistical charts, and may produce output in
SVG, PS, PDF, PNG, and interactive X11 display

With all due respect for the author of this tool, I have a really hard time with
comments like this on his page:

Gnuplot.
A long-time favorite of researchers. But its output is not up to publishing
standard, in my opinion.

Gnuplot has been around for many years (I've used it since 1991), and its
postscript is extremely good. Definitely far better than any of the examples
shown in the pychart page, all of which have that god-awful look of Excel cheap
charts.

In python, for the last few years I've been using (yes, for real research)
gnuplot with much success (with Gnuplot.py and the enhancements which ipython
ads), and right now I'm in the process of switching to matplotlib (and doing
much work so that ipython supports matplotlib for interactive work).

IMHO, matplotlib has a very clean design which makes it a great tool to bet on
for the future, with very good functionality, high quality output, and is being
actively developed by a strong team (not just John Hunter, but also the good
folks from the Hubble Space Telescope Science Institute).

Just my $.02,

f


Jul 18 '05 #13
John Hunter <jd******@ace.bsd.uchicago.edu> wrote
gdmodule is really more of a low level drawing program than a graphing
module. Of course you can draw graphs with it, as you can with any
drawing program, but it's a lot easier to make scientific graphs (the
OP's interest) with a program designed for that purpose. matplotlib
has a gdmodule backend.

http://matplotlib.sourceforge.net/backends.html#GD

JDH


I tried matplotlib 0.63 with Python 2.3.4 on an old Win98 machine (500
MHz, 128 MB RAM) and found that I had to wait for at least 35 seconds
before even the simplest demo plot appeared. Is this expected?

The plots looked great, I just hope they appeared faster.
Jul 18 '05 #14

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

Similar topics

2
by: JAWS | last post by:
I get this error message when trying to run a unittest test with a dynamically created test method: Traceback (most recent call last): File "unittest.py", line 215, in __call__ testMethod()...
25
by: Magnus Lie Hetland | last post by:
Is there any interest in a (hypothetical) standard graph API (with 'graph' meaning a network, consisting of nodes and edges)? Yes, we have the standard ways of implementing graphs through (e.g.)...
6
by: poisondart | last post by:
Is there a way to dynamically generate temporary files (such as an html, xml or text file) in Python? I'm not sure if I'm explaining myself clearly as I've no clue how to describe this...
11
by: Steven D'Aprano | last post by:
Suppose I create a class with some methods: py> class C: .... def spam(self, x): .... print "spam " * x .... def ham(self, x): .... print "ham * %s" % x .......
2
by: brianlum | last post by:
Hi, I have been looking for a good way to convert python code into a control flow graph. I know of Python functions that will convert an expression into an abstract syntax tree (i.e. ast =...
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...
10
by: diffuser78 | last post by:
Is there any library in Python which has implementation of graph theoretic algorithms and models ?
4
by: John Henry | last post by:
I am looking for a ready made simple graph package. I found an extensive one in the piana package but when I try to use just the graph portion, it fails to load because of the line: class...
5
by: chrispoliquin | last post by:
I need to represent the hyperlinks between a large number of HTML files as a graph. My non-directed graph will have about 63,000 nodes and and probably close to 500,000 edges. I have looked...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
0
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...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.