By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,983 Members | 1,597 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,983 IT Pros & Developers. It's quick & easy.

Dynamically Generating a Graph in Python

P: n/a
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
Share this Question
Share on Google+
13 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
>>>>> "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

P: n/a
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

P: n/a
>>>>> "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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.