ParaMonte MATLAB 3.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
TilingLayout Class Reference

This is the base class for generating instances of objects that contains layout information for a set of tiled subplots in a single figure.
More...

Inheritance diagram for TilingLayout:
Collaboration diagram for TilingLayout:

Public Member Functions

function TilingLayout (in nrow, in ncol, in varargin)
 Construct and return an object of class pm.vis.TilingLayout.
More...
 
function reset (in self, in varargin)
 Reset the properties of the figure to the original default settings.
More...
 
function update (in self, in varargin)
 Update the figure, tiling, and colorbar layout based on the specified components positions.
More...
 

Data Fields

Property position
 
Property tiling
 
Property cbarh
 
Property cbarv
 

Detailed Description

This is the base class for generating instances of objects that contains layout information for a set of tiled subplots in a single figure.

For more information, see the documentation of the class constructor pm.vis.TilingLayout::TilingLayout.

Note
This class is not meant to be used directly by the end users.
Instead, use other classes that internally use this class as a component.
See the list of class attributes below, also those of the superclass pm.matlab.Handle.
The tiling layout generated by this class is different from new MATLAB tiledlayout.
Specifically, this class aims to mimic the layout originally devised the first version of ParaMonte MATLAB library release.
This ParaMonte tiling layout is, for example, used in making corner plots (formerly known as GridPlot in ParaMonte V1).


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, August 31 2024, 6:40 AM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.

Definition at line 26 of file TilingLayout.m.

Constructor & Destructor Documentation

◆ TilingLayout()

function TilingLayout::TilingLayout ( in  nrow,
in  ncol,
in  varargin 
)

Construct and return an object of class pm.vis.TilingLayout.

This is the constructor of the class pm.vis.TilingLayout.

Parameters
[in]nrow: The input scalar MATLAB positive whole-number, containing the number of rows of axes in the tiling.
[in]ncol: The input scalar MATLAB positive whole-number, containing the number of columns of axes in the tiling.
[in]varargin: Any property, value pair of the parent object.
If the property is a struct(), then its value must be given as a cell array, with consecutive elements representing the struct property-name, property-value pairs.
Note that all of these property-value pairs can be also directly set via the parent object attributes, before calling the make() method.
Returns
self : The output scalar object of class pm.vis.TilingLayout.


Possible calling interfaces

g = pm.vis.TilingLayout([], [], varargin);
g = pm.vis.TilingLayout([], ncol, upper, varargin);
g = pm.vis.TilingLayout(nrow, [], upper, varargin);
g = pm.vis.TilingLayout(nrow, ncol, upper, varargin);


Example usage

1close all
2clear all
3cd(fileparts(mfilename('fullpath'))); % Change working directory to source code directory.
4addpath('../../../'); % Add the ParaMonte library root directory to the search path.
5
6nrow = 5;
7ncol = 5;
8tl = pm.vis.TilingLayout(nrow, ncol, "cbarh", {"enabled", true}, "cbarv", {"enabled", true});
9fig = pm.vis.figure.Figure("figure", {"position", tl.position});
10fig.make();
11ax = struct();
12ax.main = axes("position", tl.tiling.position, "visible", "off");
13ax.tile = cell(nrow, ncol);
14for icol = 1 : ncol
15 for irow = 1 : nrow
16 ax.tile{irow, icol} = axes("position", tl.tiling.tile.position(:, irow, icol), "visible", "on", "box", "on", "FontSize", 10);
17 if 1 < icol
18 ax.tile{irow, icol}.YTickLabel = [];
19 end
20 if irow < nrow
21 ax.tile{irow, icol}.XTickLabel = [];
22 end
23 end
24end
25if tl.cbarv.enabled
26 %cv = colorbar(ax.main, "location", "north");%, "position", tl.cbarv.position);
27 cv = colorbar(ax.main, "position", tl.cbarv.position);
28 xlabel(cv, "Vertical Label", "fontsize", 13);
29end
30if tl.cbarv.enabled
31 ch = colorbar(ax.main, "position", tl.cbarh.position, "location", "north");
32 xlabel(ch, "Horizontal Label", "fontsize", 13);
33end
34xlabel(ax.main, "X-Axis Label", "fontsize", 13, "visible", "on");
35ylabel(ax.main, "Y-Axis Label", "fontsize", 13, "visible", "on");
36pm.vis.figure.savefig("TilingLayout.1.png", "-m3");
function root()
Return a scalar MATLAB string containing the root directory of the ParaMonte library package.

Visualization of the example output


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, August 31 2024, 6:40 AM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.

Member Function Documentation

◆ reset()

function TilingLayout::reset ( in  self,
in  varargin 
)

Reset the properties of the figure to the original default settings.

Use this method when you change many attributes of the plot and you want to clean up and go back to the default settings.

