plotnine.guides.guide.guide

guide(
    title=None,
    theme=Theme(),
    position=None,
    direction=None,
    reverse=False,
    order=0
)

Base class for all guides

Parameter Attributes

title: Optional[str] = None

Title of the guide. Default is the name of the aesthetic or the name specified using lab

theme: Theme = field(default_factory=Theme)

A theme to style the guide. If None, the plots theme is used.

position: Optional[LegendPosition] = None

Where to place the guide relative to the panels.

direction: Optional[Orientation] = None

Direction of the guide. The default is depends on legend_position.

reverse: bool = False

Whether to reverse the order of the legend keys.

order: int = 0

Order of this guide among multiple guides.

Notes

At the moment not all parameters have been fully implemented.

Methods

Name Description
create_geoms Create layers of geoms for the guide
draw Draw guide
legend_aesthetics Return the aesthetics that contribute to the legend
setup Setup guide for drawing process
train Create the key for the guide

create_geoms

create_geoms()

Create layers of geoms for the guide

Returns

Optional[Self]

self if geom layers were create or None of no geom layers were created.

draw

draw()

Draw guide

legend_aesthetics

legend_aesthetics(layer)

Return the aesthetics that contribute to the legend

Parameters

layer : Layer

Layer whose legend is to be drawn

Returns

matched : list

List of the names of the aethetics that contribute to the legend.

setup

setup(guides)

Setup guide for drawing process

train

train(scale, aesthetic=None)

Create the key for the guide

Returns guide if training is successful