Silent plot(x,y)

View: New views
11 Messages — Rating Filter:   Alert me  

Silent plot(x,y)

by Bugzilla from kkrizka@gmail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi there,

I'm wondering if it is possible to plot a graph without displaying
anything to the file. Basically, I'm trying to do an animated graph by
plotting them step by step (suggested here:
http://www.nabble.com/Displaying-an-animation---%22movie%22-td4199665.html
) and saving each graph as a file.

In summary, I have the following script:
x=[0:1];
for i=[0:1000]
 plot(x,x*i);
 filename=sprintf("%02d.png",i);
 print(filename);
end

The problem is that plot command displays the graph to the screen, and
I think that it might be slowing (I show more than than 1000 frames..)
down my script. Is there a way to suppress/silent the plot() command?

I'm using octave 3.0.5 from the Ubuntu Karmic repositories.

After some googling, I found the following suggestion:
gset term postscript eps color
gset output "name.eps"

But:
octave:1> gset term postscript eps color
parse error:

  syntax error

>>> gset term postscript eps color
             ^

octave:1> gset output "name.eps"
parse error:

  syntax error

>>> gset output "name.eps"
               ^
Any suggestions? Am I missing some package?
--
Cheers,
Karol Krizka
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: Silent plot(x,y) (3.2 or later bug?)

by Tatsuro MATSUOKA-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello

Please try

x=[0:1];
for i=[0:100]
 plot(x,x*i);
 filename=sprintf("%02d.png",i);
 drawnow('png',filename);
end

The above works on octave 3.0.5 (mingw).

However, it does not work on octave 3.2.2 (mingw), 3.3.50+ (mingw) and octave 3.2.3(cygwin)
error: get: unknown property "__pixels_per_inch__"
error: called from:
error:   C:\Programs\Octave\3.2.2_gcc-4.3.0\share\octave\3.2.2\m\plot\gnuplot_drawnow.m at line 190,
column 14
error:   C:\Programs\Octave\3.2.2_gcc-4.3.0\share\octave\3.2.2\m\plot\gnuplot_drawnow.m at line 74,
column 7

The error message is for octave 3.2.2 (mingw) but that for octave 3.2.3 on cygwin is almost the same.

Regards

Tatsuro

--- Karol Krizka wrote:

> Hi there,
>
> I'm wondering if it is possible to plot a graph without displaying
> anything to the file. Basically, I'm trying to do an animated graph by
> plotting them step by step (suggested here:
> http://www.nabble.com/Displaying-an-animation---%22movie%22-td4199665.html
> ) and saving each graph as a file.
>
> In summary, I have the following script:
> x=[0:1];
> for i=[0:1000]
>  plot(x,x*i);
>  filename=sprintf("%02d.png",i);
>  print(filename);
> end
>
> The problem is that plot command displays the graph to the screen, and
> I think that it might be slowing (I show more than than 1000 frames..)
> down my script. Is there a way to suppress/silent the plot() command?
>
> I'm using octave 3.0.5 from the Ubuntu Karmic repositories.
>
> After some googling, I found the following suggestion:
> gset term postscript eps color
> gset output "name.eps"
>
> But:
> octave:1> gset term postscript eps color
> parse error:
>
>   syntax error
>
> >>> gset term postscript eps color
>              ^
>
> octave:1> gset output "name.eps"
> parse error:
>
>   syntax error
>
> >>> gset output "name.eps"
>                ^
> Any suggestions? Am I missing some package?
> --
> Cheers,
> Karol Krizka
> _______________________________________________
> Help-octave mailing list
> Help-octave@...
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>


--------------------------------------
GyaO! - Anime, Dramas, Movies, and Music videos [FREE]
http://pr.mail.yahoo.co.jp/gyao/
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: Silent plot(x,y) (3.2 or later bug?)

by Bugzilla from kkrizka@gmail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/10/15 Tatsuro MATSUOKA <tmacchant@...>:

> Hello
>
> Please try
>
> x=[0:1];
> for i=[0:100]
>  plot(x,x*i);
>  filename=sprintf("%02d.png",i);
>  drawnow('png',filename);
> end
>
> The above works on octave 3.0.5 (mingw).
>
Thanks, that works!

