paramonte.vis.DensityPlot
¶
Module Contents¶
Classes¶
|
This is the DensityPlot class for generating instances |
-
paramonte.vis.DensityPlot.
newline
¶
-
class
paramonte.vis.DensityPlot.
DensityPlot
(plotType, dataFrame=None, methodName='ParaMonte', reportEnabled=True, resetPlot=None)[source]¶ Bases:
paramonte.vis._BasePlot.BasePlot
This is the DensityPlot class for generating instances of histogram and contour figures in two and three dimensions based on a wide range of plotting tools from the matplotlib, seaborn, and other Python libraries.
Normally, the public users are not supposed to use this class directly, although they can for the purposes other than plotting the ParaMonte simulation files.
Parameters
plotType
A string indicating the name of the plot to be constructed.
dataFrame (optional)
A pandas dataFrame whose data will be plotted.
methodName (optional)
The name of the ParaMonte sample requesting the BasePlot.
reportEnabled (optional)
A boolean whose value indicates whether guidelines should be printed in the standard output.
resetPlot (optional)
A function that resets the properties of the plot as desired from outside. If provided, a pointer to this function will be saved for future internal usage.
Attributes
xcolumns
An attribute that determines the columns of dataFrame to be visualized as the X-axis. It can have three forms:
A list of column indices in dataFrame.
A list of column names in dataFrame.columns.
A
range(start,stop,step)
of column indices.
Examples:
xcolumns = [0,1,4,3]
xcolumns = ["SampleLogFunc","SampleVariable1"]
xcolumns = range(17,7,-2)
The default behavior includes all columns of the dataFrame.
ycolumns (only in kdeplot2, contour, contourf, contour3 plots)
An attribute that determines the columns of dataFrame to be visualized as the Y-axis. It can have three forms:
A list of column indices in dataFrame.
A list of column names in dataFrame.columns.
A
range(start,stop,step)
of column indices.
Examples:
ycolumns = [0,1,4,3]
ycolumns = ["SampleLogFunc","SampleVariable1"]
ycolumns = range(17,7,-2)
The default behavior includes all columns of the dataFrame.
rows
An attribute that determines the rows of dataFrame to be visualized. It can be either:
A
range(start,stop,step)
, or,A list of row indices in dataFrame.index.
Examples:
rows = range(17,7,-2)
rows = [i for i in range(7,17)]
The default behavior includes all rows of the dataFrame.
histplot (available only in histplot objects)
A structure with two attributes:
enabled
A boolean indicating whether a call to the
histplot()
function of the seaborn library should be made or not.kws
A structure whose components are directly passed as keyword arguments to the
histplot()
function.Example usage:
1
histplot.kws.stat = "count"
NOTE
If a desired property is missing among the
kws
attributes, simply add the field and its value to the component.kdeplot (available only in
kdeplot1
andkdeplot2
objects)A structure with two attributes:
enabled
A boolean indicating whether a call to the
kdeplot()
function of the seaborn library should be made or not.kws
A structure whose components are directly passed as keyword arguments to the
kdeplot()
function.Example usage:
1 2
kdeplot.kws.cbar = True kdeplot.kws.shade = False
NOTE
If a desired property is missing among the
kws
attributes, simply add the field and its value to the component.contour (available only in
contour
andcontour3
objects)A structure with two attributes:
enabled
A boolean indicating whether a call to the
contour()
function of the seaborn library should be made or not.kws
A structure whose components are directly passed as keyword arguments to the
contour()
function.Example usage:
1 2
contour.kws.cmap = "winter" contour.kws.levels = 50
NOTE
If a desired property is missing among the
kws
attributes, simply add the field and its value to the component.contourf (available only in
contourf
objects)A structure with two attributes:
enabled
A boolean indicating whether a call to the
contourf()
function of the seaborn library should be made or not.kws
A structure whose components are directly passed as keyword arguments to the
contourf()
function.Example usage:
1 2
contour.kws.cmap = "winter" contour.kws.levels = 50
NOTE
If a desired property is missing among the
kws
attributes, simply add the field and its value to the component.gridSize (available in
contour
,contourf
,contour3
objects)An integer indicating the grid resolution for discretization of the data during the kernel density estimation. It must be a power of two, otherwise it will be changed to the next power of two at the time of using it. The default value is 512.
Example usage:
gridSize = 512
limits (available in
contour
,contourf
,contour3
objects)Data
limits
used in the kernel density estimation specified as a tuple of tuples((xmin, xmax), (ymin, ymax))
. If any of the values areNone
, they will be inferred from the data. Each tuple, or even both of them, may also be replaced by a single value denoting the upper bound of a range centered at zero. The default isNone
.Example usage:
limits = ( (-10, 10),(-5,5) )
noiseDensity (available in
contour
,contourf
,contour3
)A float indicating the threshold below which the kernel density estimate is considered to be noise and is rounded to zero. The higher this value is, the less noise will be visible.
Example usage:
noiseDensity = 1.e-5
set
A structure with two attributes:
enabled
A boolean indicating whether a call to the
set()
function of the seaborn library should be made or not.kws
A structure whose components are directly passed as keyword arguments to the
set()
function.Example usage:
set.kws.style = "darkgrid"
NOTE
If a desired property is missing among the
kws
attributes, simply add the field and its value to the component.axes (available only in 1D and 2D plots)
A structure with one attribute:
kws
A structure whose components are directly passed as keyword arguments to the
gca()
function of the matplotlib library.Example usage:
axes.kws.facecolor = "w"
NOTE
If a desired property is missing among the
kws
attributes, simply add the field and its value to the component.axes3d (available only in 3D plots)
A structure with one attribute:
kws
A structure whose components are directly passed as keyword arguments to the
Axes3D()
function of the matplotlib library.Example usage:
axes3d.kws.facecolor = "w"
NOTE
If a desired property is missing among the
kws
attributes, simply add the field and its value to the component.figure
A structure with two attributes:
enabled
A boolean indicating whether a call to the
figure()
function of the matplotlib library should be made or not. If a call is made, a new figure will be generated. Otherwise, the current active figure will be used.kws
A structure whose components are directly passed as keyword arguments to the
figure()
function.Example usage:
figure.kws.facecolor = "w"
NOTE
If a desired property is missing among the
kws
attributes, simply add the field and its value to the component.colorbar (exists only for plots that require colorbar)
A structure with two attributes:
enabled
A boolean indicating whether a call to the
colorbar()
function of the matplotlib library should be made or not. If a call is made, a new figure will be generated. Otherwise, the current active figure will be used.kws
A structure whose components are directly passed as keyword arguments to the
colorbar()
function of the matplotlib library.NOTE
If a desired property is missing among the
kws
attributes, simply add the field and its value to the component.A colorbar will be added to a plot only if a color-mappings is requested in the plot.
legend (may not exist for some types of plots)
A structure with two attributes:
enabled
A boolean indicating whether a call to the
legend()
function of the matplotlib library should be made or not. If a call is made, a new figure will be generated. Otherwise, the current active figure will be used.kws
A structure whose components are directly passed as keyword arguments to the
legend()
function.Example usage:
legend.kws.labels = ["Variable1", "Variable2"]
NOTE
If a desired property is missing among the
kws
attributes, simply add the field and its value to the component.A legend will be added to a plot only if no color-mappings are requested in the plot.
currentFig
A structure whose attributes are the outputs of various plotting tools used to make the current figure. These include the handle to the current figure, the handle to the current axes in the plot, the handle to the colorbar (if any exists), and other Python plotting tools used to make to generate the figure.
target (available only in 1D and 2D plot objects)
A callable object of the ParaMonte library’s
Target
class which can be used to add target point or lines to the current active plot.Returns
An object of class
DensityPlot
.-
__call__
(self, reself: tp.Optional[bool] = False, **kwargs)[source]¶ Call the
make()
method of the current instance of the class.Parameters
Any arguments that can be passed to the
make()
method of the plot object.Returns
Any return value from the
make()
method of the plot object.
-
make
(self, reself: tp.Optional[bool] = False, **kwargs)[source]¶ Generate a plot from the selected columns of the object’s dataFrame.
Parameters
reself
A logical variable. If
True
, an instance of the object will be returned to the calling routine upon exit. The default value isFalse
.Returns
The object self if
reself = True
otherwise,None
. However, this method causes side-effects by manipulating the existing attributes of the object.NOTE
This method causes side-effects by manipulating the existing attributes of the object.
-
helpme
(self, topic=None)[source]¶ Print the documentation for the input string topic. If the topic does not exist, the documentation for the object will be printed.
Parameters
topic (optional)
A string containing the name of the object for which help is needed.
Returns
None
Example
1 2 3 4
helpme() helpme("make") helpme("helpme") helpme("getLogLinSpace")