How to create graphs in mavscript
---------------------------------

Mavscript does not support graphs directly, as it is text based.
A way to draw graphs (xy-diagrams) is to create an image file. The html or OpenOffice odt template can link to it.
The difficult part is creating the image file. Therefore third party software (e.g. gnuplot) might be needed.


Mavscript using LaTeX
---------------------
A convenient way to get graphical capabilities for Mavscript is to use a LaTeX-template.
Generating graphics in LaTeX is comfortable using TikZ or Asymptote.
Examples are provided in the folder examples/LaTeX.



Mavscript-yacas
---------------
Yacas provides support for plots, but is requires gnuplot.
http://www.gnuplot.info/
Gnuplot is not platform independent java software, but it is available for a lot of platforms.
Gnuplot must be in the path (that means you can start it typing "gnuplot" in the command line).
Windows: add the gnuplot program folder to %PATH%.
Mac: create a symlink into a directory in the path. E.g. in /usr/local/bin "sudo ln -s /usr/local/octave/3.8.0/bin/gnuplot ."
Linux: no configuration needed.
An example is provided in the folder examples/html.

Function plots:
1.) In odt write somewhere §m Plot2D(f(x), 0:5, output = png, filename = "graph.png") §n and insert an image as a link.
1.) In html write <IMG SRC="§m Plot2D(f(x), 0:5, output = png, filename = &quot;graph.png&quot;) §o">

Other plots:
A general approach is to first create a simple text file containing the data. Then a file containing the gnuplot instruction is written. 
Finally gnuplot is called and creates the image file graph.png.

1.) §m ToFile("data.txt1") Echo({0,1,Nl(),1,4,Nl(),2,8,Nl(),3,6}); §n

2.) §m ToFile("gnuplot.txt") Echo("set terminal png; set output \"graph.png\"; plot \"data.txt1\""); §n
3.) §m SystemCall("gnuplot gnuplot.txt"); §n

4.) In the template (anywhere), create a link to graph.png


Mavscript-beanshell
-------------------
Using jmathplot (shipped with mavscript).
https://code.google.com/p/jmathplot/
An example are provided in the folder examples/html.

1.) §m plot = new Plot2DPanel() §n

2.) §m double[] x = {1, 2, 4} §i
    §m double[] y = {0, 3, 15} §i
    §m plot.addLinePlot("y=x^2-1", x, y) §n

3.) §m toPNG(plot, "graph.png") §n

4.) In the template (anywhere), create a link to graph.png


Mavscript-jasymca
-----------------
Jasymca provides built-in support for plots.
An example are provided in the folder examples/html.

1.) §m x = [0 1 2 3] §i, §m x = [1 4 8 6] §i

2.) §m plot(x,y) §i

3.) §m print("graph.png“) §n

4.) In the template (anywhere), create a link to graph.png
