2%> This is the abstract
class for generating instances of objects
3%> that contain the specifications of a cascade of figures (plots).<br>
6%> This is a
generic class for generating multiple separate
7%> cascading figures each containing a single plot (axes).<br>
10%> While dynamic addition of
class attributes is not ideal, the current
11%> design was deemed unavoidable and best, given the constraints of the
12%> MATLAB language and visualization tools.<br>
15%> See the
list of
class attributes below,
16%> also those of the superclass [pm.matlab.Handle](@ref
Handle).<br>
19%> [pm.vis.Cascade](@ref
Cascade)<br>
20%> [pm.vis.Subplot](@ref
Subplot)<br>
21%> [pm.vis.Figure](@ref
Figure)<br>
22%> [pm.vis.Corner](@ref
Corner)<br>
23%> [pm.vis.Plot](@ref
Plot)<br>
24%> [pm.vis.Tile](@ref
Tile)<br>
29%> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
30%> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute
for Computational Engineering and Sciences (ICES), UT Austin<br>
33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35 properties(Access =
public)
39 %> The cell array of scalar objects of superclass [pm.vis.Plot](@ref
Plot)
40 %> representing the cascade of plots to display.<br>
46 %> The scalar
object of superclass [pm.vis.Plot](@ref
Plot)
47 %> representing the
template of the cascade of plots to display.<br>
52 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54 methods(Access =
public)
56 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
59 %> Construct and
return an
object of
class [pm.vis.Cascade](@ref
Cascade).<br>
62 %> This is the custom constructor of the
class [pm.vis.Cascade](@ref
Cascade).<br>
64 %> \param[in] template : The input scalar
object of superclass [pm.vis.Plot](@ref
Plot).<br>
65 %> It serves as the
template based upon
which the cascade of plots are constructed.<br>
66 %> \param[in] varargin : Any ``property, value`` pair of the parent
object.<br>
67 %> If the property is a ``
struct()``, then its value must be given as a cell array,
68 %> with consecutive elements representing the
struct ``property-
name, property-value`` pairs.<br>
69 %> Note that all of these
property-value pairs can be also directly set via the
70 %> parent
object attributes, before calling the [pm.vis.Cascade.make()](@ref
Cascade::make) method.<br>
73 %> ``self`` : The scalar output
object of
class [pm.vis.Cascade](@ref
Cascade).<br>
78 %> plot = pm.vis.
Cascade(
template);
79 %> plot = pm.vis.Cascade(
template, varargin);
84 %> The input ``varargin`` can also contain the components
85 %> of the ``plot`` component of the parent
object.<br>
88 %> \include{lineno} example/vis/
Cascade/main.m
97 %> \JoshuaOsborne, May 21 2024, 6:20 AM, University of Texas at Arlington<br>
98 %> \AmirShahmoradi, July 5 2024, 1:07 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
99 function self =
Cascade(
template, varargin)
101 self.reset(varargin{:});
104 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
107 %> Reset the properties of the cascade of plots to the original
default settings.<br>
110 %> Use
this method when you change many attributes of the plot and
111 %> you want to
clean up and go back to the
default settings.<br>
113 %> \param[inout] self : The input/output parent
object of
class [pm.vis.Cascade](@ref
Cascade)
114 %>
which is **implicitly** passed to
this dynamic method (not by the user).<br>
115 %> \param[in] varargin : Any ``property, value`` pair of the parent
object.<br>
116 %> If the
property is a ``
struct()``, then its value must be given as a cell array,
117 %> with consecutive elements representing the
struct ``property-
name, property-value`` pairs.<br>
118 %> Note that all of these property-value pairs can be also directly set via the
119 %> parent
object attributes, before calling the [pm.vis.Cascade.make()](@ref
Cascade::make) method.<br>
122 %> The input ``varargin`` can also contain the components
123 %> of the ``
template`` component of the parent
object.
128 %> pm.vis.Cascade.reset() % reset the plot to the
default settings.
129 %> pm.vis.Cascade.reset(varargin) % reset the plot to the
default settings and to those specified via ``varargin``.
136 %> \JoshuaOsborne, May 21 2024, 6:25 AM, 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)
141 if ~isempty(varargin)
142 [varpar, varsub] = pm.matlab.hashmap.popKeyVal([
"template",
"window"], varargin);
144 self.hash2comp(varpar);
147 self.template.reset(varsub{:});
151 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
152 %%%% RULE 0: Any non-MATLAB-
default setting must be preferably set in premake() method to override user null values.
153 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
157 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
160 %> Configure the cascade settings and specifications,
161 %> make the cascade of plots, and return nothing.<br>
164 %> In making the figure, this method calls the ``make()``
165 %> methods of each of the plot objects stored in the
166 %> ``window`` component.<br>
169 %> This method has side-effects by manipulating
170 %> the existing attributes of the parent
object.<br>
172 %> \param[inout] self : The input/output parent
object of class [pm.vis.
Cascade](@ref
Cascade)
173 %>
which is **implicitly** passed to this dynamic method (not by the user).<br>
174 %> \param[in] varargin : Any ``property, value`` pair of the parent
object.<br>
175 %> If the property is a ``struct()``, then its value must be given as a cell array,
176 %> with consecutive elements representing the struct ``property-
name, property-value`` pairs.<br>
177 %> Note that all of these property-value pairs can be also directly set via the parent
object attributes,
178 %> before calling the [pm.vis.
Cascade.make()](@ref
Cascade::make) method.<br>
183 %> p = pm.vis.Cascade.make(varargin);
188 %> The input ``varargin`` can also contain the components
189 %> of the ``
template`` component of the parent
object.<br>
192 %> \include{lineno} example/vis/
Cascade/main.m
201 %> \JoshuaOsborne, May 21 2024, 6:27 AM, University of Texas at Arlington<br>
202 %> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
203 %> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute
for Computational Engineering and Sciences (ICES), UT Austin<br>
204 function make(self, varargin)
206 self.premake(varargin{:});
208 %%%% First set the cascade dimensions.
210 isHeatmap = isa(self.template,
"pm.vis.PlotHeatmap");
211 isEllipsoid = isa(self.template,
"pm.vis.PlotEllipse") || isa(self.template,
"pm.vis.PlotEllipse3");
215 %%%% Set the data
for the Heatmap.
218 hdf.colx = self.template.subplot.colx;
219 hdf.rows = self.template.subplot.rows;
220 if ~iscell(self.template.subplot.colx) && ~isempty(self.template.subplot.colx)
221 hdf.colx = {hdf.colx};
223 if ~iscell(self.template.subplot.rows) && ~isempty(self.template.subplot.rows)
224 hdf.rows = {hdf.rows};
227 %%%% Test the data size consistency.
229 nplt = max(numel(hdf.colx), numel(hdf.rows));
230 if (nplt ~= size(self.template.subplot.rows, 1) && size(self.template.subplot.rows, 1) > 1) ...
231 || (nplt ~= size(self.template.subplot.colx, 1) && size(self.template.subplot.colx, 1) > 1)
232 help(
"pm.vis.CascadeHeatmap");
233 disp(
"size(self.template.subplot.rows)");
234 disp( size(self.template.subplot.rows) );
235 disp(
"size(self.template.subplot.colx)");
236 disp( size(self.template.subplot.colx) );
238 +
"The size of the ``rows`` and ``colx`` attributes of the ``subplot`` component" + newline ...
239 +
"of the input template ``Plot`` object must equal along the first dimension." + newline ...
240 +
"For more information, see the documentation displayed above." + newline ...
247 nplt = max([1, numel(self.template.subplot.dimx), numel(self.template.subplot.dimy)]);
252 if isprop(self.template.subplot,
"colx")
253 lencolx = pm.array.
len(self.template.subplot.colx);
257 if isprop(self.template.subplot, "coly")
258 lencoly = pm.array.
len(self.template.subplot.coly);
262 if isprop(self.template.subplot, "colz")
263 lencolz = pm.array.
len(self.template.subplot.colz);
267 if isprop(self.template.subplot, "colc")
268 lencolc = pm.array.
len(self.template.subplot.colc);
271 nplt = max([lencolx, lencoly, lencolz, lencolc]);
275 %%%% Define the cascade.
276 %%%% The following code block may be improved in
277 %%%% the future to avoid full data
copy to subplots.
279 self.window = cell(nplt);
281 copyStream = getByteStreamFromArray(self.template);
282 self.window{iplt} = getArrayFromByteStream(copyStream);
284 if ~isempty(hdf.colx)
285 self.window{iplt}.subplot.colx = hdf.colx{min(iplt, numel(hdf.colx))};
287 if ~isempty(hdf.rows)
288 self.window{iplt}.subplot.rows = hdf.rows{min(iplt, numel(hdf.rows))};
291 if ~isempty(self.template.subplot.dimx)
292 self.window{iplt}.subplot.dimx = self.template.subplot.dimx(min(iplt, numel(self.template.subplot.dimx)));
294 if ~isempty(self.template.subplot.dimy)
295 self.window{iplt}.subplot.dimy = self.template.subplot.dimy(min(iplt, numel(self.template.subplot.dimy)));
299 self.window{iplt}.subplot.colx = self.template.subplot.colx(iplt);
302 self.window{iplt}.subplot.coly = self.template.subplot.coly(iplt);
305 self.window{iplt}.subplot.colz = self.template.subplot.colz(iplt);
308 self.window{iplt}.subplot.colc = self.template.subplot.colc(iplt);
311 self.window{iplt}.make();
316 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
319 %> Export the current cascade of figures to the specified external files.<br>
322 %> This method is merely a wrapper around
323 %> all ``
savefig`` methods of the figure objects in
324 %> the ``window`` component of the parent cascade
object.<br>
326 %> \param[inout] self : The input/output parent
object of
class [pm.vis.Cascade](@ref
Cascade)
327 %>
which is **implicitly** passed to
this dynamic method (not by the user).<br>
328 %> \param[in] files : The input vector of MATLAB strings or cell array of
char vectors that must be
329 %> of the same length as the length of the ``window`` component of the parent
object.<br>
330 %> containing the paths to the external files to contain the visualizations.<br>
331 %> For more information, see the corresponding argument of the ``
savefig``
332 %> method of
class [pm.vis.figure.Figure](@ref
Figure).<br>
333 %> (**optional**. If ``files`` or any elements of it are is missing or empty,
334 %> the
default will be set by the ``
savefig`` method of the corresponding
335 %> cascade figure in the ``window`` component.)
337 %> \param[in] varargin : Any optional key-val pair that is accepted by
338 %> the ``
savefig`` method of
class [pm.vis.figure.Figure](@ref
Figure).<br>
339 %> For more information, see the ``
savefig`` method of
class [pm.vis.figure.Figure](@ref
Figure).<br>
341 %> \interface{savefigs}
345 %> c.savefigs(files);
346 %> c.savefigs(files, varargin);
351 %> \include{lineno} example/vis/
Cascade/main.m
360 %> \JoshuaOsborne, May 21 2024, 6:29 AM, University of Texas at Arlington<br>
361 %> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
362 %> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute
for Computational Engineering and Sciences (ICES), UT Austin<br>
363 function savefigs(self, files, varargin)
364 if nargin < 2 || isempty(files)
365 files = strings(length(self.window), 1);
367 if length(files) ~= length(self.window)
370 + "The condition ``length(files) == length(self.window)`` must hold." + newline ...
371 + "For more information, see the documentation displayed above." + newline ...
376 %%%% Starting from the last is important
377 %%%% to ensure all figures have been already created,
378 %%%% otherwise, the next figure to be generate will
379 %%%% become active over the previous images that
380 %%%% are being saved, corrupting the export.
383 %%%% Assuming all figures are generated sequentially from the first to the last,
384 %%%% the following fix to export figures from the last to the first should work.
385 %%%% However, this is only a temporary fix. An ideal solution must ensure all
386 %%%% figures have been generated before starting to export any figure.
388 for iwin = length(self.window) : -1 : 1
389 self.window{iwin}.savefig(files(iwin), varargin{:});
393 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
399 methods(Access =
public, Hidden)
401 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
404 %> Configure the cascade of plots settings and specifications and
return nothing.<br>
407 %> This method has side-effects by manipulating
408 %> the existing attributes of the parent
object.<br>
410 %> \param[inout] self : The input/output parent
object of
class [pm.vis.Cascade](@ref
Cascade)
411 %>
which is **implicitly** passed to
this dynamic method (not by the user).<br>
412 %> \param[in] varargin : Any ``property, value`` pair of the parent
object.<br>
413 %> If the
property is a ``
struct()``, then its value must be given as a cell array,
414 %> with consecutive elements representing the
struct ``property-
name, property-value`` pairs.<br>
415 %> Note that all of these property-value pairs can be also directly set via the
416 %> parent
object attributes, before calling the ``premake()`` method.<br>
418 %> \interface{premake}
421 %> c = pm.vis.Cascade.premake(varargin);
428 %> cv = pm.vis.Cascade(pm.vis.PlotLine(rand(100, 10)));
429 %> c.premake(
"figure", {
"color",
"white"})
430 %> cv.make(
"coly", 1:3)
437 %> \JoshuaOsborne, May 21 2024, 6:31 AM, University of Texas at Arlington<br>
438 %> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
439 %> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute
for Computational Engineering and Sciences (ICES), UT Austin<br>
440 function premake(self, varargin)
442 if ~isempty(varargin)
443 [varpar, varsub] = pm.matlab.hashmap.popKeyVal([
"template",
"window"], varargin);
445 self.hash2comp(varpar);
448 self.template.premake(varsub{:});
452 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
453 %%%% These settings must happen here so that they can be reset every time user nullifies the values.
454 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
458 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
462 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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...
This is the abstract class for generating instances of objects that contain the specifications of a c...
function make(in self, in varargin)
Configure the cascade settings and specifications, make the cascade of plots, and return nothing.
function savefigs(in self, in files, in varargin)
Export the current cascade of figures to the specified external files.
function premake(in self, in varargin)
Configure the cascade of plots settings and specifications and return nothing.
function reset(in self, in varargin)
Reset the properties of the cascade of plots to the original default settings.
function Cascade(in template, in varargin)
Construct and return an object of class pm.vis.Cascade.
This is the base class for generating instances of figures containing a symmetric square grid or corn...
This is the base class for generating subclass of MATLAB handle superclass whose annoying methods are...
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 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 len(in obj)
Return a scalar MATLAB whole-number containing the length of the input scalar or vector object.
function savefig(in varargin)
Export figures in a publication-quality format.
function which(in vendor)
Return the a MATLAB string containing the path to the first mpiexec executable binary found in system...