<< CL_plot_ephem Utilities CL_plot_swath >>

celestlab >> Utilities > CL_plot_rects

CL_plot_rects

Plots filled rectangles

Calling Sequence

CL_plot_rects(rects, icolors [[, clip_area, rectype]])

Description

Parameters

rects:

Rectangles (4xN)

icolors:

Color indices (1xN)

clip_area:

(optional) Clip region: [xmin; xmax; ymin; ymax]. Default is [-%inf; %inf; -%inf; %inf] (4x1)

rectype:

(string, optional) Type of rectangle description: "r" or "xy". Default is "r" (1x1)

Authors

See also

Examples

// Example 1
rects = [[0; 1; 1; 2], [1; 2; 1; 2], [2; 3; 1; 2], [1; 2; 2; 3], [2; 6; 2; 3]];
icolors = [2, 2, 3, 5, 5];

scf();
clip_area = [0; 5; 0; 4];
CL_plot_rects(rects, icolors, clip_area=clip_area, rectype="xy");

// Example 2
n = 100;
vals = linspace(-1, 1, n+1);
step = (vals($) - vals(1)) / n;
x = (vals(1:$-1) + vals(2:$))/2;
y = x;
[X, Y] = ndgrid(x, y);
Z = abs(X .* Y);

f = scf();
nbcols = 64;
f.color_map = jetcolormap(nbcols);
N = size(Z, "*");
rects = [X(:)' - step/2; Y(:)' + step/2; step * ones(1:N);  step * ones(1:N)];
icolors = 1 + round(Z(:)' * (nbcols - 1));
CL_plot_rects(rects, icolors);

Report an issue
<< CL_plot_ephem Utilities CL_plot_swath >>