# TernaryAxesSubplotPoisson¶

class poisson_approval.TernaryAxesSubplotPoisson(scale=None, size_inches='auto', **kwargs)[source]

Subclass of TernaryAxesSubplot, defined in the package python-ternary.

This class implements some additional methods for Poisson Approval. For some examples, cf. the tutorial in section “Meta-Analysis”.

annotate_condorcet(right_order, top_order, left_order, d_order_fixed_share=None)[source]

Annotate who is the Condorcet winner depending on the region.

We consider a simplex where:

• Fixed shares of voters have preference orders given by d_order_fixed_share.
• The remaining voters are split between right_order, top_order and left_order in proportions that are given by the point in the simplex.

This method annotates the regions according to which candidate is the Condorcet winner, and indicates where no one is the Condorcet winner.

If there are weak orders and/or fixed shares of voters, the method may not work on all distributions because it relies on an external package called shapely. If there are rankings only and no fixed shares of voters, it is supposed to work on all distributions.

Parameters: right_order (str) – The order whose share is maximal at the right corner. top_order (str) – The order whose share is maximal at the top corner. left_order (str) – The order whose share is maximal at the left corner. d_order_fixed_share (dict, optional) – Key: order. Value: a fixed share of voters in [0, 1].
annotate_simplex(text, position, horizontalalignment='center', verticalalignment='center', **kwargs)[source]

• The input position is in the simplex (instead of the scaled simplex), i.e. coordinates are in [0, 1].
• The default horizontal and vertical alignments are centered.
Parameters: annotate in python-ternary. (Cf.) –
gridlines_simplex(multiple=None, horizontal_kwargs=None, left_kwargs=None, right_kwargs=None, **kwargs)[source]

• The argument multiple is a grid step in [0, 1] (instead of [0, scale]).
Parameters: gridlines in python-ternary. (Cf.) –
heatmap_candidates(func, right_label, top_label, left_label, legend_title='', legend_style='palette', style='hexagonal', colorbar=False, **kwargs)[source]

Heatmap of a function from the simplex to 3D vectors.

Parameters: func (callable) – The function to plot. Input: coordinates right, top, left in the simplex, i.e. that sum to 1. Output: a list of 3 numbers between 0 and 1. right_label (str) – Label of the right corner. top_label (str) – Label of the top corner. left_label (str) – Label of the left corner. legend_title (str) – Title of the legend. legend_style (str) – The style of the legend. The two available options are 'palette' and 'color_patches'. Cf. legend_palette() and legend_color_patches(). style – Contrarily to default settings in python-ternary, the default is 'hexagonal'. colorbar – Contrarily to default settings in python-ternary, the default is False. kwargs – All other keywords arguments are passed to method heatmap of python-ternary.
heatmap_intensity(func, right_label, top_label, left_label, style='hexagonal', cmap='plasma', **kwargs)[source]

Parameters: func (callable) – The function to plot. Input: coordinates right, top, left in the simplex, i.e. that sum to 1. Output: a number. right_label (str) – Label of the right corner. top_label (str) – Label of the top corner. left_label (str) – Label of the left corner. style (str) – Contrarily to default settings in python-ternary, the default is 'hexagonal'. cmap (str) – Colormap. Contrarily to default settings in python-ternary, the default is 'plasma'. kwargs – All other keywords arguments are passed to method heatmapf of python-ternary.
horizontal_line_simplex(i, color='black', **kwargs)[source]

• The argument i is in [0, 1] (instead of [0, scale]).
Parameters: horizontal_line in python-ternary. (Cf.) –
left_parallel_line_simplex(i, color='black', **kwargs)[source]

• The argument i is in [0, 1] (instead of [0, scale]).
Parameters: left_parallel_line in python-ternary. (Cf.) –
legend_color_patches(title, all_mixes=False, data=None)[source]

Add a “color patches” legend to the current figure (for candidates heat maps).

Parameters: title (str) – Title of the legend. all_mixes (bool) – If True, then all mixes are indicated in the legend: a + b, a + c, b + c and a + b + c. data (dict, optional) – Key : anything. Value: a tuple, list, etc giving an RGB or RGBA code. This is used only if all_mixes is False.

Notes

• The color patches for single candidates a, b, c are in the legend anyway.
• If all_mixes is True, then all mixes are indicated in the legend.
• If all_mixes is False and data is given, then if at least a value is close to a perfect mix (like half of a and half of b), then this mix is added to the legend.
static legend_palette(title)[source]

Add a “palette” legend to the current figure (for candidates heat maps).

Parameters: title (str) – Title of the legend.

Notes

This is rather a hack than a real matplotlib legend. Hence the usual commands to choose the position of the legend, for example, are not meant to work here.

line_simplex(p1, p2, color='black', **kwargs)[source]

• The input positions are in the simplex (instead of the scaled simplex), i.e. coordinates are in [0, 1].
Parameters: line in python-ternary. (Cf.) –
right_parallel_line_simplex(i, color='black', **kwargs)[source]

set_title_padded(title, **kwargs)[source]