GNUplot Plugin

It is based on the great graphviz plugin by Carl-Christian Salvesen.

I'm not going to explain much stuff here, just install gnuplot and you'll be fine ;-).

News/Changes

24.08.2005

  • darcs repository created

Installation (with darcs)

$> cd dokuwiki/lib/plugins
$> darcs get http://darcs.erazor-zone.de/php/dokuwiki/plot/

Update

$> darcs pull

latest changes

lastest dist

Source files

inc/plugins/plot/syntax.phpreveal hidden content

Examples

<plot>
plot [-20:20] cos(x)/x
</plot>

<plot>
set contour base
set cntrparam levels incremental -20,5,10
set title "9 incremental contours starting at -20, stepping by 5" 0.000000,0.000000  font ""
splot x*y
</plot>

Hints

  • hints for other releases
  • check PHP_Compat lib for file_put_contents.php.
  • dokuwiki-2005-06-11
    • change the path to fetch.php: lib/exe/fetch.php

Comments

Sweet. You inherited my namespace-bug. :-) The output should live in the same namespace as the >referring page. But still; Sweet. — Carl-Christian Salvesen 2005/06/07 00:33
Well, youre right, but this one saves some cpu-usage when rendering the same stuff in different namespaces :-)

This looks very cool, but I am unable to get it working with the latest stable dokuwiki though. Reasons for this may be (it's lib/plugins now instead of inc/plugins). Tried changing syntax.php to use lib/plugins and /sw/bin/gnuplot, still no go. Fudged with ACLs for media:plot and also tried changing from /tmp to /path/writable/by/webserver. Any ideas, or if possible, it would be great to have a simple step by step howto that applies to the latest dokuwiki. Thanks alot for all your efforts. Nick
I had to heavily hack the gnuplot command to get it to work. My system has gnuplot version 4 patchlevel 0 installed...I ended up with “set terminal png transparent color medium picsize 420 320”...you could play around with commandline gnuplot to find the settings that work for you. It might be helpful if there were a config option to allow basic setup. =G=

2006Feb09
What does this mean? 'change the path to fetch.php: lib/exe/fetch.php'
E-Razor: Don't care about it, i used 'fetch.php' in the first versions, see patch: 20050925172041-0ad7b-e55ed0022c28b3e285e51480030888b7586fbbb1.gz

Federico Ariza 2007/03/14

I have no idea how to add a patch to this plugin (I sent a diff file to the author...), so I will add it here.

I took this piece of code from the gnuplot plugin of mediawiki. In the function createImage($filename, &$data) after defining $tmpfname add the following

while (strpos($data, 'src:') != false) {
            $srcStartPosition = strpos ($data, 'src:') + strlen("src:");
            $srcEndPosition = strpos ($data, ' ', $srcStartPosition);
            $tmpString = substr($data, $srcStartPosition, $srcEndPosition-$srcStartPosition-1);
            $srcFileNamePath = $conf['mediadir'] .$tmpString;
            $data = str_replace("src:$tmpString",$srcFileNamePath,$data);
        }

this will make possible to use data loaded to your media folder, for example if you loaded playground/datos.txt to your mediafolder the following code will plot using the data stored in the datos.txt file

<plot>
set key left
plot  'src:/playground/datos.txt' using 1:2 ti "my graph"
</plot>

When i install this plugin i have this error :

Warning: main(/usr/lib/php/PHP/Compat/Function/file_put_contents.php) [function.main]: failed to open stream: No such file or directory in (..)/htdocs/wiki/lib/plugins/plot/syntax.php on line 12

Fatal error: main() [function.require]: Failed opening required '/usr/lib/php/PHP/Compat/Function/file_put_contents.php' (include_path='.:/usr/local/lib/php') (...)/htdocs/wiki/lib/plugins/plot/syntax.php on line 12

(I'm french)


I replaced

$tmpfname = tempnam("/tmp", "dokuwiki.plot");

with

$tmpfname = tempnam(DOKU_PLUGIN."/tmp", "dokuwiki.plot");

because write to /tmp isnt allowed. this tmp dir is used by multiple plugins yet.

But cool Plugin :) - i'm using it together with dokutexit.

Gabor 2008/06/12

 
wiki/projects/php/dokuwiki/plugins/gnuplot.txt · Last modified: 2010/06/23 13:46 by e-razor
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki