help-octave
[Top][All Lists]
Advanced

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

Re: Octave plot on Windows


From: George Barrick
Subject: Re: Octave plot on Windows
Date: Tue, 2 Feb 2010 14:13:53 -0500

Re: Octave plot on Windows

                          2010.02.02.19:09: UT

Hey GNU-Octave folks,

      I saw the discussion about using the
wgnuplot back-end under Windows.  I have only
the default gnuplot back-end under the 
Cygwin 1.7.1 linux emulator for Win32 systems,
and so the wgnuplot option didn't really attract
my attention.

      Further down in that thread, Ben Lindner was
remarking about the need for a function in octave
that disables the gnuplot positioning of axes.
Actually, that kind of thing is now quite easy to
accomplish using the 'graphics handle' capabilities
that have come in with octave >= 3.0.  I realize
that all octave graphics are still supported by
gnuplot calls, but the 'graphics handle' paradigm
that is now available is (for me) extremely useful.

     Attached at the bottom of this post is an
example of octave code that I use to control the
size of my figure window, positioning of the axes
box, axis limits, etc.  With the current octave-3.2.4
I always see a figure window with 4:3 proportions,
but I _can_ control the proportions of the final
file output using the 'print' command formulation
that appears at the end of my file.  I believe
that this kind of thing works also for .eps and
.pdf output files.

     Hopefully, some folks will find this useful.

George                   address@hidden


<file : plot_pointers.m >
%%  Plotting Window width and height.

winWdt     =  560 ;
winHgt     =  592 ;

win    = [ winWdt winHgt winWdt winHgt ] ;

%%  Parameters for placement of axes.

plotWdt     =   480     ;
plotHgt     =   480     ;
plotXst     =    64     ;
plotYst     =    64     ;

plotPos     =  [ plotXst plotYst plotWdt plotHgt ] ./ win ;

%%  Set limits for the axes.

xlims    =      [   0 ,  400 ]  ;
ylims    =      [   0 ,  400 ]  ;

%%  I have carried over the use of graphics handles
%%   from my earlier experience with Matlab.

hdle = figure()                 ;

%% Spawn axes first, then re-configure them.
kdle = axes() ;
set( kdle,'Position',plotPos )                  ;
set( kdle,'XLim',xlims,'YLim',ylims )           ;
set( kdle,'NextPlot','add' )    ;

%% If I want to draw my axes completely different from
%%  the default ones, I just make the axes box invisible
%%  and use other graphing elements to paste stuff in.
%% set( kdle,'NextPlot','add','Visible','off' ) ;

slope = 0.9915                  ;
ntcpt = 0.7300                  ;

tvals = [   0 :  20 : 400 ]     ;
xuns  = ones( size( tvals ) )   ;
yvals = ( slope * tvals ) + ( ntcpt * xuns )    ;

%% Quantile plot from which this example was taken.
%%   The data does not appear in this example, and so
%%   I have commented out the plot.
%% ddle  = plot( escor, pgY, "ko" )        ;

fdle  = plot( tvals, yvals, "k-" )     ;
tdle  = title("Exponential quantile plot for check out data") ;

set(tdle,'FontSize',20) ;

%%  The default plot always seems to be a 4:3
%%   window.  Standard printing size is -r150.

%% The following scales the the output file by
%%  approximately 0.5
%%
%% print -r80 -djpg exptl_quantile.jpg ;

%% Here is how to set the exact proportions for your
%%  output file.
print(hdle,"exptl_quantile.jpg","-djpg","-S560,592");

</file: plot_pointers.m >




reply via email to

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