Parameters
[in]self: The implicitly-passed input argument representing the parent object of the method.
[in]varargin: Any property, value pair of the parent object.
If the property is a struct(), then its value must be given as a cell array, with consecutive elements representing the struct property-name, property-value pairs.
Note that all of these property-value pairs can be also directly set via the parent object attributes, before calling the make() method.


Possible calling interfaces

g = pm.vis.TilingLayout(varargin)
g.reset(varargin); % reset all object properties to the default settings.
function reset(in self, in varargin)
Reset the properties of the figure to the original default settings.


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Fatemeh Bagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.
Amir Shahmoradi, July 7 2024, 12:53 AM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.

◆ update()

function TilingLayout::update ( in  self,
in  varargin 
)

Update the figure, tiling, and colorbar layout based on the specified components positions.

For example, change the tiling or colorbar positions or the tile counts through the relevant object components, then use this method to renormalize all positions (to range [0, 1]) and update the individual tile positions.

Parameters
[in]self: The implicitly-passed input argument representing the parent object of the method.
[in]varargin: Any property, value pair of the parent object.
If the property is a struct(), then its value must be given as a cell array, with consecutive elements representing the struct property-name, property-value pairs.
Note that all of these property-value pairs can be also directly set via the parent object attributes, before calling the make() method.


Possible calling interfaces

g = pm.vis.TilingLayout(subplot, varargin);
g.update(varargin);
Warning
This method causes side-effects by manipulating the existing attributes of the object.


Example usage


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Fatemeh Bagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.
Amir Shahmoradi, July 7 2024, 12:53 AM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.

Field Documentation

◆ cbarh

Property TilingLayout::cbarh

cbarh

The MATLAB struct containing information about the horizontal colorbar that can be optionally added to the main axes (i.e., the collection of all axes).
It has the following components:

  1. position : The MATLAB vector of length four containing a set of positive normalized values in the range [0, 1], representing the whole colorbar coordinates as [startx, starty, width, height].
    The default value is set such that the colorbar sits reasonably at the top of the tiling.
  2. margint : The MATLAB scalar positive double in the range [0, 1], representing the top margin of the horizontal colorbar that appears on top of the tiling.
    This margin adds room for adding the colorbar axes label and tick marks.
    The default value is 0.07.
  3. enabled : The MATLAB logical scalar that allows addition of the colorbar if true.
    The default value is false.

Definition at line 98 of file TilingLayout.m.

◆ cbarv

Property TilingLayout::cbarv

cbarh

The MATLAB struct containing information about the horizontal colorbar that can be optionally added to the main axes (i.e., the collection of all axes).
It has the following components:

  1. position : The MATLAB vector of length four containing a set of positive normalized values in the range [0, 1], representing the whole colorbar coordinates as [startx, starty, width, height].
    The default value is set such that the colorbar sits reasonably at the top of the tiling.
  2. marginr : The MATLAB scalar positive double in the range [0, 1], representing the top margin of the vertical colorbar that appears to the right of the tiling.
    This margin adds room for adding the colorbar axes label and tick marks.
    The default value is 0.07.
  3. enabled : The MATLAB logical scalar that allows addition of the colorbar if true.
    The default value is false.

Definition at line 120 of file TilingLayout.m.

◆ position

Property TilingLayout::position

position

The MATLAB vector of length four containing a set of positive values representing the figure pixel coordinates as [startx, starty, width, height] with respect to the screen.
The default value is set such that the whole tiling looks square-shaped.

Definition at line 41 of file TilingLayout.m.

◆ tiling

Property TilingLayout::tiling

tiling

The scalar MATLAB struct containing the following components:

  1. nrow : The MATLAB scalar positive whole-number representing the number of subplots in each column of the subplot tiling.
  2. ncol : The MATLAB scalar positive whole-number representing the number of subplots in each row of the subplot tiling.
  3. tile : The scalar MATLAB struct containing the following components:
    1. width : The MATLAB scalar positive number in the range [0, 1], containing the width of each tile (subplot) along the x-axis in normalized units with respect to the tiling width.
      The default value is 14 / 15.
    2. height : The MATLAB scalar positive number in the range [0, 1], containing the height of each tile (subplot) along the x-axis in normalized units.
      in normalized units with respect to the tiling height.
      The default value is 14 / 15.
    3. position : The MATLAB tensor of shape [4, nrow, ncol], each [:, irow, icol] slice of which contains a set of positive normalized values in the range [0, 1], representing the position of the tile sitting at [irow, icol] starting from the top-left corner of the tiling.
      The positions are computed with respect to the figure container.
      The position values are calculated based on the tiling position.
      Beware that this component is always set by the update() method.
  4. position : The MATLAB vector of length four containing a set of positive normalized values in the range [0, 1], representing the whole tiling coordinates as [startx, starty, width, height].
    The default value is [0.07, 0.07, 0.93, 0.93].

Definition at line 76 of file TilingLayout.m.


The documentation for this class was generated from the following file: