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

This is the base class for generating instances of objects that contain the specifications of various types of figures.
More...

Inheritance diagram for Plot:
Collaboration diagram for Plot:

Public Member Functions

function Plot (in subplot, in varargin)
 
function reset (in self, in varargin)
 Reset the properties of the plot to the original default settings.
More...
 
function make (in self, in varargin)
 Configure the plot settings and specifications, make the plot, and return nothing.
More...
 
function premake (in self, in varargin)
 Configure the plot settings and specifications and return nothing.
More...
 

Data Fields

Property subplot
 

Detailed Description

This is the base class for generating instances of objects that contain the specifications of various types of figures.

This is a generic class for generating figures containing a single subplot (axes).

Note
See the documentation of the constructor of the class pm.vis.Plot for example usage.
See the documentation of the attributes of the superclass pm.vis.figure.Figure.
See also
pm.vis.Cascade
pm.vis.Subplot
pm.vis.Figure
pm.vis.Corner
pm.vis.Plot
pm.vis.Tile


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.

Amir Shahmoradi, July 5 2024, 1:07 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.

Definition at line 28 of file Plot.m.

Constructor & Destructor Documentation

◆ Plot()

function Plot::Plot ( in  subplot,
in  varargin 
)
Parameters
[in]subplot: The input scalar object of superclass pm.vis.Subplot.
The input subplot object must minimally have the make() and reset() methods.
[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.
The input varargin can also contain the components of the subplot component of the parent object.
Returns
self : The output scalar object of class pm.vis.Plot.


Possible calling interfaces

plot = pm.vis.Plot(subplot);
plot = pm.vis.Plot(subplot, varargin);
Property subplot
Definition: Plot.m:42
Note
The input varargin can also contain the components of the subplot component of the parent object.
See the list of class attributes below, also those of the superclass pm.vis.figure.Figure.


Example usage

1cd(fileparts(mfilename('fullpath'))); % Change working directory to source code directory.
2addpath('../../../'); % Add the ParaMonte library root directory to the search path.
3
4theta = linspace(0, 8 * pi, 500);
5r = 1.5 * theta;
6df = array2table(ctranspose([r .* cos(theta); r .* sin(theta); r(end) - r]));
7df.Properties.VariableNames = ["X = r cos(theta)", "Y = r sin(theta)", "Z = r"];
8
9pv = pm.vis.Plot(pm.vis.Subplot("Line", df));
10pv.subplot.title.titletext = "Line Plot";
11pv.subplot.surface.lineWidth = 2;
12pv.make("colx", 1, "coly", 2);
13pv.savefig("PlotLine.1.png", "-m3");
14
15pv = pm.vis.Plot(pm.vis.Subplot("Line3", df));
16pv.subplot.title.titletext = "Line3 Plot";
17pv.subplot.surface.lineWidth = 2;
18pv.make("colx", 1, "coly", 2, "colz", 3);
19pv.savefig("PlotLine3.1.png", "-m3");
20
21pv = pm.vis.Plot(pm.vis.Subplot("Scatter", df));
22pv.subplot.title.titletext = "Scatter Plot";
23pv.make("colx", 1, "coly", 2);
24pv.savefig("PlotScatter.1.png", "-m3");
25
26pv = pm.vis.Plot(pm.vis.Subplot("Scatter3", df));
27pv.subplot.title.titletext = "Scatter3 Plot";
28pv.make("colx", 1, "coly", 2, "colz", 3);
29pv.savefig("PlotScatter3.1.png", "-m3");
30
31pv = pm.vis.Plot(pm.vis.Subplot("LineScatter", df));
32pv.subplot.title.titletext = "LineScatter Plot";
33pv.make("colx", 1, "coly", 2);
34pv.savefig("PlotLineScatter.1.png", "-m3");
35
36pv = pm.vis.Plot(pm.vis.Subplot("LineScatter3", df));
37pv.subplot.title.titletext = "LineScatter3 Plot";
38pv.make("colx", 1, "coly", 2, "colz", 3);
39pv.savefig("PlotLineScatter3.1.png", "-m3");
40
41pv = pm.vis.Plot(pm.vis.Subplot("Histogram", df));
42pv.subplot.title.titletext = "Histogram Plot";
43pv.make("colx", 1);
44pv.savefig("PlotHistogram.1.png", "-m3");
45
46pv = pm.vis.Plot(pm.vis.Subplot("Histogram2", df));
47pv.subplot.title.titletext = "Histogram2 Plot";
48pv.make("colx", 1, "coly", 2);
49pv.savefig("PlotHistogram2.1.png", "-m3");
50
51pv = pm.vis.Plot(pm.vis.Subplot("Histfit", df));
52pv.subplot.title.titletext = "Histfit Plot";
53pv.make("colx", 1);
54pv.savefig("PlotHistfit.1.png", "-m3");
55
56pv = pm.vis.Plot(pm.vis.Subplot("Contour", df));
57pv.subplot.title.titletext = "Contour Plot";
58pv.make("colx", 1, "coly", 2, "xlim", [-20, 20], "ylim", [-20, 20]);
59pv.savefig("PlotContour.1.png", "-m3");
60
61pv = pm.vis.Plot(pm.vis.Subplot("Contour3", df));
62pv.subplot.title.titletext = "Contour3 Plot";
63pv.make("colx", 1, "coly", 2, "xlim", [-20, 20], "ylim", [-20, 20]);
64pv.savefig("PlotContour3.1.png", "-m3");
65
66pv = pm.vis.Plot(pm.vis.Subplot("Contourf", df));
67pv.subplot.title.titletext = "Contourf Plot";
68pv.make("colx", 1, "coly", 2, "xlim", [-20, 20], "ylim", [-20, 20]);
69pv.savefig("PlotContourf.1.png", "-m3");
70
71dfcor = pm.stats.Cor(df(:, 1 : 2));
72pv = pm.vis.Plot(pm.vis.Subplot("Heatmap", dfcor.val));
73pv.make();
74title("Heatmap Plot");
75pv.savefig("PlotHeatmap.1.png", "-m3");
76
77%%%% Make Ellipse plots.
78
79sampler = pm.sampling.Paradram();
80sampler.spec.outputStatus = "retry";
81sampler.spec.outputFileName = "mvn";
82sampler.spec.randomSeed = 28457353; % make sampling reproducible.
83sampler.spec.outputChainSize = 30000; % Use a small chain size for illustration.
84sampler.spec.outputRestartFileFormat = "ascii";
85sampler.silent = true;
86sampler.run(@(x) -sum((x - [-5; 5; 10; -10]) .^ 2), 4);
87restart = sampler.readRestart();
88restart = restart{1};
89
90pv = pm.vis.Plot(pm.vis.SubplotEllipse(restart.proposalCov, restart.proposalMean));
91pv.subplot.title.titletext = "Ellipse Plot";
92pv.make("axes", {"zscale", "log"}, "dimx", [1, 3], "dimy", [1, 3] + 1);
93pv.savefig("PlotEllipse.1.png", "-m3");
94
95pv = pm.vis.Plot(pm.vis.SubplotEllipse3(restart.proposalCov, restart.proposalMean, transpose(restart.uniqueStateVisitCount)));
96pv.subplot.title.titletext = "Ellipse3 Plot";
97pv.make("axes", {"zscale", "log"}, "dimx", [1, 3], "dimy", [1, 3] + 1);
98pv.savefig("PlotEllipse3.1.png", "-m3");
99
100close all;
function make(in self, in varargin)
Configure the plot settings and specifications, make the plot, and return nothing.
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:
Joshua Alexander Osborne, May 21 2024, 9:32 AM, University of Texas at Arlington
Amir Shahmoradi, July 5 2024, 1:07 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.

Member Function Documentation

◆ make()

function Plot::make ( in  self,
in  varargin 
)

Configure the plot settings and specifications, make the plot, and return nothing.

In making the figure, this method we call the make() methods of each of the subplot objects stored in the subplot component.

Warning
This method has side-effects by manipulating the existing attributes of the parent object.
Parameters
[in,out]self: The input/output parent object of class pm.vis.Subplot which is implicitly passed to this dynamic method (not by the user).
[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

p = pm.vis.Plot.make(varargin);
Note
The input varargin can also contain the components of the subplot component of the parent object.


Example usage

1cd(fileparts(mfilename('fullpath'))); % Change working directory to source code directory.
2addpath('../../../'); % Add the ParaMonte library root directory to the search path.
3
4theta = linspace(0, 8 * pi, 500);
5r = 1.5 * theta;
6df = array2table(ctranspose([r .* cos(theta); r .* sin(theta); r(end) - r]));
7df.Properties.VariableNames = ["X = r cos(theta)", "Y = r sin(theta)", "Z = r"];
8
9pv = pm.vis.Plot(pm.vis.Subplot("Line", df));
10pv.subplot.title.titletext = "Line Plot";
11pv.subplot.surface.lineWidth = 2;
12pv.make("colx", 1, "coly", 2);
13pv.savefig("PlotLine.1.png", "-m3");
14
15pv = pm.vis.Plot(pm.vis.Subplot("Line3", df));
16pv.subplot.title.titletext = "Line3 Plot";
17pv.subplot.surface.lineWidth = 2;
18pv.make("colx", 1, "coly", 2, "colz", 3);
19pv.savefig("PlotLine3.1.png", "-m3");
20
21pv = pm.vis.Plot(pm.vis.Subplot("Scatter", df));
22pv.subplot.title.titletext = "Scatter Plot";
23pv.make("colx", 1, "coly", 2);
24pv.savefig("PlotScatter.1.png", "-m3");
25
26pv = pm.vis.Plot(pm.vis.Subplot("Scatter3", df));
27pv.subplot.title.titletext = "Scatter3 Plot";
28pv.make("colx", 1, "coly", 2, "colz", 3);
29pv.savefig("PlotScatter3.1.png", "-m3");
30
31pv = pm.vis.Plot(pm.vis.Subplot("LineScatter", df));
32pv.subplot.title.titletext = "LineScatter Plot";
33pv.make("colx", 1, "coly", 2);
34pv.savefig("PlotLineScatter.1.png", "-m3");
35
36pv = pm.vis.Plot(pm.vis.Subplot("LineScatter3", df));
37pv.subplot.title.titletext = "LineScatter3 Plot";
38pv.make("colx", 1, "coly", 2, "colz", 3);
39pv.savefig("PlotLineScatter3.1.png", "-m3");
40
41pv = pm.vis.Plot(pm.vis.Subplot("Histogram", df));
42pv.subplot.title.titletext = "Histogram Plot";
43pv.make("colx", 1);
44pv.savefig("PlotHistogram.1.png", "-m3");
45
46pv = pm.vis.Plot(pm.vis.Subplot("Histogram2", df));
47pv.subplot.title.titletext = "Histogram2 Plot";
48pv.make("colx", 1, "coly", 2);
49pv.savefig("PlotHistogram2.1.png", "-m3");
50
51pv = pm.vis.Plot(pm.vis.Subplot("Histfit", df));
52pv.subplot.title.titletext = "Histfit Plot";
53pv.make("colx", 1);
54pv.savefig("PlotHistfit.1.png", "-m3");
55
56pv = pm.vis.Plot(pm.vis.Subplot("Contour", df));
57pv.subplot.title.titletext = "Contour Plot";
58pv.make("colx", 1, "coly", 2, "xlim", [-20, 20], "ylim", [-20, 20]);
59pv.savefig("PlotContour.1.png", "-m3");
60
61pv = pm.vis.Plot(pm.vis.Subplot("Contour3", df));
62pv.subplot.title.titletext = "Contour3 Plot";
63pv.make("colx", 1, "coly", 2, "xlim", [-20, 20], "ylim", [-20, 20]);
64pv.savefig("PlotContour3.1.png", "-m3");
65
66pv = pm.vis.Plot(pm.vis.Subplot("Contourf", df));
67pv.subplot.title.titletext = "Contourf Plot";
68pv.make("colx", 1, "coly", 2, "xlim", [-20, 20], "ylim", [-20, 20]);
69pv.savefig("PlotContourf.1.png", "-m3");
70
71dfcor = pm.stats.Cor(df(:, 1 : 2));
72pv = pm.vis.Plot(pm.vis.Subplot("Heatmap", dfcor.val));
73pv.make();
74title("Heatmap Plot");
75pv.savefig("PlotHeatmap.1.png", "-m3");
76
77%%%% Make Ellipse plots.
78
79sampler = pm.sampling.Paradram();
80sampler.spec.outputStatus = "retry";
81sampler.spec.outputFileName = "mvn";
82sampler.spec.randomSeed = 28457353; % make sampling reproducible.
83sampler.spec.outputChainSize = 30000; % Use a small chain size for illustration.
84sampler.spec.outputRestartFileFormat = "ascii";
85sampler.silent = true;
86sampler.run(@(x) -sum((x - [-5; 5; 10; -10]) .^ 2), 4);
87restart = sampler.readRestart();
88restart = restart{1};
89
90pv = pm.vis.Plot(pm.vis.SubplotEllipse(restart.proposalCov, restart.proposalMean));
91pv.subplot.title.titletext = "Ellipse Plot";
92pv.make("axes", {"zscale", "log"}, "dimx", [1, 3], "dimy", [1, 3] + 1);
93pv.savefig("PlotEllipse.1.png", "-m3");
94
95pv = pm.vis.Plot(pm.vis.SubplotEllipse3(restart.proposalCov, restart.proposalMean, transpose(restart.uniqueStateVisitCount)));
96pv.subplot.title.titletext = "Ellipse3 Plot";
97pv.make("axes", {"zscale", "log"}, "dimx", [1, 3], "dimy", [1, 3] + 1);
98pv.savefig("PlotEllipse3.1.png", "-m3");
99
100close all;

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:
Joshua Alexander Osborne, May 21 2024, 9:37 AM, University of Texas at Arlington
Fatemeh Bagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.
Amir Shahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin

◆ premake()

function Plot::premake ( in  self,
in  varargin 
)

Configure the plot settings and specifications and return nothing.

Warning
This method has side-effects by manipulating the existing attributes of the parent object.
Parameters
[in,out]self: The input/output parent object of class pm.vis.Subplot which is implicitly passed to this dynamic method (not by the user).
[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 premake() method.


Possible calling interfaces

f = pm.vis.Plot.premake(varargin);


Example usage

f = pm.vis.Plot(pm.vis.Line());
f.premake("figure", {"color", "none"})

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:
Joshua Alexander Osborne, May 21 2024, 9:39 AM, University of Texas at Arlington
Fatemeh Bagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.
Amir Shahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin

◆ reset()

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

Reset the properties of the plot 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,out]self: The input/output parent object of class pm.vis.Subplot which is implicitly passed to this dynamic method (not by the user).
[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

pm.vis.Plot.reset() % reset the plot to the default settings.
function reset(in self, in varargin)
Reset the properties of the plot to the original default settings.
Note
The input varargin can also contain the components of the subplot component of the parent object.


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:
Joshua Alexander Osborne, May 21 2024, 9:35 AM, University of Texas at Arlington
Fatemeh Bagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.
Amir Shahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin

Field Documentation

◆ subplot

Property Plot::subplot

subplot

The scalar object of superclass pm.vis.Subplot representing the set of subplots to display in the figure.

Definition at line 42 of file Plot.m.


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