plotting while preserving some properties

David Bateman David.Bateman at motorola.com
Thu Sep 4 05:12:11 CDT 2008


Giovanni Di Stasi wrote:
> Hi,
>
> I am using Octave and Gnuplot in order to draw a "moving" graph; I'm doing 
> that by calling repeatedly plot(X) and replot() with the new matrix; Between 
> a plot and the next, I'd like the title, the ylabel and the xlabel to be 
> preserved (without having to call title(...), xlabel(...) and ylabel(...) 
> every time). How can I do that?
>
> Another question: I call my script from bash (I made it executable and put 
> #! /usr/bin/octave -qf at the beginning) and, as I said above, I have to call 
> both plot and replot (If I just call plot, the figure won't even show up), 
> whilst, in the Octave command line, plot is sufficient. Shouldn't plot be 
> enough in both cases?
>
> Many thanks.
>
> I'm using:
> GNU Octave, version 3.0.0
> Gnuplot Version 4.2 patchlevel 2
>
>   
 
In the repository this can be done with something like

           x = 0:0.1:10;
           y = sin (x);
           plot (x, y, "ydatasource", "y");
           xlabel ("x");
           ylabel("y");
           title ("This is a moving plot");
           for i = 1 : 100
             pause(0.1)
             y = sin (x + 0.1 * i);
             refreshdata();
           endfor

though not in 3.0.x. For 3.0.x you can try something like

           x = 0:0.1:10;
           y = sin (x);
           h = plot (x, y);
           xlabel ("x");
           ylabel("y");
           title ("This is a moving plot");
           for i = 1 : 100
             drawnow ();
             pause(0.1)
             y = sin (x + 0.1 * i);
             set (h, "ydata", y);
           endfor

D.




-- 
David Bateman                                David.Bateman at motorola.com
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary



More information about the Help-octave mailing list