help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I use octave gnuplot to html5 canvas terminal?


From: Ben Abbott
Subject: Re: How do I use octave gnuplot to html5 canvas terminal?
Date: Fri, 20 Jan 2012 09:49:12 -0500

On Jan 20, 2012, at 8:26 AM, Paul Perry wrote:

> On Fri, Jan 20, 2012 at 8:07 AM, Ben Abbott <address@hidden> wrote:
> 
> On Jan 20, 2012, at 7:45 AM, Paul Perry wrote:
> 
> > Hopefully one last request:  how do we pass additional arguments to the 
> > canvas terminal?  I'd like to pass a 'jsdir' string and 'name' parameter as 
> > in:
> >
> > set terminal canvas enhanced mousing size 1120,840 jsdir './js/' name 
> > 'file.js'
> >
> > drawnow() doesn't take these parameters.  I could not get the 'set' command 
> > to work:
> >
> > set(terminal,"canvas","jsdir","./js/","name","file.js","size","1120,840")
> >
> > hints?
> >
> > Thank you.
> 
> You'll need to save the gnuplot commands and edit them yourself.
> 
> What does the "jsdir './js/' name 'file.js'" part do ?
> 
> Is this something that should be included by default ?
> 
> Ben
> 
> 
> By default the .js and .css files are set to "/tmp/gnuplot-some-dir/etc", 
> requiring the html to be edited every time.  The jsdir parameter allows you 
> to set the javascript directory, in my case "./js/" . 
> 
> The "name" parameter outputs the canvas as a javascript file which can then 
> be included in a more complex html file.  This will allow us to just modify 
> and include the canvas instead of re-editing the html file every time.   This 
> change alone, would allow us to run the Octave commands and then just reload 
> the html to view an interactive plot instead of modifying the octave output 
> to gnuplot every time.
> 
> Thx

Ok, I understand. I don't see a good way to have Octave handle this. However, I 
do have a work around for you.

I've attached a bash shell script that will fix the gnuplot terminal setting 
for you.

To get the result you are looking for, create your plot and save the plotstream.

        peaks ()
        drawnow ("canvas", "/dev/null", false, "plotstream.gp")

Then use the bash script to modify gnuplot terminal command in "plotstream.gp"

        [status, output] = system ("add_js_to_canvas_terminal.sh");

If you get an error, make sure the script is executable. From the terminal you 
can type ...

        chmod 755 add_js_to_canvas_terminal.sh

Finally, pass the plotstream through gnuplot to produce your html5 file.

        [status, output] = system ("gnuplot plotstream.gp");

My javascript isn't set up the way yours is, so passing plotstream.gp through 
gnuplot produces an error for me. However, the terminal command matches the one 
you mentioned above. So this should work for you.

Ben




reply via email to

[Prev in Thread] Current Thread [Next in Thread]