2%> This is the base
class for generating instances
3%> of figures containing a tile of subplots.<br>
6%> See the
list of
class attributes below,
7%> also those of the superclass [pm.vis.figure.Figure](@ref
Figure).<br>
10%> See also the documentation of the constructor of the
class [pm.vis.Tiling::Tiling](@ref
Tiling::Tiling).<br>
15%> \JoshuaOsborne, May 21 2024, 9:20 AM, University of Texas at Arlington<br>
16%> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
17%> \AmirShahmoradi, July 7 2024, 12:53 AM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
18classdef
Tiling < pm.vis.figure.Figure
20 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
22 properties(Access =
public)
26 %> A MATLAB ``
struct`` whose fields and values are passed
27 %> as keyword arguments to the MATLAB intrinsic ``tiledlayout()``.<br>
33 %> The MATLAB cell matrix containing objects of superclass [pm.vis.Subplot](@ref
Subplot)
34 %> each of
which represents one subplot axes to display in the figure.<br>
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41 methods(Access =
public)
43 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
46 %> Construct and
return an
object of
class [pm.vis.Tiling](@ref
Tiling).<br>
49 %> This is the constructor of the
class [pm.vis.Tiling](@ref
Tiling).<br>
51 %> \param[in] subplot : The input cell matrix of MATLAB objects of superclass [pm.vis.Subplot](@ref
Subplot).<br>
52 %> \param[in] varargin : Any ``property, value`` pair of the parent
object.<br>
53 %> If the property is a ``
struct()``, then its value must be given as a cell array,
54 %> with consecutive elements representing the
struct ``property-
name, property-value`` pairs.<br>
55 %> Note that all of these
property-value pairs can be also directly set via the
56 %> parent
object attributes, before calling the ``make()`` method.<br>
59 %> ``self`` : The output scalar
object of
class [pm.vis.Tiling](@ref
Tiling).<br>
64 %> t = pm.vis.
Tiling(subplot);
65 %> t = pm.vis.Tiling(subplot, varargin);
70 %> See the
list of
class attributes below,
71 %> also those of the superclass [pm.vis.figure.Figure](@ref
Figure).<br>
76 %> \JoshuaOsborne, May 21 2024, 9:20 AM, University of Texas at Arlington<br>
77 function self =
Tiling(subplot, varargin)
81 failed = ~iscell(subplot);
83 for irow = 1 : size(subplot, 1)
84 for icol = 1 : size(subplot, 2)
85 failed = ~isempty(subplot{irow, icol}) && ~pm.introspection.istype(subplot{irow, icol},
"pm.vis.Subplot");
96 varargin = {
"subplot", subplot, varargin{:}};
98 help(
"pm.vis.Tiling");
100 +
"The input argument ``subplot`` must be a MATLAB cell matrix of " + newline ...
101 +
"empty objects or objects of superclass [pm.vis.Subplot](@ref Subplot)." + newline ...
102 +
"For more information, see the class documentation displayed above." + newline ...
106 self = self@pm.vis.figure.Figure(varargin{:});
109 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
112 %> Configure the figure settings and specifications,
113 %> make the figure and the subplots, and
return nothing.<br>
116 %> The subplots are made by calling their ``make()`` methods.<br>
119 %> This method has side-effects by manipulating
120 %> the existing attributes of the parent
object.<br>
122 %> \param[in] self : The **implicitly-passed** input argument representing the parent
object of the method.<br>
123 %> \param[in] varargin : Any ``property, value`` pair of the parent
object.<br>
124 %> If the
property is a ``
struct()``, then its value must be given as a cell array,
125 %> with consecutive elements representing the
struct ``property-
name, property-value`` pairs.<br>
126 %> Note that all of these property-value pairs can be also directly set via the
127 %> parent
object attributes, before calling the ``make()`` method.<br>
132 %> t = pm.vis.Tiling(subplot, varargin);
140 %> \JoshuaOsborne, May 21 2024, 9:24 AM, University of Texas at Arlington<br>
141 %> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
142 %> \AmirShahmoradi, July 7 2024, 12:53 AM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
143 function make(self, varargin)
145 make@pm.vis.figure.Figure(self, varargin{:});
147 %%%% Resize the figure to allow good
default visualization.
149 if isempty(self.figure.outerPosition) && 0 < numel(self.subplot)
150 fullSize = get(0, 'ScreenSize');
152 maxSize(1:2) = .05 * maxSize(3:4);
153 maxSize(3:4) = maxSize(3:4) - maxSize(1:2);
154 figSize = self.fout.figure.OuterPosition;
155 maxScale = maxSize(3:4) ./ figSize(3:4);
156 newWidth = figSize(3) * min(maxScale(1), size(self.subplot, 2));
157 newHeight = figSize(4) * min(maxScale(2), size(self.subplot, 1));
158 figStart = [(fullSize(3) - newWidth) / 2, (fullSize(4) - newHeight) / 2];
159 set(self.fout.figure, "OuterPosition", [figStart(1:2), newWidth, newHeight]);
162 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
163 %%%% RULE 0: No component of ``self`` is allowed to appear to the left of assignment operator, except ``fout``.
164 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
167 for prop = [ "tiledlayout" ...
169 if isprop(self, prop)
170 kws.(prop) = self.comp2hash(prop);
175 self.fout.tiledlayout = tiledlayout(size(self.subplot, 1), size(self.subplot, 2), kws.tiledlayout{:}); %
requires MATLAB R2019b.
178 timer = pm.timing.Timer();
179 spinner = pm.timing.Spinner();
180 for irow = 1 : size(self.subplot, 1)
181 for icol = 1 : size(self.subplot, 2)
184 spinner.spin(iplt / numel(self.subplot));
186 if pm.introspection.
istype(self.subplot{irow, icol},
"pm.vis.Subplot")
190 subplot(size(self.subplot, 1), size(self.subplot, 2), iplt);
192 self.subplot{irow, icol}.make();
196 if ~self.silent && 0 < iplt
197 disp(
"done in " + sprintf(
"%.6f",
string(timer.toc())) +
" seconds.");
202 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
205 %> Reset the properties of the figure to the original
default settings.<br>
208 %> Use
this method when you change many attributes of the plot and
209 %> you want to
clean up and go back to the
default settings.<br>
211 %> \param[in] self : The **implicitly-passed** input argument representing the parent
object of the method.<br>
212 %> \param[in] varargin : Any ``property, value`` pair of the parent
object.<br>
213 %> If the
property is a ``
struct()``, then its value must be given as a cell array,
214 %> with consecutive elements representing the
struct ``property-
name, property-value`` pairs.<br>
215 %> Note that all of these property-value pairs can be also directly set via the
216 %> parent
object attributes, before calling the ``make()`` method.<br>
221 %> t = pm.vis.Tiling(subplot, varargin)
222 %> t.reset(varargin); % reset all
object properties to the
default settings.
229 %> \JoshuaOsborne, May 21 2024, 9:25 AM, University of Texas at Arlington<br>
230 %> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
231 %> \AmirShahmoradi, July 7 2024, 12:53 AM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
232 function reset(self, varargin)
234 self.tiledlayout.innerPosition = [];
235 self.tiledlayout.outerPosition = [];
236 self.tiledlayout.position = [];
237 self.tiledlayout.positionConstraint = [];
238 self.tiledlayout.padding = [];
239 self.tiledlayout.tileSpacing = [];
240 self.tiledlayout.units = [];
242 reset@pm.vis.figure.Figure(self, varargin{:}); %
this will automatically call the ``premake()`` method of the
object.
244 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
245 %%%% RULE 0: Any non-MATLAB-
default setting must be preferably set in the make() method to override user null values.
246 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
248 %self.premake(varargin{:}); % This is the subclass method!
252 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
255 %> Preset the tiling settings before making it.<br>
258 %> This method causes side-effects by manipulating
259 %> the existing attributes of the
object.<br>
261 %> \param[in] self : The **implicitly-passed** input argument representing the parent
object of the method.<br>
262 %> \param[in] varargin : Any ``property, value`` pair of the parent
object.<br>
263 %> If the
property is a ``
struct()``, then its value must be given as a cell array,
264 %> with consecutive elements representing the
struct ``property-
name, property-value`` pairs.<br>
265 %> Note that all of these property-value pairs can be also directly set via the
266 %> parent
object attributes, before calling the ``make()`` method.<br>
268 %> \interface{premake}
271 %> t = pm.vis.Tiling(subplot, varargin);
272 %> t.premake(varargin);
279 %> \JoshuaOsborne, May 21 2024, 9:28 AM, University of Texas at Arlington<br>
280 %> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
281 %> \AmirShahmoradi, July 7 2024, 12:53 AM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
282 function premake(self, varargin)
284 premake@pm.vis.figure.Figure(self, varargin{:});
286 %self.nrow = size(self.subplot, 1);
287 %self.ncol = size(self.subplot, 2);
289 %%%% Set the
default margins.
291 self.setKeyVal(
"tiledlayout",
"tileSpacing",
"tight");
292 %self.setKeyVal(
"tiledlayout",
"padding",
"tight");
296 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
300 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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...
This is the abstract class for generating instances of axes with various types of plots from one or m...
This is the base class for generating instances of figures containing a tile of subplots.
function make(in self, in varargin)
Configure the figure settings and specifications, make the figure and the subplots,...
function premake(in self, in varargin)
Preset the tiling settings before making it.
function Tiling(in subplot, in varargin)
Construct and return an object of class pm.vis.Tiling.
function reset(in self, in varargin)
Reset the properties of the figure to the original default settings.
function clean()
Remove all paths that contain the ParaMonte lib directory from the MATLAB path variable.
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 which(in vendor)
Return the a MATLAB string containing the path to the first mpiexec executable binary found in system...