Subject: [LON-CAPA-dev] Future Directions Ideas: gnuplot

From: "Phil Fazio" <[email-masked]>
Date: Wed, 21 Mar 2007 21:43:02 -0400

Hello all, and I apologize for the late posting to the group, but I haven't
had much time to spare to put this together.

When looking at future directions, there are a couple of starter projects
that I would like to put some time into, and the one which interests me the
most is improving and updating the LON-CAPA implementation of gnuplot, both
adding features and possibly reorganizing the XML schema used to generate
plots.

Currently, the LON-CAPA implementation can handle 2-dimensional function and
data graphs well, but as more pure mathematics, statistics, and new science
applications (in addition to possible use in other topics) come on board,
these graphing capabilities become weaker.  For example, 3-dimensional plots
are not currently possible, nor is the ability to have truly customizable
labels (size, location, symbols, etc.). In newer versions of gnuplot, types
of plots such as histograms are possible as well, and vector fields. This is
but a short list of gnuplot-capable functions that would be well implemented
in LON-CAPA.  Being new to Perl, I think this would be a nice starter
project for me to start work on.  Off the top of my head, I would like to
implement some of the following functions into LON-CAPA:

* upgrade gnuplot to version 4.2 (currently using 4.0)
* 3 dimensional graphing, both in wire grid and surface form
* arrows and vector fields given data
* RGB and hex color options for individual portions of graphs (bug 874)
* new features of gnuplot that solve existing LON-CAPA bugs
     *  symbols and sub/superscript in graph labels (bugs 2135 and 3994)
     *  implement line thickness (bug 4794)
     *  implement new graph tic options (bug 2201)
* multiple plots on a single graph
* support polar and cylindrical graphing
* parametric functions
* fitting curves to data

In order to add a good chunk of this without overbloating the current XML
structure used by authors to create plots, I am working on a more detailed
document detailing a proposed new XML schema to incorporate these new
features in a coherant manner for both XML authors and colorful-editor
users.

While I can make no guarantees about how much work I can get done on this
right now, I was wondering what authors and/or developers might find most
useful of these items, any directions I should go in, or, for that matter,
any suggestions at all. Thanks for any feedback, I'm excited to maybe be
working on this little project.

Phil

P.S. Link for gnuplot, both general info and demos:
http://gnuplot.sourceforge.net/

---

From: Guy Albertelli II <[email-masked]>
Date: Fri, 30 Mar 2007 15:59:28 -0400 (EDT)

Hi Phil,

> * multiple plots on a single graph

Hmm, though that this works aready. At least I can add multiple curves
to 1 gnuplot object...

> * support polar and cylindrical graphing

Isn't Polar is fully supported?

> features in a coherant manner for both XML authors and colorful-editor

Well I generally argue in favor of evolution rather than revolution.

This it might be better to try to add in some of the features rather
than trying to design a complete revamp?

And as for direction I guess I'd start with trying to satisfy the
filed bugs first. And see how that goes.

-- 
[email-masked]   0-7-0-9-27,137

---

From: Peter Riegler <[email-masked]>
Date: Wed, 09 May 2007 20:32:47 +0200

Hi,

I was trying to implement a problem requiring the display of a contour 
plot. After realizing that contour plots (set contour; splot ...) 
possibly are not part of loncapa's subset of gnuplot I found myself 
confirmed by Phil's and Guy's discussion. I would like to add the 
following to it:
Wouldn't it be easier to make a slim xml-structure allowing access to 
all of gnuplot's functionality? I think that this will be happily used 
by people who are familiar with gnuplot (or have time to make themselves 
familiar).
By slim xml-structure I mean something like
         <script type="loncapa/perl">
	$myfunction = "sin(&random(1,5,1)*x)";
	</script>
	<gnuplot>
	<shellcommand>
	set xlabel "t"; plot [-4:4] [-3:3] $myfunction
	</shellcommand>
	</gnuplot>
where the shellcommand-tag can contain ANY valid gnuplot command.

Gnuplot is far too powerful to have a detailed xml-structure in loncapa. 
Imagine the authoring of a perl-script blocks would require a detailed 
xml-structure, like
<command>
<var>x</var>
<assign/>
<function arguments="0,10,1">&random</function>
</command>

Peter

-- 
Peter Riegler
Fachhochschule Braunschweig/Wolfenbüttel
Salzdahlumer Str. 46/48, 38302 Wolfenbüttel
Tel. +49 5331 939 6314, Fax. +49 5331 939 6002
email: [email-masked]
http://public.rz.fh-wolfenbuettel.de/~riegler

---

From: Guy Albertelli II <[email-masked]>
Date: Wed, 9 May 2007 16:03:07 -0400 (EDT)

Hi Peter,

> by people who are familiar with gnuplot (or have time to make themselves 

It doesn't currently exist since:

- it's a security issue (there is at least the system command that we
wouldn't want in there, along with all of the file manipulation
commands)
- it's a support issue, (when gnuplot changes how it works, problems
will occur where a resource works on one machine but not on another
since one is on a later version of gnuplot versus another)
- printing starts failing. (Some gnuplot features only work for display
drivers)
- the original plan had hoped to make the <plot> tag and not make it
completely tied to gnuplot, so that we could replace the plotting
engine at a later date if we needed too.
- there is possibly an ease of use issue that could be brought up too,
but the ease of the XML is likely more due to the fact that we've
limited what can be done, so it is therefore easier.

> Imagine the authoring of a perl-script blocks would require a detailed 

This is the direction that QTI went.

So we could argue over which is the better approach. :-) Likely using
the same list of reasons as above...

> Fachhochschule Braunschweig/Wolfenb?ttel
> Salzdahlumer Str. 46/48, 38302 Wolfenb?ttel
> _______________________________________________
> LON-CAPA-dev mailing list
> [email-masked]
> http://mail.lon-capa.org/mailman/listinfo/lon-capa-dev
>