Navigation

Operators and Keywords

Function List:

C++ API

 g = g_ez (command, args,...) - Single-command plotting function 

 This function allows to do basic plots with a single function call, i.e.
 like octave's plot() commant.

 If no output argument is required, the plot is shown and all data created
 for this plot is deleted. Otherwise use, g_plot(g) to plot g.

 Commands:
 ---------
 "plot", , where the plotted data can be 2D points or images
        2D data can be specified by a two-column matrix of 2D points,
        optionnally followed by a cell array of label strings
     
 "plot", x, y, fmt,... : Reads arguments like in octave's plot (x,y,fmt,...)
            fmt can be an octave-like formatting, e.g. "-;My Key;", see
            _g_parse_oct_fmt(). 
            or "img", which may be followed by "range", "xrange", "yrange",
            "colormap" options. See _g_image_cmd().
 "geometry",[w,h]      : Set gnuplot window geometry
 "FILE.(eps|fig)"      : Plot to FILE.eps or FILE.fig file.
 "xrange", [min,max]   : Set horizontal range
 "yrange", [min,max]   : Set vertical range
 "xlabel", str         : Set x label
 "ylabel", str         : Set y label
 "title",  str         : Set title
 "cmd",    str         : Insert command str.
 "grid",               : Same as "cmd","set grid"
 "xgrid",
 "ygrid"               : Same as "cmd","set grid x"
 "xtics", arg          : If arg is a non-empty string, then this adds the 
                         command ["set xtics " arg]. If arg is empty, same as
                         "unset xtics". 
 "ytics", arg          : Same as "cmd","set ytics " arg
 "color",   yesno
 "display", yesno

 TODO: "hist", "mesh" etc ...

Demonstration 1

The following code

 printf ("\n\tNote: You may need to resize the window to see the plots\n\n");
 %-------------------------------------------------
 im = rand(16,31); 
 im(3:10,5:25) = linspace(0,0.5,8)'*ones(1,21)+ones(8,1)*linspace(0,0.5,21);
 g_ez ("title","A random grey image","plot",im, "img")
 %-------------------------------------------------
 % a random greylevel image

Produces the following output

Note: You may need to resize the window to see the plots

warning: struct_contains is obsolete and will be removed from a future version of Octave; please use isfield instead
ans = deleting

Demonstration 2

The following code

 t=linspace(-pi,pi,101); x = sin(t); y = sin (t+pi/3);
 g_ez ("title","Some sines","plot",t,x,"-",t,y,"-")
 %-------------------------------------------------
 % some sines

Produces the following output

warning: create_set is obsolete and will be removed from a future version of Octave, please use unique instead
ans = deleting

Demonstration 3

The following code

 im = rand(16,31,3); 
 im(3:10,5:25,1) = linspace(0,1,8)'*ones(1,21); 
 im(3:10,5:25,2) = 0.5; 
 im(3:10,5:25,3) = 1;
 g_ez ("xrange",[-1,1],"plot",im*255, "img")
 %-------------------------------------------------
 % a random color image

Produces the following output

ans = deleting