pylbo.visualisation.legend_handler

Classes

LegendHandler

Main handler for legend stuff.

Functions

_get_legend_handles(legend)

Returns the legend handles.

Module Contents

pylbo.visualisation.legend_handler._get_legend_handles(legend)

Returns the legend handles.

Parameters:

legend (Legend) – The matplotlib legend to use.

Returns:

handles – A list of handles.

Return type:

list

class pylbo.visualisation.legend_handler.LegendHandler(interactive)

Main handler for legend stuff.

legend

The matplotlib legend to use.

Type:

Legend

alpha_point

Alpha value for non-hidden lines or points.

Type:

int, float

alpha_region

Alpha value for non-hidden regions.

Type:

int, float

alpha_hidden

Alpha value for hidden artists.

Type:

int, float

marker

The marker to use for points.

Type:

markers

markersize

Size of the marker.

Type:

int, float

pickradius

Radius around pickable items so pickevents are triggered.

Type:

int, float

linewidth

Width of drawn lines.

Type:

int, float

legend_properties

Additional properties used when setting the legend.

Type:

dict

interactive

If True, makes the legend interactive

Type:

bool

autoscale

If True, will check if autoscale is needed when clicking the legend.

Type:

bool

legend = None
alpha_point = 0.8
alpha_region = 0.2
alpha_hidden = 0.05
marker = 'p'
markersize = 64
pickradius = 10
linewidth = 2
legend_properties
interactive
autoscale = False
_drawn_items = []
_legend_mapping
_make_visible_by_default = False
on_legend_pick(event)

Determines what happens when the legend gets picked.

Parameters:

event (PickEvent) – The matplotlib pick event.

make_legend_pickable()

Makes the legend pickable, only used if interactive.

add(item)

Adds an item to the list of drawn items on the canvas.

Parameters:

item (object) – A single object, usually a return from the matplotlib plot or scatter methods.

_check_autoscaling()

Checks if autoscaling is needed and if so, rescales the y-axis to the min-max value of the currently visible legend items.