help-octave
[Top][All Lists]
Advanced

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

Re: printing to file without plot window


From: Ben Abbott
Subject: Re: printing to file without plot window
Date: Tue, 28 Jan 2014 13:58:33 -0500

On Jan 28, 2014, at 1:42 PM, Vincent Gizzo <address@hidden> wrote:

> Hello,
>  
> I created a function that will plot several contour plots and save the images 
> to seperate files. I'm trying to speed this up by just printing the image to 
> the file without the plot windows popping up.
>  
> I found several referencse to accomplishing this by using figure(1,"visible", 
> "off") before printing the image.
>  
> http://wiki.octave.org/FAQ#How_do_I_create_a_plot_without_a_window_popping_up_.28ie.2C_a_plot_to_a_file.29.3F
>  
> However, when I do this the scripts finishes and no files are created. A file 
> with the image is only created when "visable" is set "on". What am I doing 
> wrong?
>  
> I tried this on both Octave 3.8 (linux) and Octave 3.6.4 (windows w/ cygwin)
>  
> Here is an example of my code. :
>  
>  figure(1,"visible","off")
>  #linear interpolation
>   for i=1:size(preSurface,2)
>    #Pre SurfaceContour
>    #create string from interger, i to create filenames
>    snum=int2str(i);    
>    Z=griddata(x,y,preSurface(:,i),X,Y,'linear');
>    h=surf(X,Y,Z,'EdgeColor','none');
>      
>    #formatting for plot
>    view (2);
>    colorbar("EastOutside",'fontsize',12,"fontweight","bold");
>    axis equal;
>    grid off;
>    # concatenate slot number and name for text file name
>    slot=[snum,"_preSurface"];
>    print ("h",slot,"-dpng");
>    limit=caxis();

My guess is that you are using the FLTK toolkit which requires that the figure 
be rendered on screen in order to capture the OpenGL stuff and convert to the 
graphic format (png in your case).  If you want to avoid displaying, you can 
try the gnuplot toolkit.

Do do that ...

        close all
        graphics_toolkit gnuplot

... and run your script again.

Ben
 



reply via email to

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