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

bool(x) -> bool

Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.

order: int = 0

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by ‘+’ or ‘-’ and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal. >>> int(‘0b100’, base=0) 4

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