how to redirect the plot to a file

Ben Abbott bpabbott at mac.com
Fri Oct 17 04:20:11 CDT 2008


On Oct 17, 2008, at 4:29 AM, yongjunzheng wrote:

> In Octave 3.0.3, using "plot(x,y)" command will render the plot of a  
> X11 window (figure window), then using "print -deps fig.eps" command  
> will print the plot to the file.
>
> But in batch mode, I do not want to plot in the X11 window, I just  
> want to plot to a file directly, how can I get this?
>
> Thank you very much.

If you use a script, the plot will  not be produced until it ends or a  
drawnow is executed. So if you make the figure invisible, before the  
script ends or your print if, nothing will be displayed.

figure (1);
set (gcf, "visible", "off")
sombrero;
print (gcf, "-dpdf", "my_hat.pdf")
close (gcf)

Ben





More information about the Help-octave mailing list