skcriteria.core.plot module

Plot helper for the DecisionMatrix object.

class skcriteria.core.plot.DecisionMatrixPlotter(dm)[source]

Bases: AccessorABC

DecisionMatrix plot utilities.

Kind of plot to produce:

  • ‘heatmap’ : criteria heat-map (default).

  • ‘wheatmap’ : weights heat-map.

  • ‘bar’ : criteria vertical bar plot.

  • ‘wbar’ : weights vertical bar plot.

  • ‘barh’ : criteria horizontal bar plot.

  • ‘wbarh’ : weights horizontal bar plot.

  • ‘hist’ : criteria histogram.

  • ‘whist’ : weights histogram.

  • ‘box’ : criteria boxplot.

  • ‘wbox’ : weights boxplot.

  • ‘kde’ : criteria Kernel Density Estimation plot.

  • ‘wkde’ : weights Kernel Density Estimation plot.

  • ‘ogive’ : criteria empirical cumulative distribution plot.

  • ‘wogive’ : weights empirical cumulative distribution plot.

  • ‘area’ : criteria area plot.

  • ‘dominance’: the dominance matrix as a heatmap.

  • ‘frontier’: criteria pair-wise Pareto-Frontier.

heatmap(**kwargs)[source]

Plot the alternative matrix as a color-encoded matrix.

Parameters

**kwargs – Additional keyword arguments are passed and are documented in seaborn.heatmap.

Return type

matplotlib.axes.Axes or numpy.ndarray of them

wheatmap(**kwargs)[source]

Plot weights as a color-encoded matrix.

Parameters

**kwargs – Additional keyword arguments are passed and are documented in seaborn.heatmap.

Return type

matplotlib.axes.Axes or numpy.ndarray of them

bar(**kwargs)[source]

Criteria vertical bar plot.

A bar plot is a plot that presents categorical data with rectangular bars with lengths proportional to the values that they represent. A bar plot shows comparisons among discrete categories. One axis of the plot shows the specific categories being compared, and the other axis represents a measured value.

Parameters

**kwargs – Additional keyword arguments are passed and are documented in DataFrame.plot.bar.

Return type

matplotlib.axes.Axes or numpy.ndarray of them

wbar(**kwargs)[source]

Weights vertical bar plot.

A bar plot is a plot that presents categorical data with rectangular bars with lengths proportional to the values that they represent. A bar plot shows comparisons among discrete categories. One axis of the plot shows the specific categories being compared, and the other axis represents a measured value.

Parameters

**kwargs – Additional keyword arguments are passed and are documented in DataFrame.plot.bar.

Return type

matplotlib.axes.Axes or numpy.ndarray of them

barh(**kwargs)[source]

Criteria horizontal bar plot.

A bar plot is a plot that presents categorical data with rectangular bars with lengths proportional to the values that they represent. A bar plot shows comparisons among discrete categories. One axis of the plot shows the specific categories being compared, and the other axis represents a measured value.

Parameters

**kwargs – Additional keyword arguments are passed and are documented in DataFrame.plot.barh.

Return type

matplotlib.axes.Axes or numpy.ndarray of them

wbarh(**kwargs)[source]

Weights horizontal bar plot.

A bar plot is a plot that presents categorical data with rectangular bars with lengths proportional to the values that they represent. A bar plot shows comparisons among discrete categories. One axis of the plot shows the specific categories being compared, and the other axis represents a measured value.

Parameters

**kwargs – Additional keyword arguments are passed and are documented in DataFrame.plot.barh.

Return type

matplotlib.axes.Axes or numpy.ndarray of them

hist(**kwargs)[source]

Draw one histogram of the criteria.

A histogram is a representation of the distribution of data. This function groups the values of all given Series in the DataFrame into bins and draws all bins in one matplotlib.axes.Axes.

Parameters

**kwargs – Additional keyword arguments are passed and are documented in seaborn.histplot.

Return type

matplotlib.axes.Axes or numpy.ndarray of them

whist(**kwargs)[source]

Draw one histogram of the weights.

A histogram is a representation of the distribution of data. This function groups the values of all given Series in the DataFrame into bins and draws all bins in one matplotlib.axes.Axes.

Parameters

**kwargs – Additional keyword arguments are passed and are documented in seaborn.histplot.

Return type

matplotlib.axes.Axes or numpy.ndarray of them

box(**kwargs)[source]

Make a box plot of the criteria.

A box plot is a method for graphically depicting groups of numerical data through their quartiles.

For further details see Wikipedia’s entry for boxplot.

Parameters

**kwargs – Additional keyword arguments are passed and are documented in seaborn.boxplot.

Return type

matplotlib.axes.Axes or numpy.ndarray of them

wbox(**kwargs)[source]

Make a box plot of the weights.

A box plot is a method for graphically depicting groups of numerical data through their quartiles.

For further details see Wikipedia’s entry for boxplot.

