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] varargin : Any ``property, value`` pair of the parent
object.<br>
123 %> If the
property is a ``
struct()``, then its value must be given as a cell array,
124 %> with consecutive elements representing the
struct ``property-
name, property-value`` pairs.<br>
125 %> Note that all of these property-value pairs can be also directly set via the
126 %> parent
object attributes, before calling the ``make()`` method.<br>
131 %> t = pm.vis.Tiling(subplot, varargin);
139 %> \JoshuaOsborne, May 21 2024, 9:24 AM, University of Texas at Arlington<br>
140 %> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
141 %> \AmirShahmoradi, July 7 2024, 12:53 AM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
142 function make(self, varargin)
144 make@pm.vis.figure.Figure(self, varargin{:});
146 %%%% Resize the figure to allow good
default visualization.
148 if isempty(self.figure.outerPosition) && 0 < numel(self.subplot)
149 fullSize = get(0, 'ScreenSize');
151 maxSize(1:2) = .05 * maxSize(3:4);
152 maxSize(3:4) = maxSize(3:4) - maxSize(1:2);
153 figSize = self.fout.figure.OuterPosition;
154 maxScale = maxSize(3:4) ./ figSize(3:4);
155 newWidth = figSize(3) * min(maxScale(1), size(self.subplot, 2));
156 newHeight = figSize(4) * min(maxScale(2), size(self.subplot, 1));
157 figStart = [(fullSize(3) - newWidth) / 2, (fullSize(4) - newHeight) / 2];
158 set(self.fout.figure, "OuterPosition", [figStart(1:2), newWidth, newHeight]);
161 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
162 %%%% RULE 0: No component of ``self`` is allowed to appear to the left of assignment operator, except ``fout``.
163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
166 for prop = [ "tiledlayout" ...
168 if isprop(self, prop)
169 kws.(prop) = self.comp2hash(prop);
174 self.fout.tiledlayout = tiledlayout(size(self.subplot, 1), size(self.subplot, 2), kws.tiledlayout{:}); %
requires MATLAB R2019b.
177 timer = pm.timing.Timer();
178 spinner = pm.timing.Spinner();
179 for irow = 1 : size(self.subplot, 1)
180 for icol = 1 : size(self.subplot, 2)
182 spinner.spin(iplt / numel(self.subplot));
183 if pm.introspection.
istype(self.subplot{irow, icol},
"pm.vis.Subplot")
187 subplot(size(self.subplot, 1), size(self.subplot, 2), iplt);
189 self.subplot{irow, icol}.make();
194 disp(
"done in " + sprintf(
"%.6f",
string(timer.toc())) +
" seconds.");
199 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
202 %> Reset the properties of the figure to the original
default settings.<br>
205 %> Use
this method when you change many attributes of the plot and
206 %> you want to
clean up and go back to the
default settings.<br>
208 %> \param[in] varargin : Any ``property, value`` pair of the parent
object.<br>
209 %> If the
property is a ``
struct()``, then its value must be given as a cell array,
210 %> with consecutive elements representing the
struct ``property-
name, property-value`` pairs.<br>
211 %> Note that all of these property-value pairs can be also directly set via the
212 %> parent
object attributes, before calling the ``make()`` method.<br>
217 %> t = pm.vis.Tiling(subplot, varargin) % reset all
object properties to the
default settings.
218 %> t.reset(varargin);
225 %> \JoshuaOsborne, May 21 2024, 9:25 AM, University of Texas at Arlington<br>
226 %> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
227 %> \AmirShahmoradi, July 7 2024, 12:53 AM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
228 function reset(self, varargin)
230 self.tiledlayout.innerPosition = [];
231 self.tiledlayout.outerPosition = [];
232 self.tiledlayout.position = [];
233 self.tiledlayout.positionConstraint = [];
234 self.tiledlayout.padding = [];
235 self.tiledlayout.tileSpacing = [];
236 self.tiledlayout.units = [];
238 reset@pm.vis.figure.Figure(self, varargin{:}); %
this will automatically call the ``premake()`` method of the
object.
240 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
241 %%%% RULE 0: Any non-MATLAB-
default setting must be preferably set in the make() method to override user null values.
242 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
244 %self.premake(varargin{:}); % This is the subclass method!
248 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
251 %> Preset the tiling settings before making it.<br>
254 %> This method causes side-effects by manipulating
255 %> the existing attributes of the
object.<br>
257 %> \param[in] varargin : Any ``property, value`` pair of the parent
object.<br>
258 %> If the
property is a ``
struct()``, then its value must be given as a cell array,
259 %> with consecutive elements representing the
struct ``property-
name, property-value`` pairs.<br>
260 %> Note that all of these property-value pairs can be also directly set via the
261 %> parent
object attributes, before calling the ``make()`` method.<br>
263 %> \interface{premake}
266 %> t = pm.vis.Tiling(subplot, varargin);
267 %> t.premake(varargin);
276 %> \JoshuaOsborne, May 21 2024, 9:28 AM, University of Texas at Arlington<br>
277 %> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
278 %> \AmirShahmoradi, July 7 2024, 12:53 AM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
279 function premake(self, varargin)
281 premake@pm.vis.figure.Figure(self, varargin{:});
283 %self.nrow = size(self.subplot, 1);
284 %self.ncol = size(self.subplot, 2);
286 %%%% Set the
default margins.
288 self.setKeyVal(
"tiledlayout",
"tileSpacing",
"tight");
289 %self.setKeyVal(
"tiledlayout",
"padding",
"tight");
293 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
297 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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 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...