> However, it does not work on octave 3.2.2 (mingw), 3.3.50+ (mingw) and octave 3.2.3(cygwin)
> error: get: unknown property "__pixels_per_inch__"
> error: called from:
> error:   C:\Programs\Octave\3.2.2_gcc-4.3.0\share\octave\3.2.2\m\plot\gnuplot_drawnow.m at line 190,
> column 14
> error:   C:\Programs\Octave\3.2.2_gcc-4.3.0\share\octave\3.2.2\m\plot\gnuplot_drawnow.m at line 74,
> column 7
>
> The error message is for octave 3.2.2 (mingw) but that for octave 3.2.3 on cygwin is almost the same.
>
I also have octave 3.2 installed on a different Ubuntu computer, and I
get the same error.
error: get: unknown property "__pixels_per_inch__"
error: called from:
error:   /usr/share/octave/3.2.2/m/plot/gnuplot_drawnow.m at line 190, column 14
error:   /usr/share/octave/3.2.2/m/plot/gnuplot_drawnow.m at line 74, column 7
error:   test.m at line 5, column 2

--
Cheers,
Karol Krizka
http://www.krizka.net


> Regards
>
> Tatsuro
>
> --- Karol Krizka wrote:
>
>> Hi there,
>>
>> I'm wondering if it is possible to plot a graph without displaying
>> anything to the file. Basically, I'm trying to do an animated graph by
>> plotting them step by step (suggested here:
>> http://www.nabble.com/Displaying-an-animation---%22movie%22-td4199665.html
>> ) and saving each graph as a file.
>>
>> In summary, I have the following script:
>> x=[0:1];
>> for i=[0:1000]
>>  plot(x,x*i);
>>  filename=sprintf("%02d.png",i);
>>  print(filename);
>> end
>>
>> The problem is that plot command displays the graph to the screen, and
>> I think that it might be slowing (I show more than than 1000 frames..)
>> down my script. Is there a way to suppress/silent the plot() command?
>>
>> I'm using octave 3.0.5 from the Ubuntu Karmic repositories.
>>
>> After some googling, I found the following suggestion:
>> gset term postscript eps color
>> gset output "name.eps"
>>
>> But:
>> octave:1> gset term postscript eps color
>> parse error:
>>
>>   syntax error
>>
>> >>> gset term postscript eps color
>>              ^
>>
>> octave:1> gset output "name.eps"
>> parse error:
>>
>>   syntax error
>>
>> >>> gset output "name.eps"
>>                ^
>> Any suggestions? Am I missing some package?
>> --
>> Cheers,
>> Karol Krizka
>> _______________________________________________
>> Help-octave mailing list
>> Help-octave@...
>> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>>
>
>
> --------------------------------------
> GyaO! - Anime, Dramas, Movies, and Music videos [FREE]
> http://pr.mail.yahoo.co.jp/gyao/
>

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: Silent plot(x,y) (3.2 or later bug?)

by Tatsuro MATSUOKA-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello

I have looked at  codes of gnuplot_drawnow.m and print.m.
Initialization of __pixels_per_inch__ is executed in print.m

I think that this is a bug.

Tentatively, this bug(?) can be avoided by dummy print once for octave 3.2 or later.

plot (1:10);print ('dummy.png','-dpng');clf;
x=[0:1];
for i=[0:100]
 plot(x,x*i);
 filename=sprintf("%02d.png",i);
 drawnow('png',filename);
end
close;unlink('dummy.png');


