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: Thu, 19 Jan 2012 15:39:25 -0500

On Jan 19, 2012, at 2:40 PM, Paul Perry wrote:

> On Thu, Jan 19, 2012 at 9:47 AM, Ben Abbott <address@hidden> wrote:
> 
> On Jan 19, 2012, at 6:48 AM, Paul Perry wrote:
> 
> > I am on a Mac OS X 10.6.8 Octave 3.4 and I would like to output a plot to 
> > an html5 canvas? How do I send a command to gnuplot to set the terminal to 
> > canvas?  Is this supported?
> 
> Octave doesn't yet include support for gnuplot's html5 terminal.
> 
> I'll need to look at the appropriate gnuplot docs to include it. Can you tell 
> me which version of gnuplot has this terminal ?
> 
> If you're interested in trying to modify Octave to enable the htlm5 terminal, 
> the sources to patch are ...
> 
>        __gnuplot_drawnow__.m: gnuplot_set_term()
>        __gnuplot_drawnow__.m: gnuplot_is_enhanced_term()
> 
> Once html5 is added there, you can produce a plot with ...
> 
>        plot (rand (3))
>        drawnow ("html5", "plot.html5", false, "/dev/null")
> 
> I've been considering modifying __gnuplot_drawnow__.m to support gnuplot 
> terminals that are not explicitly supported by Octave. Perhaps this is an 
> opportunity to me to do that.
> 
> To add html5 support the print(), then the sources to modify include ...
> 
>        print.m
>        __gnuplot_print__.m
> 
> Ben
> 

> Gnuplot 4.4 seems to have this terminal.  In the documentation ( 
> http://www.gnuplot.info/docs_4.4/gnuplot.pdf ) section 83.7 (pp. 189) they 
> describe the following commands:
> 
> set term canvas name 'fishplot'
> set output 'fishplot.js'
> 
> I installed a gnuplot-4.4.3-aqua-i386.dmg for Octave 3.4.  Starting just 
> Gnuplot and typing "set terminal canvas" worked.  plot(rand(3)) resulted in 
> an html output.  So it looks like I'm close! 
> 
> I'd have to figure out how to modify the Octave files you list.
> 
> Thanks.
> 
> p.s. Here are some demos: http://gnuplot.sourceforge.net/demo_canvas/
> 
> How do I find which version of gnuplot I installed with Octave 3.4 

*** Please don't top-post. By replying below those who arrive late can follow 
along. Thanks ***

Ok. Thanks. I was looking for a terminal named "html5". I didn't realize it was 
called canvas. My gnuplot is 4.4.4 so I should be able to add this terminal.

I've added a feature request to the bug tracker.

        https://savannah.gnu.org/bugs/index.php?35332

To see which gnuplot your Octave is using ...

        cd (fileparts (which ("plot")))
        __gnuplot_version__ 
        ans = 4.4.4

I just tried the commands below

        peaks ()
        drawnow ("canvas", "peaks.html", false, "debug.gp")

This does render an html5 document. But the plot appears to be rendered in 
pixels, not inches.

I made the follow change to debug.gp

$ diff -ua debug.orig.gp debug.gp
--- debug.orig.gp       2012-01-19 15:08:10.000000000 -0500
+++ debug.gp    2012-01-19 15:08:21.000000000 -0500
@@ -1,5 +1,5 @@
 unset multiplot;
-set terminal canvas enhanced size 7.77777777778,5.83333333333 
+set terminal canvas enhanced size 640,480
 set output 'myplot.html';
 set multiplot;

Then from a bash command line, I run the new version through gnuplot.

        gnuplot debug.gp

The result rendered as expected in web browser.

Ben





reply via email to

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