Contact & Privacy

openPlaG - Plot-a-Graph - Download

openPlaG4_0.tar.gz  4.004/06/202048.0 kBShort and long dashed lines can be chosen for the single graphs. Security added to avoid SQL injection (this program doesn't use SQL). Error in phi-function fixed.

Show older versions | Hide older versions

The source code has more functions included than the online version function graph plotter. This is, because some extremely computational intensive functions (gamma, zeta, theta) and those which use these had to be removed from the online version, because of server overload. Keep this in mind when keeping them in the source code (v3.7 onwards in init.php first line which is not a comment, change $gzt to 0 to switch them off).


Here is the source code of the Online Function Graph Plotter, published as open source (or free software, whatever term you prefer) under the GNU GPL v2. Use and change it as you wish, according to the license. I cannot give any support for setup or code, but the source code should be quite understandable for anyone familiar with PHP. However, if you make any improvements, fix bugs or add new functions, please mail them to me, juergen [at] jumk [dot] de.

About the program

openPlaG is an online function graph plotter, written in PHP, tested on PHP 7.2. It can compute and plot a very high amount of functions, including many probability functions and is fairly good configurable. It has an extensive instruction page. Click one of the links above to see it in action.


To run the program, you'll need access to a web server with PHP 5 or above and GDlib running.

The downloaded program is a zipped tarball, which contains these files:
back.png background image for transparency, new in version 2.2. differential and integral functions, new in version 3.0.
function.php the iframe content, where the graph image is shown.
gnu_gpl.txt GNU GENERAL PUBLIC LICENSE Version 2. Read it, don't change it.
graph.css the style sheet.
graph.php calculates the graph and draws the image. You should uncomment the line at the beginning (the one with the $HTTP_REFERER) and enter your own URL there.
init.php security check and formulae (functions) definitions. To avoid server overload, set $gzt=0
index.html start here when getting into the source code. This is the start page with the two iframes for the graph and the single values.
instructions.html explains the use of the plotter.
openPlaG.html renamed to index.html in version 3.5.
script.js from version 2.4 on, the javascript functions have moved into this file to increase clearness.
single.php calculates a formula with single values, not the whole graph. The result is shown in the second iframe. From version 2.2 on, multiple values can be calculated at once, the output is a score table.

Upload the files on your server. The program should work without problems, if server and PHP are configured properly. Make your changes as you want to, but don't forget to tell me if you make something really amazing or useful ;-) Have fun :-) Juergen Kummer

© Webprojects | Imprint & Privacy

Sample graph: condition on sinc, sine cardinalis (sinc), vertical asymptote at π
Different scales for x and y. No reticule lines, no caption, gap at origin.
Sine cardinalis


11/11/2018 Version 3.5 tested to run on PHP 7.2. Error handling doesn't work, if there is an error, no image will be created. This is working again in 3.7

03/13/2017 Yep, still alive.

11/17/2008 In the beginning of 2009 a version 3.0 will appear. I am planning to release less often from now on, but to take more care on testing and debugging. 3.0 will have some changes, but probably no major ones. The jump from 2 to 3 is due to the longer release cycles (and the new year ;).

09/21/2008 In version 2.5 is a bug: numbers like 2E10 or 3E-5 are interpreted wrong. This will be fixed in version 2.6 [done]. To fix it manually, change in the init.php line 183 to
if(ereg("[a-zA-Z]",substr($term,$i+1,1)) && substr($term,$i+1,1)!="E") {

02/11/2008 Many thanks to Matthias Bilger, who programmed the ^ to pow() conversion (new in 2.1, see init.php), thus giving the program its first piece of oop.

01/29/2008 One bug (no, it's not a feature!) in 2.0: When drawing an asymptote, an error message will occur. To avoid that, disable errors. This will be fixed in the next version [done].

01/08/2008 If you want a German translation of the plotter, you can use that from the Funktionsgraphen-Plotter. If you want other languages, you have to translate yourself.

09/16/2007 A minor mistake in version 1.03: the instructions say, that constants like pi/2 and pi*2 in the display adjustment are allowed, too. That is no longer true from 1.03 on, only constants like pi are still allowed. This is due to security reasons, because these values will be executed via eval().

09/06/2007 I have no idea why the tar.gz-file of version 1.02 is smaller than that of version 1.01. The included files of 1.02 indeed are a bit larger than those of its predecessor.

09/06/2007 The error function erf, new in version 1.02, uses the Taylor series, which contains an infinite sum. I decided that it's enough to count to 100 for a satisfying preciseness. Change that if you like, but higher values result in a higher computing time.

08/29/2007 What I forgot to mention before: the heart of the program, i.e. the part that does the calculation, is the last block in the init.php.

07/20/2007 The 'Load & Save' section, new in version 1.01, will only work, if openPlaG.html and function.php are running on the same domain. This shouldn't be a major handicap. However on my page, Function Graph Plotter, this is not the case and this feature is therefore not included there. If you have the same problem, remove that feature. Update: Working now on my page too, since I moved to another server with 2.0.

07/04/2007 Depending on the used functions, the program can be computationally very intensive, especially when doing these things that need the gamma function (which is already defused) or the Riemann zeta function. This is the main reason why the image has a max width of only 500 pixels. Change that to larger images, if you think your server can handle it. The same is true for the amount of graphs - the more graphs the more intensive, so I restricted them to three. Other restrictions, like the number of available colors, are due to usability and simplicity, on which the program aims. Change that at will.

Something completely different

I hope you like that one, too: Images of the chemical elements from the periodic table