2%> This is the abstract
class for generating instances of objects
3%> that contain the specifications of various types of tile figures.<br>
6%> This is a
generic class for generating figures
7%> containing multiple subplots (axes) of the same
class.<br>
10%> [pm.vis.Cascade](@ref
Cascade)<br>
11%> [pm.vis.Subplot](@ref
Subplot)<br>
12%> [pm.vis.Triplex](@ref
Triplex)<br>
13%> [pm.vis.Figure](@ref
Figure)<br>
14%> [pm.vis.Plot](@ref
Plot)<br>
15%> [pm.vis.Tile](@ref
Tile)<br>
20%> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
21%> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute
for Computational Engineering and Sciences (ICES), UT Austin<br>
22classdef
Tile < pm.vis.Tiling
24 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
26 properties(Access =
public)
30 %> The scalar
object of superclass [pm.vis.Subplot](@ref
Subplot)
31 %> representing the
template of the set of subplots to display.<br>
37 %> The MATLAB vector ``[nrow, ncol]`` representing
38 %> the number of rows and columns in the tiled layout of subplots.<br>
39 %> The
default is the closest values of ``nrow`` and ``ncol`` whose
40 %> multiplication yields the maximum number of data columns in the
47 % The MATLAB vector of size ``0`` or ``prod(tileshape)`` containing
48 % the
list of indices of the tiling to fill with subplots, starting
53 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
55 methods(Access =
public)
57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
60 %> Generate and
return an
object of
class [pm.vis.Tile](@ref
Tile).<br>
63 %> This
class is not meant to be used directly by the end users.<br>
64 %> Instead, use the subclasses of
this abstract
class for visualizations.<br>
65 %> See the
list of
class attributes and those of the superclass [pm.vis.
Tiling](@ref
Tiling).<br>
67 %> \param[in] template : The input scalar
object of superclass [pm.vis.Subplot](@ref
Subplot).<br>
68 %> It serves as the
template based upon
which all subplots are constructed.<br>
70 %> \param[in] varargin : Any ``property, value`` pair of the parent
object.<br>
71 %> If the property is a ``
struct()``, then its value must be given as a cell array,
72 %> with consecutive elements representing the
struct ``property-
name, property-value`` pairs.<br>
73 %> Note that all of these
property-value pairs can be also directly set via the
74 %> parent
object attributes, before calling the ``make()`` method.<br>
77 %> ``self`` : The output scalar
object of
class [pm.vis.Tile](@ref
Tile).<br>
82 %> tile = pm.vis.
Tile(
template);
83 %> tile = pm.vis.Tile(
template, varargin);
88 %> The input ``varargin`` can also contain the components
89 %> of the ``
template`` component of the parent
object.<br>
94 %> \JoshuaOsborne, May 22 2024, 7:39 PM, University of Texas at Arlington<br>
95 function self =
Tile(
template, varargin)
96 [varobj, vartemp] = pm.matlab.hashmap.popKeyVal([
"figure",
"subplot",
"template",
"tiledlayout",
"tileshape"], varargin);
97 self = self@pm.vis.Tiling(cell(0, 0), varobj{:});
104 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
107 %> Reset the properties of the tile to the original default settings.<br>
110 %> Use this method when you change many attributes of the tile and
111 %> you want to
clean up and go back to the default settings.<br>
113 %> \param[in] self : The **implicitly-passed** input argument representing the parent
object of the method.<br>
114 %> \param[in] varargin : Any ``property, value`` pair of the parent
object.<br>
115 %> If the property is a ``struct()``, then its value must be given as a cell array,
116 %> with consecutive elements representing the struct ``property-
name, property-value`` pairs.<br>
117 %> Note that all of these property-value pairs can be also directly set via the
118 %> parent
object attributes, before calling the ``make()`` method.<br>
123 %> tile = pm.vis.Tile(
template, varargin);
124 %> tile.reset(varargin)
125 %> tile.reset() % reset the tile to the
default settings.
130 %> The input ``varargin`` can also contain the components
131 %> of the ``subplot`` component of the parent
object.<br>
136 %> \JoshuaOsborne, May 22 2024, 7:42 PM, University of Texas at Arlington<br>
137 %> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
138 %> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute
for Computational Engineering and Sciences (ICES), UT Austin<br>
139 function reset(self, varargin)
142 [vartemp, varleft] = pm.matlab.hashmap.popKeyVal(
"template", varargin);
144 self.hash2comp(vartemp);
145 %self.template.reset();
147 reset@pm.vis.Tiling(self, varleft{:});
149 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
150 %%%% RULE 0: Any non-MATLAB-
default setting must be preferably set in premake() method to override user null values.
151 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
158 %> Configure the tile settings and specifications, make the tile, and return nothing.<br>
161 %> In making the figure, this method we call the ``make()``
162 %> methods of each of the subplot objects stored in the
163 %> ``subplot`` component.<br>
165 %> \param[in] self : The **implicitly-passed** input argument representing the parent
object of the method.<br>
166 %> \param[in] varargin : Any ``property, value`` pair of the parent
object.<br>
167 %> If the property is a ``struct()``, then its value must be given as a cell array,
168 %> with consecutive elements representing the struct ``property-
name, property-value`` pairs.<br>
169 %> Note that all of these property-value pairs can be also directly set via the
170 %> parent
object attributes, before calling the ``make()`` method.<br>
175 %> tile = pm.vis.Tile(
template, varargin);
176 %> tile.make(varargin);
182 %> This method has side-effects by manipulating
183 %> the existing attributes of the parent
object.<br>
186 %> The input ``varargin`` can also contain the components
187 %> of the ``subplot`` component of the parent
object.<br>
191 %> t = pm.vis.Tile(pm.vis.SubplotLine());
197 %> \JoshuaOsborne, May 22 2024, 7:44 PM, University of Texas at Arlington<br>
198 %> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
199 %> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute
for Computational Engineering and Sciences (ICES), UT Austin<br>
200 function make(self, varargin)
202 self.premake(varargin{:});
204 %%%% First set the tile dimensions.
206 isEllipsoid = isa(self.template,
"pm.vis.SubplotEllipse") || isa(self.template,
"pm.vis.SubplotEllipse3");
210 nplt = max(1, self.template.dimx, self.template.dimy);
215 if isprop(self.template,
"colx")
216 lencolx = pm.array.
len(self.template.colx);
220 if isprop(self.template, "coly")
221 lencoly = pm.array.
len(self.template.coly);
225 if isprop(self.template, "colz")
226 lencolz = pm.array.
len(self.template.colz);
230 if isprop(self.template, "colc")
231 lencolc = pm.array.
len(self.template.colc);
234 nplt = max([lencolx, lencoly, lencolz, lencolc]);
238 %%%% Define the tile shape.
240 %self.tileshape = pm.matlab.hashmap.
getKeyVal("tileshape", varargin);
241 if ~isempty(self.tileshape)
242 nrow = self.tileshape(1);
243 ncol = self.tileshape(2);
244 if prod(self.tileshape) < nplt
246 disp("self.tileshape");
247 disp( self.tileshape );
251 + "The specified tile shape must be consistent" + newline ...
252 + "with the specified data columns to visualize." + newline ...
257 rows = nplt : -1 : 1;
258 cols = ceil(nplt ./ rows);
259 circ = rows + cols + (rows .* cols) - nplt;
260 [~, irow] = min(circ);
265 %if isempty(self.tileindex)
266 % tileindices = 1 : nplt;
269 %%%% unified colorbar using tiledlayout is only possible in MARLAB R2020b and beyond.
271 unicbar = ~isEllipsoid ...
273 && isprop(self.template, "colorbar") ...
274 && isempty(self.template.colorbar.enabled) ...
277 %%%% Define the subplot cell matrix.
278 %%%% The following code block may be improved in
279 %%%% the future to avoid full data
copy to subplots.
283 self.subplot = cell(nrow, ncol);
286 %tilecounter = tilecounter + 1;
287 %if tilecounter == tileindices(iplt + 1)
292 %self.subplot{irow, icol} = self.template;
293 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
294 %%%% The
byte stream approach leads to serious problems with
295 %%%% figures when generated from within sampler components.
296 %byteStream = getByteStreamFromArray(self.template);
297 %self.subplot{irow, icol} = getArrayFromByteStream(byteStream);
298 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
299 self.subplot{irow, icol} = pm.matlab.copy(self.template, eval(
string(
class(self.template)) +
"()"));
300 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
302 if ~isempty(self.template.subplot.dimx)
303 self.subplot{irow, icol}.dimx = self.template.dimx(min(iplt, numel(self.template.dimx)));
305 if ~isempty(self.template.subplot.dimy)
306 self.subplot{irow, icol}.dimy = self.template.dimy(min(iplt, numel(self.template.dimy)));
310 self.subplot{irow, icol}.colx = self.template.colx(iplt);
313 self.subplot{irow, icol}.coly = self.template.coly(iplt);
316 self.subplot{irow, icol}.colz = self.template.colz(iplt);
319 self.subplot{irow, icol}.colc = self.template.colc(iplt);
321 self.subplot{irow, icol}.colorbar.enabled =
false;
322 elseif lencolc == 0 && isprop(self.template,
"colormap") && isempty(self.template.colormap.enabled)
323 self.subplot{irow, icol}.colormap.enabled =
true;
332 make@pm.vis.Tiling(self);
334 %%%% Define a single colorbar.
336 if unicbar && isprop(self.template,
"colormap") && ~isempty(self.template.colormap.enabled)
337 unicbar = self.template.colormap.enabled;
340 if unicbar && isprop(self.template, "colorbar") && ~isempty(self.template.colorbar.enabled)
341 unicbar = self.template.colorbar.enabled;
346 %%%% Get the start and end positions of the leftmost, lowest, rightmost, and highest axes.
349 % positions = zeros(4, nplt);
350 % for icol = 1 : ncol
351 % for irow = 1 : nrow
352 % if pm.introspection.
istype(self.subplot{irow, icol},
"pm.vis.Subplot")
354 % positions(:, iplt) = self.subplot{irow, icol}.fout.axes.Position;
360 % start(i) = min(positions(i, :));
361 % finit(i) = max(positions(i, :) + positions(i + 2, :));
364 %%%% Create
new invisible axes.
367 for prop = [
"colorbar" ...
369 if isprop(self.template, prop)
370 kws.(prop) = self.template.comp2hash(prop);
374 %ax = axes(
"position", [start, finit],
"visible",
"off");
376 self.fout.colorbar = colorbar(kws.colorbar{:});
377 self.fout.colorbar.Layout.Tile =
'east';
378 dfcopy = self.template.dfref.copy();
379 [~, colnamc] = pm.str.locname(dfcopy.Properties.VariableNames, self.template.colc);
380 ylabel(self.fout.colorbar, colnamc(1));
386 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
390 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
392 methods(Access =
public, Hidden)
394 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
397 %> Configure the tile settings and specifications and
return nothing.<br>
399 %> \param[in] self : The **implicitly-passed** input argument representing the parent
object of the method.<br>
400 %> \param[in] varargin : Any ``property, value`` pair of the parent
object.<br>
401 %> If the
property is a ``
struct()``, then its value must be given as a cell array,
402 %> with consecutive elements representing the
struct ``property-
name, property-value`` pairs.<br>
403 %> Note that all of these property-value pairs can be also directly set via the
404 %> parent
object attributes, before calling the ``premake()`` method.<br>
406 %> \interface{premake}
409 %> tile = pm.vis.Tile(
template, varargin);
410 %> tile.premake(varargin);
416 %> This method has side-effects by manipulating
417 %> the existing attributes of the parent
object.<br>
421 %> f = pm.vis.Tile(pm.vis.Line());
422 %> f.premake(
"figure", {
"color",
"none"})
427 %> \JoshuaOsborne, May 22 2024, 7:46 PM, University of Texas at Arlington<br>
428 %> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
429 %> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute
for Computational Engineering and Sciences (ICES), UT Austin<br>
430 function premake(self, varargin)
432 if ~isempty(varargin)
433 [varobj, vartemp] = pm.matlab.hashmap.popKeyVal([
"figure",
"subplot",
"template",
"tiledlayout",
"tileshape"], varargin);
434 premake@pm.vis.Tiling(self, varobj{:});
435 self.template.hash2comp(vartemp);
439 %self.template = pm.matlab.hashmap.hash2comp(vartemp, self.template, insensitive, extensible, recursive);
442 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
443 %%%% These settings must happen here so that they can be reset every time user nullifies the values.
444 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
448 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
452 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function name(in vendor)
Return the MPI library name as used in naming the ParaMonte MATLAB shared library directories.
function list()
Return a list of MATLAB strings containing the names of OS platforms supported by the ParaMonte MATLA...
function version(in silent)
Return a scalar MATLAB string containing the latest available ParaMonte MATLAB version newer than the...
This is the abstract class for generating instances of objects that contain the specifications of a c...
This is the base class for generating instances of objects that contain the specifications of various...
This is the abstract class for generating instances of axes with various types of plots from one or m...
This is the abstract class for generating instances of objects that contain the specifications of var...
function make(in self, in varargin)
Configure the tile settings and specifications, make the tile, and return nothing.
function Tile(in template, in varargin)
Generate and return an object of class pm.vis.Tile.
function reset(in self, in varargin)
Reset the properties of the tile to the original default settings.
function premake(in self, in varargin)
Configure the tile settings and specifications and return nothing.
This is the base class for generating instances of figures containing a tile of subplots.
This is the base class for generating instances of figures containing a square symmetric tiling of su...
function clean()
Remove all paths that contain the ParaMonte lib directory from the MATLAB path variable.
function copy(in from, in to, in field, in exclude)
Copy the contents of the struct/object from to the struct/object to recursively and without destroyin...
function getBorder(in gramian, in center, in npnt)
Return a matrix of MATLAB doubles of shape [npnt, 2] containing the coordinates of a set of points on...
function getKeyVal(in key, in hashmap)
Return the value corresponding to the input key in the input hashmap cell array.
function hash2comp(in hashmap, in object, in insensitive, in extensible, in recursive)
Return a copy of the input object whose property (or field) values are overwritten with the correspon...
function istype(in varval, in vartype, in varsize)
Return true if and only if the input varval conforms with the specified input type vartype and the sp...
function len(in obj)
Return a scalar MATLAB whole-number containing the length of the input scalar or vector object.
function release(in type)
Return a scalar MATLAB string containing the MATLAB release version, year, or season as requested.
function which(in vendor)
Return the a MATLAB string containing the path to the first mpiexec executable binary found in system...