Next: , Previous: , Up: Directory Index   [Contents][Index]


2.18 plotting

Function File: S = contourc2struct ( C )

Converts contour matrix C returned by contour functions into a easier-to-use array struct S

Examples

[X, Y] = ndgrid(-10:10, -10:10);
Z = X.^2 + Y.^2;
C = contourc(Z);
contourc2struct(C);
Function File: ezmovie ( start, opt, val, … ) ;
Function File: ezmovie ( add ) ;
Function File: ezmovie ( stop ) ;

Generate a H.264/MPEG-4 AVC movie from a sequence of figures. Requires the command ffmpeg or avconv to be available.

Options to ezmovie(start)

filebasename

basename of movie file; extension will be ".mp4"

delay

delay between each figure, in seconds

width

width of movie, in pixels

height

height of movie, in pixels

fontsize

font size of printed figure, in points (default: 10)

linescale

factor to scale line width of figure objects (default: 1)

verbose

if true, print verbose output from ffmpeg or avconv

Example

ezmovie("start", "opt", val, ...);
plot(...);
ezmovie add;
plot(...);
ezmovie add;
Function File: ezprint ( filepath, opt, val, … )

Print a figure to a file, with some common options.

Options

width

width of printed figure, in points

aspect

aspect ratio of height to width (default: 0.75)

height

height of printed figure, in points (overrides "aspect")

dpi

resolution of printed figure, in dots per inch (default: 300)

fontsize

font size of printed figure, in points (default: 10)

linescale

factor to scale line width of figure objects (default: 1)

texregex

regular expression to apply to TeX output files

Examples

graphics_toolkit gnuplot;
figname = strcat(tempname(tempdir), ".tex");
fig = figure("visible", "off");
plot(0:100, mod(0:100, 10));
ezprint(figname, "width", 100);
close(fig);
assert(exist(figname, "file"));
Function File: map = greyScaleReady ( name, [ n = 64 ] )

Generate colour maps where the "luma" (brightness) decreases linearly as a function of colour map index; these maps should therefore be printable in grey-scale. Light-to-dark colour maps range from white to the first colour of "name", via the second colour of "name"; dark-to-light colour maps reverse this order.

Arguments

map

colour map

name

one of:

light-to-dark colour maps

blue-cyan, blue-magenta, green-cyan, green-yellow, red-magenta, red-yellow

dark-to-light colour maps

cyan-blue, cyan-green, magenta-blue, magenta-red, yellow-green, yellow-red

n

number of colour map entries

Function File: map = makeColourMap ( r, g, b, [ n = 64 ] )

Generate a colour map by interpolating colour intensities.

Arguments

map

colour map

r
g
b

m-by-2 arrays of interpolation coefficients

[x1, c1; x2, c2; ...]

where x indexes the colour map, 0<=x<=1 c is the red/gree/blue colour at x

n

number of colour map entries

Examples

makeColourMap([0 1;0.114 1;0.701 1;1 0.35], [0 1;0.114 1;0.701 0.35;1 0.35], [0 1;0.114 0.35;0.701 0.35;1 0.35]);
Function File: PlotAndLabelContour ( C, ctropt, ctropt, … )
Function File: PlotAndLabelContour ( S, ctropt, ctropt, … )
Function File: S = PlotAndLabelContour ( … )

Plot contours, possibly with labels

Arguments

C

contour array returned by contourc, etc.

S

S = contourc2struct(C)

ctropt

{lev, prop, options…}, where:

lev

contour level(s)

prop

contour line properties

options
lbl

label this contour (true/false)

lblpos

relative position of label along contour

lbldim

size of area to clear for contour label

lblminlen

don’t label contours shorter than this

Examples

fig = figure("visible", "off");
[X, Y] = ndgrid(-10:10, -10:10);
Z = X.^2 - Y.^2;
lbllev = 10:10:90;
C = contourc(Z, lbllev);
PlotAndLabelContours(C, {"lev", lbllev, "levprop", {"color", "black"}, "lbl", true, "lbldim", [0.1, 0.1], "lblfmt", "%0.0f"});
close(fig);
Function File: lum = plotColourMap ( map, [ name ] )

Visualise a colour map.

Arguments

map

colour map

name

optional colour map name

lum

luma of colour map

Examples

plotColourMap(colormap());
Function File: PlotGrid ( rowrange, colrange, rowspace, colspace, rowfigs, colfigs )
Function File: hax = PlotGrid ( rowidx, colidx )
Function File: PlotGrid ( range, space, figs )
Function File: hax = PlotGrid ( idx )

A more flexible replacement for subplot().

Arguments

[row|col]range

range of figure coordinates in [0,1] to be covered by grid [in this dimension]

[row|col]space

spacing between figures [in this dimension]

[row|col]figs

number of figures [in this dimension]

[row|col]idx

figure index [in this dimension]

Examples

fig = figure("visible", "off");
N = 5;
M = 3;
PlotGrid([0.1,0.9], [0.1,0.8], 0.05, 0.03, N, M);
for i = 1:N
  for j = 1:M
    PlotGrid(i, j);
    text(0.5,0.5,sprintf("%g,%g",i,j));
  endfor
endfor
close(fig);
Function File: SetTickMarks ( dim, nticks )

Try to generate a given number of ticks on a given axis.

Arguments

dim

one of x, y, z

nticks

number of ticks to try to generate

Examples

fig = figure("visible", "off");
plot(0:100, mod(0:100, 10));
SetTickMarks("x", 4);
SetTickMarks("y", 4);
close(fig);

Next: , Previous: , Up: Directory Index   [Contents][Index]