statys.plotters.critical

Critical difference-based plotting utilities. Note that is an improved version of the script provided by https://github.com/biolab/orange3.

statys.plotters.critical._calculate_plot_properties(sort_ranks: List[int], cd: float)

Calculates a set of properties used to accurately plot the statistical test.

Parameters
  • sort_ranks – List holding the sorted ranks.

  • cd – Critical difference.

Returns

Properties used in the plot’s construction.

Return type

(Tuple[int, float, float, int, float, float])

statys.plotters.critical._create_labels(size: Optional[int] = 1)

Creates a list of labels strings.

Parameters

size – Amount of strings to be created.

Returns

Stringed labels, e.g., x0, x1, …, xn.

Return type

(List[str])

statys.plotters.critical._get_amount_lines(ranks: List[int], cd: float)

Gets the amount of possible lines to create the plot.

Parameters
  • ranks – List of ranks.

  • cd – Critical difference.

Returns

Longest possible amount of lines.

Return type

(List[Tuple[Any, ..]])

statys.plotters.critical._get_element(input_list: List[Any], n: int)

Gets a specific element from a list of tuples.

Parameters
  • input_list – List to be iterated.

  • n – Element to be retrieved.

Returns

Only retrieved elements.

Return type

(List[Any])

statys.plotters.critical._line_factoring(line: List[float], factor: float)

Factors a line’s positioning.

Parameters
  • line – Lines to be factored.

  • factor – Factor to use in the factoring.

Returns

Factored lines.

Return type

(List[float])

statys.plotters.critical._multiple_range(input_list: List[Any])

Performs a multiple range, used to traverse matrices.

Parameters

input_list – List to be traversed.

Yields

(Tuple[Any, …]) – Iterator of tuples.

statys.plotters.critical._plot_line(ax: matplotlib.axis.Axis, input_list: List[Tuple[int, int]], width_factor: float, height_factor: float, color: Optional[str] = 'k', **kwargs)

Plots pairs of points as lines.

Parameters
  • ax – Axis to be plotted.

  • input_list – List of pairs of points.

  • width_factor – Width factor.

  • height_factor – Height factor.

  • color – Color to be plotted.

statys.plotters.critical._plot_text(ax: matplotlib.axis.Axis, x: int, y: int, s: str, width_factor: float, height_factor: float, **kwargs)

Plots a text on the desired position.

Parameters
  • ax – Axis to be plotted.

  • xx position to be plotted.

  • yy position to be plotted.

  • s – String to be plotted.

  • width_factor – Width factor.

  • height_factor – Height factor.

statys.plotters.critical._position_rank(index: int, low: int, high: int, text_spacing: int, scale: float, reverse: bool)

Positions a rank according to its value.

Parameters
  • index – Index to be positioned.

  • low – Minimum rank possible.

  • high – Maximum rank possible.

  • text_spacing – Text spacing inside the plot.

  • scale – Plot’s scale.

  • reverse – Whether plot should use ascending or descending order.

Returns

Rank should be positioned in the plot.

Return type

(int)

statys.plotters.critical._prepare_plot(width: float, height: float)

Prepares the plot prior to its use.

Parameters
  • width – Width of the plot.

  • height – Height of the plot.

Returns

Figure and axis properties from the plot.

Return type

(Tuple[Figure, Axis])

statys.plotters.critical.plot_critical_difference(cd_dict: Dict[str, Any], labels: Optional[List[str]] = None, width: Optional[int] = 6, text_spacing: Optional[int] = 2, reverse: Optional[bool] = False)

Plots the critical difference between the averaged ranks.

Parameters
  • cd_dict – Dictionary of average ranks and critical differences.

  • labels – List of stringed labels.

  • width – Plot’s width.

  • text_spacing – Text spacing inside the plot.

  • reverse – Whether plot should use ascending or descending order.