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.
8classdef
Tile < pm.vis.Tiling
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 properties(Access =
public)
14 %> \param template : The scalar
object of superclass [pm.vis.Subplot](@ref
Subplot)
15 %> representing the
template of the set of subplots to display.
19 %> \param tileshape : The MATLAB vector ``[nrow, ncol]`` representing
20 %> the number of rows and columns in the tiled layout of subplots.
21 %> The
default is the closest values of ``nrow`` and ``ncol`` whose
22 %> multiplication yields the maximum number of data columns in the
27 %> \param tileindex : The MATLAB vector of size ``0`` or ``prod(tileshape)`` containing
28 %> the
list of indices of the tiling to fill with subplots, starting
33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35 methods(Access =
public)
37 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41 %> This
class is not meant to be used directly by the end users.
42 %> Instead, use the subclasses of
this abstract
class for visualizations.
44 %> \param[in] template : The input scalar
object of superclass [pm.vis.Subplot](@ref
Subplot).
45 %> It serves as the
template based upon
which all subplots are constructed.
47 %> \param[in] varargin : Any ``property, value`` pair of the parent
object.<br>
48 %> If the property is a ``
struct()``, then its value must be given as a cell array,
49 %> with consecutive elements representing the
struct ``property-
name, property-value`` pairs.
50 %> Note that all of these
property-value pairs can be also directly set via the
51 %> parent
object attributes, before calling the ``make()`` method.
54 %> The input ``varargin`` can also contain the components
55 %> of the ``
template`` component of the parent
object.
58 %> ``self`` : The output scalar
object of
class [pm.vis.Tile](@ref
Tile).
63 %> tile = pm.vis.
Tile(
template);
64 %> tile = pm.vis.Tile(
template, varargin);
69 %> See the
list of
class attributes below,
70 %> also those of the superclass [pm.vis.Tiling](@ref
Tiling).
75 %> \JoshuaOsborne, May 22 2024, 7:39 PM, University of Texas at Arlington<br>
76 function self =
Tile(
template, varargin)
77 [varobj, vartemp] = pm.matlab.hashmap.popKeyVal([
"figure",
"subplot",
"template",
"tiledlayout",
"tileshape"], varargin);
78 self = self@pm.vis.Tiling(cell(0, 0), varobj{:});
85 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
88 %> Reset the properties of the tile to the original default settings.
89 %> Use this method when you change many attributes of the tile and
90 %> you want to
clean up and go back to the default settings.
92 %> \param[in] varargin : Any ``property, value`` pair of the parent
object.<br>
93 %> If the property is a ``struct()``, then its value must be given as a cell array,
94 %> with consecutive elements representing the struct ``property-
name, property-value`` pairs.
95 %> Note that all of these property-value pairs can be also directly set via the
96 %> parent
object attributes, before calling the ``make()`` method.
99 %> The input ``varargin`` can also contain the components
100 %> of the ``subplot`` component of the parent
object.
105 %> tile = pm.vis.Tile(
template, varargin);
106 %> tile.reset(varargin)
107 %> tile.reset() % reset the tile to the
default settings.
114 %> \JoshuaOsborne, May 22 2024, 7:42 PM, University of Texas at Arlington<br>
115 %> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
116 %> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute
for Computational Engineering and Sciences (ICES), UT Austin<br>
117 function reset(self, varargin)
120 [vartemp, varleft] = pm.matlab.hashmap.popKeyVal(
"template", varargin);
122 self.hash2comp(vartemp);
123 %self.template.reset();
125 reset@pm.vis.Tiling(self, varleft{:});
127 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
128 %%%% RULE 0: Any non-MATLAB-
default setting must be preferably set in premake() method to override user null values.
129 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
133 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
136 %> Configure the tile settings and specifications,
137 %> make the tile, and return nothing.
140 %> In making the figure, this method we call the ``make()``
141 %> methods of each of the subplot objects stored in the
142 %> ``subplot`` component.
145 %> This method has side-effects by manipulating
146 %> the existing attributes of the parent
object.
148 %> \param[in] varargin : Any ``property, value`` pair of the parent
object.<br>
149 %> If the property is a ``struct()``, then its value must be given as a cell array,
150 %> with consecutive elements representing the struct ``property-
name, property-value`` pairs.
151 %> Note that all of these property-value pairs can be also directly set via the
152 %> parent
object attributes, before calling the ``make()`` method.
155 %> The input ``varargin`` can also contain the components
156 %> of the ``subplot`` component of the parent
object.
161 %> tile = pm.vis.Tile(
template, varargin);
162 %> tile.make(varargin);
169 %> t = pm.vis.Tile(pm.vis.SubplotLine());
175 %> \JoshuaOsborne, May 22 2024, 7:44 PM, University of Texas at Arlington<br>
176 %> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
177 %> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute
for Computational Engineering and Sciences (ICES), UT Austin<br>
178 function make(self, varargin)
180 self.premake(varargin{:});
182 %%%% First set the tile dimensions.
184 isEllipsoid = isa(self.template,
"pm.vis.SubplotEllipse") || isa(self.template,
"pm.vis.SubplotEllipse3");
188 nplt = max(1, self.template.dimx, self.template.dimy);
193 if isprop(self.template,
"colx")
194 lencolx = pm.array.
len(self.template.colx);
198 if isprop(self.template, "coly")
199 lencoly = pm.array.
len(self.template.coly);
203 if isprop(self.template, "colz")
204 lencolz = pm.array.
len(self.template.colz);
208 if isprop(self.template, "colc")
209 lencolc = pm.array.
len(self.template.colc);
212 nplt = max([lencolx, lencoly, lencolz, lencolc]);
216 %%%% Define the tile shape.
218 %self.tileshape = pm.matlab.hashmap.
getKeyVal("tileshape", varargin);
219 if ~isempty(self.tileshape)
220 nrow = self.tileshape(1);
221 ncol = self.tileshape(2);
222 if prod(self.tileshape) < nplt
224 disp("self.tileshape");
225 disp( self.tileshape );
229 + "The specified tile shape must be consistent" + newline ...
230 + "with the specified data columns to visualize." + newline ...
235 rows = nplt : -1 : 1;
236 cols = ceil(nplt ./ rows);
237 circ = rows + cols + (rows .* cols) - nplt;
238 [~, irow] = min(circ);
243 %if isempty(self.tileindex)
244 % tileindices = 1 : nplt;
247 %%%% unified colorbar using tiledlayout is only possible in MARLAB R2020b and beyond.
249 unicbar = ~isEllipsoid ...
251 && isprop(self.template, "colorbar") ...
252 && isempty(self.template.colorbar.enabled) ...
255 %%%% Define the subplot cell matrix.
256 %%%% The following code block may be improved in
257 %%%% the future to avoid full data
copy to subplots.
261 self.subplot = cell(nrow, ncol);
264 %tilecounter = tilecounter + 1;
265 %if tilecounter == tileindices(iplt + 1)
270 %self.subplot{irow, icol} = self.template;
271 copyStream = getByteStreamFromArray(self.template);
272 self.subplot{irow, icol} = getArrayFromByteStream(copyStream);
274 if ~isempty(self.template.subplot.dimx)
275 self.subplot{irow, icol}.dimx = self.template.dimx(min(iplt, numel(self.template.dimx)));
277 if ~isempty(self.template.subplot.dimy)
278 self.subplot{irow, icol}.dimy = self.template.dimy(min(iplt, numel(self.template.dimy)));
282 self.subplot{irow, icol}.colx = self.template.colx(iplt);
285 self.subplot{irow, icol}.coly = self.template.coly(iplt);
288 self.subplot{irow, icol}.colz = self.template.colz(iplt);
291 self.subplot{irow, icol}.colc = self.template.colc(iplt);
293 self.subplot{irow, icol}.colorbar.enabled =
false;
294 elseif lencolc == 0 && isprop(self.template,
"colormap") && isempty(self.template.colormap.enabled)
295 self.subplot{irow, icol}.colormap.enabled =
true;
304 make@pm.vis.Tiling(self);
306 %%%% Define a single colorbar.
308 if unicbar && isprop(self.template,
"colormap") && ~isempty(self.template.colormap.enabled)
309 unicbar = self.template.colormap.enabled;
312 if unicbar && isprop(self.template, "colorbar") && ~isempty(self.template.colorbar.enabled)
313 unicbar = self.template.colorbar.enabled;
318 %%%% Get the start and end positions of the leftmost, lowest, rightmost, and highest axes.
321 % positions = zeros(4, nplt);
322 % for icol = 1 : ncol
323 % for irow = 1 : nrow
324 % if pm.introspection.
istype(self.subplot{irow, icol},
"pm.vis.Subplot")
326 % positions(:, iplt) = self.subplot{irow, icol}.fout.axes.Position;
332 % start(i) = min(positions(i, :));
333 % finit(i) = max(positions(i, :) + positions(i + 2, :));
336 %%%% Create
new invisible axes.
339 for prop = [
"colorbar" ...
341 if isprop(self.template, prop)
342 kws.(prop) = self.template.comp2hash(prop);
346 %ax = axes(
"position", [start, finit],
"visible",
"off");
348 self.fout.colorbar = colorbar(kws.colorbar{:});
349 self.fout.colorbar.Layout.Tile =
'east';
350 dfcopy = self.template.df.copy();
351 [~, colnamc] = pm.str.locname(dfcopy.Properties.VariableNames, self.template.colc);
352 ylabel(self.fout.colorbar, colnamc(1));
358 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
362 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
364 methods(Access =
public, Hidden)
366 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
369 %> Configure the tile settings and specifications and
return nothing.
372 %> This method has side-effects by manipulating
373 %> the existing attributes of the parent
object.
375 %> \param[in] varargin : Any ``property, value`` pair of the parent
object.<br>
376 %> If the
property is a ``
struct()``, then its value must be given as a cell array,
377 %> with consecutive elements representing the
struct ``property-
name, property-value`` pairs.
378 %> Note that all of these property-value pairs can be also directly set via the
379 %> parent
object attributes, before calling the ``premake()`` method.
381 %> \interface{premake}
384 %> tile = pm.vis.Tile(
template, varargin);
385 %> tile.premake(varargin);
392 %> f = pm.vis.Tile(pm.vis.Line());
393 %> f.premake(
"figure", {
"color",
"none"})
398 %> \JoshuaOsborne, May 22 2024, 7:46 PM, University of Texas at Arlington<br>
399 %> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
400 %> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute
for Computational Engineering and Sciences (ICES), UT Austin<br>
401 function premake(self, varargin)
403 if ~isempty(varargin)
404 [varobj, vartemp] = pm.matlab.hashmap.popKeyVal([
"figure",
"subplot",
"template",
"tiledlayout",
"tileshape"], varargin);
405 premake@pm.vis.Tiling(self, varobj{:});
406 self.template.hash2comp(vartemp);
410 %self.template = pm.matlab.hashmap.hash2comp(vartemp, self.template, insensitive, extensible, recursive);
413 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
414 %%%% These settings must happen here so that they can be reset every time user nullifies the values.
415 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
419 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
423 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function name(in vendor)
Return the MPI library name as used in naming the ParaMonte MATLAB shared libraries.
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 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)
function reset(in self, in varargin)
Reset the properties of the tile to the original default settings. Use this method when you change ma...
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.
function clean()
Remove all paths that contain the ParaMonte lib directory from the MATLAB path variable.
function copy(in from, in to, in fields)
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...