Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2025.0.0 - Français


Matplot1

2D plot of a matrix using colors

Syntax

Matplot1(a, rect)
h = Matplot1(...)

Arguments

a

a real matrix of size (n1,n2).

rect

[xmin, ymin, xmax, ymax].

h

This optional output contains a handle to a Matplot entity. For a list of properties, see Matplot_properties.

Description

The entries of matrix int(a) are used as colormap entries in the current colormap. rect specifies a rectangle in the current scale and the matrix is drawn inside this rectangle. Each matrix entry will be rendered as a small rectangle filled with its associated color. If a matrix entry is outside the colormap, the corresponding rectangle is not displayed.

Enter the command Matplot1() to see a demo.

Examples

clf();
ax = gca();//get current axes handle
ax.data_bounds = [0, 0; 10, 10]; //set the data_bounds
ax.box = 'on'; //draw a box
a = 5*ones(11,11);
a(2:10, 2:10) = 4;
a(5:7, 5:7) = 2;
// first matrix in rectangle [1,1,3,3]
Matplot1(a, [1,1,3,3])
a = ones(10,10);
a = 3*tril(a)+ 2*a;
// second matrix in rectangle [5,6,7,8]
Matplot1(a,[5,6,7,8])
//--- (animation)
n=100;

clf();
f = gcf();//get current figure handle
ax = gca();//get current axes handle
ax.data_bounds = [0, 0 ; 10, 10];//set the data_bounds
ax.box = 'on'; //draw a box
o = ones(n, n);
a = 3 * tril(o, -n) + 2*o;
a = a + a';
mp = Matplot1(a, [0, 2, 7, 9])
for k = (-n + 1):n,
  a = 3 * tril(o, k) + 2 * o;
  a = a + a';
  k1 = 3 * (k + 100) / 200;
  mp.data = a;
  mp.rect = [k1, 2, k1 + 7, 9];
  sleep(8); // Slow down the simulation
end

See also

History

VersionDescription
2025.0.0 Function returns the created handle(s).
Report an issue
<< Matplot 2d_plot Matplot properties >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Oct 24 11:15:59 CEST 2024