plotnine.coords.coord.coord

coord()

Base class for all coordinate systems

Attributes

Name Description
is_linear bool(x) -> bool

is_linear

is_linear = 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.

Methods

Name Description
aspect Return desired aspect ratio for the plot
backtransform_range Backtransform the panel range in panel_params to data coordinates
labels Modify labels
range Return the range along the dimensions of the coordinate system
setup_data Allow the coordinate system to manipulate the layer data
setup_layout Allow the coordinate system alter the layout dataframe
setup_panel_params Compute the range and break information for the panel
setup_params Create additional parameters
transform Transform data before it is plotted

aspect

aspect(panel_params)

Return desired aspect ratio for the plot

If not overridden by the subclass, this method returns None, which means that the coordinate system does not influence the aspect ratio.

backtransform_range

backtransform_range(panel_params)

Backtransform the panel range in panel_params to data coordinates

Coordinate systems that do any transformations should override this method. e.g. coord_trans has to override this method.

labels

labels(cur_labels)

Modify labels

Parameters

cur_labels : labels_view

Current labels. The coord can modify them as necessary.

Returns

labels_view

Modified labels. Same object as the input.

range

range(panel_params)

Return the range along the dimensions of the coordinate system

setup_data

setup_data(data)

Allow the coordinate system to manipulate the layer data

Parameters

data : list[pd.DataFrame]

Data for alls Layer

Returns

list[pd.DataFrame]

Modified layer data

setup_layout

setup_layout(layout)

Allow the coordinate system alter the layout dataframe

Parameters

layout : pd.DataFrame

Dataframe in which data is assigned to panels and scales

Returns

pd.DataFrame

layout dataframe altered to according to the requirements of the coordinate system.

Notes

The input dataframe may be changed.

setup_panel_params

setup_panel_params(scale_x, scale_y)

Compute the range and break information for the panel

setup_params

setup_params(data)

Create additional parameters

A coordinate system may need to create parameters depending on the original data that the layers get.

Parameters

data : list[pd.DataFrame]

Data for each layer before it is manipulated in any way.

transform

transform(data, panel_params, munch=False)

Transform data before it is plotted

This is used to “transform the coordinate axes”. Subclasses should override this method