Parameters

**kwargs – Additional keyword arguments are passed and are documented in seaborn.boxplot.

Return type

matplotlib.axes.Axes or numpy.ndarray of them

kde(**kwargs)[source]

Criteria kernel density plot using Gaussian kernels.

In statistics, kernel density estimation (KDE) is a non-parametric way to estimate the probability density function (PDF) of a random variable. This function uses Gaussian kernels and includes automatic bandwidth determination.

Parameters

**kwargs – Additional keyword arguments are passed and are documented in seaborn.kdeplot.

Return type

matplotlib.axes.Axes or numpy.ndarray of them

wkde(**kwargs)[source]

Weights kernel density plot using Gaussian kernels.

In statistics, kernel density estimation (KDE) is a non-parametric way to estimate the probability density function (PDF) of a random variable. This function uses Gaussian kernels and includes automatic bandwidth determination.

Parameters

**kwargs – Additional keyword arguments are passed and are documented in seaborn.kdeplot.

Return type

matplotlib.axes.Axes or numpy.ndarray of them

ogive(**kwargs)[source]

Criteria empirical cumulative distribution plot.

In statistics, an empirical distribution function (eCDF) is the distribution function associated with the empirical measure of a sample. This cumulative distribution function is a step function that jumps up by 1/n at each of the n data points. Its value at any specified value of the measured variable is the fraction of observations of the measured variable that are less than or equal to the specified value.

Parameters

**kwargs – Additional keyword arguments are passed and are documented in seaborn.ecdfplot.

Return type

matplotlib.axes.Axes or numpy.ndarray of them

wogive(**kwargs)[source]

Weights empirical cumulative distribution plot.

In statistics, an empirical distribution function (eCDF) is the distribution function associated with the empirical measure of a sample. This cumulative distribution function is a step function that jumps up by 1/n at each of the n data points. Its value at any specified value of the measured variable is the fraction of observations of the measured variable that are less than or equal to the specified value.

Parameters

**kwargs – Additional keyword arguments are passed and are documented in seaborn.ecdfplot.

Return type

matplotlib.axes.Axes or numpy.ndarray of them

area(**kwargs)[source]

Draw an criteria stacked area plot.

An area plot displays quantitative data visually. This function wraps the matplotlib area function.

Parameters

**kwargs – Additional keyword arguments are passed and are documented in DataFrame.plot.area().

Returns

Area plot, or array of area plots if subplots is True.

Return type

matplotlib.axes.Axes or numpy.ndarray

dominance(*, strict=False, **kwargs)[source]

Plot dominance as a color-encoded matrix.

In order to evaluate the dominance of an alternative a0 over an alternative a1, the algorithm evaluates that a0 is better in at least one criterion and that a1 is not better in any criterion than a0. In the case that strict = True it also evaluates that there are no equal criteria.

Parameters
  • strict (bool, default False) – If True, strict dominance is evaluated.

  • **kwargs – Additional keyword arguments are passed and are documented in seaborn.heatmap.

Return type

matplotlib.axes.Axes or numpy.ndarray of them

frontier(x, y, *, strict=False, ax=None, legend=True, scatter_kws=None, line_kws=None)[source]

Pareto frontier on two arbitrarily selected criteria.

A selection of an alternative of an $A_o$ is a pareto-optimal solution when there is no other solution that selects an alternative that does not belong to $A_o$ such that it improves on one objective without worsening at least one of the others.

From this point of view, the concept is used to analyze the possible optimal options of a solution given a variety of objectives or desires and one or more evaluation criteria.

Given a “universe” of alternatives, one seeks to determine the set that are Pareto efficient (i.e., those alternatives that satisfy the condition of not being able to better satisfy one of those desires or objectives without worsening some other). That set of optimal alternatives establishes a “Pareto set” or the “Pareto Frontier”.

The study of the solutions in the frontier allows designers to analyze the possible alternatives within the established parameters, without having to analyze the totality of possible solutions.

Parameters
  • x (str) – Criteria names. Variables that specify positions on the x and y axes.

  • y (str) – Criteria names. Variables that specify positions on the x and y axes.

  • weighted (bool, default False) – If its True the domination analysis is performed over the weighted matrix.

  • strict (bool, default False) – If True, strict dominance is evaluated.

  • weighted – If True, the weighted matrix is evaluated.

  • ax (matplotlib.axes.Axes) – Pre-existing axes for the plot. Otherwise, call matplotlib.pyplot.gca internally.

  • legend (bool, default True) – If False, no legend data is added and no legend is drawn.

  • scatter_kws (dict, default None) – Additional parameters passed to seaborn.scatterplot.

  • scatter_kws – Additional parameters passed to seaborn.lineplot, except for estimator and sort.

Return type

matplotlib.axes.Axes or numpy.ndarray of them

References

[Wikipedia contributors, 2022b] [Wikipedia contributors, 2022a]