Side effect: An empty plow window is open during print :-(, but it is no relation for speed
please forgive the bug will be fixed.

Tatsuro

Regards

Tatsuro



--- Karol Krizka wrote:

> 2009/10/15 Tatsuro MATSUOKA <tmacchant@...>:
> > Hello
> >
> > Please try
> >
> > x=[0:1];
> > for i=[0:100]
> > plot(x,x*i);
> > filename=sprintf("%02d.png",i);
> > drawnow('png',filename);
> > end
> >
> > The above works on octave 3.0.5 (mingw).
> >
> Thanks, that works!
>
> > However, it does not work on octave 3.2.2 (mingw), 3.3.50+ (mingw) and octave 3.2.3(cygwin)
> > error: get: unknown property "__pixels_per_inch__"
> > error: called from:
> > error:  C:\Programs\Octave\3.2.2_gcc-4.3.0\share\octave\3.2.2\m\plot\gnuplot_drawnow.m at
> line 190,
> > column 14
> > error:  C:\Programs\Octave\3.2.2_gcc-4.3.0\share\octave\3.2.2\m\plot\gnuplot_drawnow.m at
> line 74,
> > column 7
> >
> > The error message is for octave 3.2.2 (mingw) but that for octave 3.2.3 on cygwin is almost
> the same.
> >
> I also have octave 3.2 installed on a different Ubuntu computer, and I
> get the same error.
> error: get: unknown property "__pixels_per_inch__"
> error: called from:
> error:   /usr/share/octave/3.2.2/m/plot/gnuplot_drawnow.m at line 190, column 14
> error:   /usr/share/octave/3.2.2/m/plot/gnuplot_drawnow.m at line 74, column 7
> error:   test.m at line 5, column 2
>
> --
> Cheers,
> Karol Krizka
> http://www.krizka.net
>
>
> > Regards
> >
> > Tatsuro
> >
> > --- Karol Krizka wrote:
> >
> >> Hi there,
> >>
> >> I'm wondering if it is possible to plot a graph without displaying
> >> anything to the file. Basically, I'm trying to do an animated graph by
> >> plotting them step by step (suggested here:
> >> http://www.nabble.com/Displaying-an-animation---%22movie%22-td4199665.html
> >> ) and saving each graph as a file.
> >>
> >> In summary, I have the following script:
> >> x=[0:1];
> >> for i=[0:1000]
> >> plot(x,x*i);
> >> filename=sprintf("%02d.png",i);
> >> print(filename);
> >> end
> >>
> >> The problem is that plot command displays the graph to the screen, and
> >> I think that it might be slowing (I show more than than 1000 frames..)
> >> down my script. Is there a way to suppress/silent the plot() command?
> >>
> >> I'm using octave 3.0.5 from the Ubuntu Karmic repositories.
> >>
> >> After some googling, I found the following suggestion:
> >> gset term postscript eps color
> >> gset output "name.eps"
> >>
> >> But:
> >> octave:1> gset term postscript eps color
> >> parse error:
> >>
> >>  syntax error
> >>
> >> >>> gset term postscript eps color
> >>       ^
> >>
> >> octave:1> gset output "name.eps"
> >> parse error:
> >>
> >>  syntax error
> >>
> >> >>> gset output "name.eps"
> >>        ^
> >> Any suggestions? Am I missing some package?
> >> --
> >> Cheers,
> >> Karol Krizka
> >> _______________________________________________
> >> Help-octave mailing list
> >> Help-octave@...
> >> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
> >>
> >
> >
> > --------------------------------------
> > GyaO! - Anime, Dramas, Movies, and Music videos [FREE]
> > http://pr.mail.yahoo.co.jp/gyao/
> >
>


--------------------------------------
GyaO! - Anime, Dramas, Movies, and Music videos [FREE]
http://pr.mail.yahoo.co.jp/gyao/
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: Silent plot(x,y) (3.2 or later bug?)

by Carlo de Falco-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 16 Oct 2009, at 02:59, Karol Krizka wrote:

> 2009/10/15 Tatsuro MATSUOKA <tmacchant@...>:
>> Hello
>>
>> Please try
>>
>> x=[0:1];
>> for i=[0:100]
>> plot(x,x*i);
>> filename=sprintf("%02d.png",i);
>> drawnow('png',filename);
>> end
>>
>> The above works on octave 3.0.5 (mingw).
>>
> Thanks, that works!
>
>> However, it does not work on octave 3.2.2 (mingw), 3.3.50+ (mingw)  
>> and octave 3.2.3(cygwin)
>> error: get: unknown property "__pixels_per_inch__"
>> error: called from:
>> error:   C:\Programs\Octave\3.2.2_gcc-4.3.0\share\octave\3.2.2\m
>> \plot\gnuplot_drawnow.m at line 190,
>> column 14
>> error:   C:\Programs\Octave\3.2.2_gcc-4.3.0\share\octave\3.2.2\m
>> \plot\gnuplot_drawnow.m at line 74,
>> column 7
>>
>> The error message is for octave 3.2.2 (mingw) but that for octave  
>> 3.2.3 on cygwin is almost the same.
>>
> I also have octave 3.2 installed on a different Ubuntu computer, and I
> get the same error.
> error: get: unknown property "__pixels_per_inch__"
> error: called from:
> error:   /usr/share/octave/3.2.2/m/plot/gnuplot_drawnow.m at line  
> 190, column 14
> error:   /usr/share/octave/3.2.2/m/plot/gnuplot_drawnow.m at line  
> 74, column 7
> error:   test.m at line 5, column 2

the following should work on 3.2.x (I have tested it on 3.2.3 on OS X)

close all
set (0, "defaultfigurevisible", "off")
for i=[0:100]
plot(x,x*i, "visible", "off");
filename=sprintf("%02d.png",i);
print('-dpng',filename);
end
set (0, "defaultfigurevisible", "on")

hth
c.
> --
> Cheers,
> Karol Krizka
> http://www.krizka.net

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: Silent plot(x,y) (3.2 or later bug?)

by Ben Abbott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Oct 16, 2009, at 6:14 AM, Tatsuro MATSUOKA wrote:

> Hello
>
> I have looked at  codes of gnuplot_drawnow.m and print.m.
> Initialization of __pixels_per_inch__ is executed in print.m
>
> I think that this is a bug.
>
> Tentatively, this bug(?) can be avoided by dummy print once for  
> octave 3.2 or later.
>
> plot (1:10);print ('dummy.png','-dpng');clf;
> x=[0:1];
> for i=[0:100]
> plot(x,x*i);
> filename=sprintf("%02d.png",i);
> drawnow('png',filename);
> end
> close;unlink('dummy.png');
>
>
> Side effect: An empty plow window is open during print :-(, but it  
> is no relation for speed
> please forgive the bug will be fixed.
>
> Tatsuro
>
> Regards
>
> Tatsuro

Yes, it is a bug.

To be consistent with Matlab the default output size is specified in  
inches. When the output is a bitmap, __pixels_per_inch__ is used to do  
the units conversion.

A fix is to edit gnuplot_drawnow.m and replace ...

>    ## Convert to inches using the property set by print().
>    gnuplot_size = gnuplot_size * get (h, "__pixels_per_inch__");

with ...

>    ## Convert to inches using the property set by print().
>    try
>      gnuplot_size = gnuplot_size * get (h, "__pixels_per_inch__");
>    catch
>      gnuplot_size = gnuplot_size * get (0, "screenpixelsperinch");
>    end_try_catch


This would produce an output in the same size as seen on the screen.

Comments?

Ben

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: Silent plot(x,y) (3.2 or later bug?)

by Ben Abbott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Oct 16, 2009, at 7:10 AM, Ben Abbott wrote:

> On Oct 16, 2009, at 6:14 AM, Tatsuro MATSUOKA wrote:
>
>> Hello
>>
>> I have looked at  codes of gnuplot_drawnow.m and print.m.
>> Initialization of __pixels_per_inch__ is executed in print.m
>>
>> I think that this is a bug.
>>
>> Tentatively, this bug(?) can be avoided by dummy print once for
>> octave 3.2 or later.
>>
>> plot (1:10);print ('dummy.png','-dpng');clf;
>> x=[0:1];
>> for i=[0:100]
>> plot(x,x*i);
>> filename=sprintf("%02d.png",i);
>> drawnow('png',filename);
>> end
>> close;unlink('dummy.png');
>>
>>
>> Side effect: An empty plow window is open during print :-(, but it
>> is no relation for speed
>> please forgive the bug will be fixed.
>>
>> Tatsuro
>>
>> Regards
>>
>> Tatsuro
>
> Yes, it is a bug.
>
> To be consistent with Matlab the default output size is specified in
> inches. When the output is a bitmap, __pixels_per_inch__ is used to do
> the units conversion.
>
> A fix is to edit gnuplot_drawnow.m and replace ...
>
>>    ## Convert to inches using the property set by print().
>>    gnuplot_size = gnuplot_size * get (h, "__pixels_per_inch__");
>
> with ...
>
>>    ## Convert to inches using the property set by print().
>>    try
>>      gnuplot_size = gnuplot_size * get (h, "__pixels_per_inch__");
>>    catch
>>      gnuplot_size = gnuplot_size * get (0, "screenpixelsperinch");
>>    end_try_catch
>
> This would produce an output in the same size as seen on the screen.

Correction, this will not produce an output in the expected size. I'm  
happy to help push a changeset, but don't have time to look at his in  
the necessary detail to produce a proper one myself.

Ben

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: Silent plot(x,y)

by Thomas Weber-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Karol,

On Thu, Oct 15, 2009 at 03:33:53PM -0700, Karol Krizka wrote:

> Hi there,
>
> I'm wondering if it is possible to plot a graph without displaying
> anything to the file. Basically, I'm trying to do an animated graph by
> plotting them step by step (suggested here:
> http://www.nabble.com/Displaying-an-animation---%22movie%22-td4199665.html
> ...
> The problem is that plot command displays the graph to the screen, and
> I think that it might be slowing (I show more than than 1000 frames..)
> down my script. Is there a way to suppress/silent the plot() command?
>
> I'm using octave 3.0.5 from the Ubuntu Karmic repositories.
>
> After some googling, I found the following suggestion:
> gset term postscript eps color
> gset output "name.eps"

The gset() commands are obsolete.

> Any suggestions? Am I missing some package?

http://wiki.octave.org/wiki.pl?CategoryFAQ
"How do I create a plot without a window popping up (ie, a plot to a file)?"

        Thomas
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: Silent plot(x,y) (3.2 or later bug?)

by Tatsuro MATSUOKA-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Karol

Considering that the calling form  'drawnow (TERM, FILE, MONO, DEBUG_FILE)' is debugging as is written
in help and manual of drawnow() function, the way shown by

Carlo de Falco
#***********
close all
set (0, "defaultfigurevisible", "off")
x=[0:1];
for i=[0:10]
plot(x,x*i, "visible", "off");
filename=sprintf("a%02d.png",i);
print('-dpng',filename);
end
set (0, "defaultfigurevisible", "on")

and

Thomas Weeber
#************
http://wiki.octave.org/wiki.pl?CategoryFAQ
"How do I create a plot without a window popping up (ie, a plot to a file)?"

is recommended.

BTW, drawnow(term, filname ) does not work correct for terminals whose units are pixels is a bug. This
should be discussed another thread that I have post.

http://www.nabble.com/bug--of-gnuplot_drawnow.m-(unknown-property-%22__pixels_per_inch__%22)-td25923903.html

Without your question, this bug might be overlooked for a while.

Thanks!!

Regards

Tatsuro


--------------------------------------
GyaO! - Anime, Dramas, Movies, and Music videos [FREE]
http://pr.mail.yahoo.co.jp/gyao/
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: Silent plot(x,y) (3.2 or later bug?)

by Bugzilla from kkrizka@gmail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 10/16/09, Tatsuro MATSUOKA <tmacchant@...> wrote:

> Hi Karol
>
> Considering that the calling form  'drawnow (TERM, FILE, MONO, DEBUG_FILE)'
> is debugging as is written
> in help and manual of drawnow() function, the way shown by
>
> Carlo de Falco
> #***********
> close all
> set (0, "defaultfigurevisible", "off")
> x=[0:1];
> for i=[0:10]
> plot(x,x*i, "visible", "off");
> filename=sprintf("a%02d.png",i);
> print('-dpng',filename);
> end
> set (0, "defaultfigurevisible", "on")
>
> and
>
> Thomas Weeber
> #************
> http://wiki.octave.org/wiki.pl?CategoryFAQ
> "How do I create a plot without a window popping up (ie, a plot to a file)?"
>
> is recommended.
>
Ah thank you, I didn't know that site existed (I'm new to octave), I
only looked at the gnu.org octave FAQ. It seems like a very useful
resource.

> BTW, drawnow(term, filname ) does not work correct for terminals whose units
> are pixels is a bug. This
> should be discussed another thread that I have post.
>
> http://www.nabble.com/bug--of-gnuplot_drawnow.m-(unknown-property-%22__pixels_per_inch__%22)-td25923903.html
>
> Without your question, this bug might be overlooked for a while.
>
> Thanks!!
>
> Regards
>
> Tatsuro
>


--
Cheers,
Karol Krizka
http://www.krizka.net
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Silent plot(x,y)

by John W. Eaton-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 15-Oct-2009, Karol Krizka wrote:

| I'm wondering if it is possible to plot a graph without displaying
| anything to the file. Basically, I'm trying to do an animated graph by
| plotting them step by step (suggested here:
| http://www.nabble.com/Displaying-an-animation---%22movie%22-td4199665.html
| ) and saving each graph as a file.
|
| In summary, I have the following script:
| x=[0:1];
| for i=[0:1000]
|  plot(x,x*i);
|  filename=sprintf("%02d.png",i);
|  print(filename);
| end
|
| The problem is that plot command displays the graph to the screen, and
| I think that it might be slowing (I show more than than 1000 frames..)
| down my script. Is there a way to suppress/silent the plot() command?

Try using

   figure (1, 'visible', 'off')

before your other plotting commands.

jwe
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave