plotnine.positions.position.position

position()

Base class for all positions

Methods

Name Description
collide Calculate boundaries of geometry object
collide2 Calculate boundaries of geometry object
compute_layer Compute position for the layer in all panels
compute_panel Positions must override this function
from_geom Create and return a position object for the geom
setup_data Verify & return data
setup_params Verify, modify & return a copy of the params.
strategy Calculate boundaries of geometry object
transform_position Transform all the variables that map onto the x and y scales.

collide

collide(data, params)

Calculate boundaries of geometry object

Uses Strategy

collide2

collide2(data, params)

Calculate boundaries of geometry object

Uses Strategy

compute_layer

compute_layer(data, params, layout)

Compute position for the layer in all panels

Positions can override this function instead of compute_panel if the position computations are independent of the panel. i.e when not colliding

compute_panel

compute_panel(data, scales, params)

Positions must override this function

Notes

Make necessary adjustments to the columns in the dataframe.

Create the position transformation functions and use self.transform_position() do the rest.

See Also

compute_panel

from_geom

from_geom(geom)

Create and return a position object for the geom

Parameters

geom : geom

An instantiated geom object.

Returns

out : position

A position object

Raises

PlotnineError

If unable to create a position.

setup_data

setup_data(data, params)

Verify & return data

setup_params

setup_params(data)

Verify, modify & return a copy of the params.

strategy

strategy(data, params)

Calculate boundaries of geometry object

transform_position

transform_position(data, trans_x=None, trans_y=None)

Transform all the variables that map onto the x and y scales.

Parameters

data : dataframe

Data to transform

trans_x : callable = None

Transforms x scale mappings Takes one argument, either a scalar or an array-type

trans_y : callable = None

Transforms y scale mappings Takes one argument, either a scalar or an array-type