plotnine.facets.facet.facet
facet(="fixed",
scales=True,
shrink="label_value",
labeller=True,
as_table=True,
dropdir="h"
)
Base class for all facets
Parameters
scales : Literal["fixed", "free", "free_x", "free_y"] = "fixed"
-
Whether
x
ory
scales should be allowed (free) to vary according to the data on each of the panel. shrink : bool = True
-
Whether to shrink the scales to the output of the statistics instead of the raw data. Default is
True
. labeller : CanBeStripLabellingFunc = "label_value"
-
How to label the facets. A string value if it should be one of
["label_value", "label_both", "label_context"]
. as_table : bool = True
-
If
True
, the facets are laid out like a table with the highest values at the bottom-right. IfFalse
the facets are laid out like a plot with the highest value a the top-right drop : bool = True
-
If
True
, all factor levels not used in the data will automatically be dropped. IfFalse
, all factor levels will be shown, regardless of whether or not they appear in the data. dir : Literal["h", "v"] = "h"
-
Direction in which to layout the panels.
h
for horizontal andv
for vertical.
Methods
Name | Description |
---|---|
compute_layout | Compute layout |
finish_data | Modify data before it is drawn out by the geom |
make_figure | Create and return Matplotlib figure and subplot axes |
make_strips | Create strips for the facet |
map | Assign a data points to panels |
set_limits_breaks_and_labels | Add limits, breaks and labels to the axes |
setup_data | Allow the facet to manipulate the data |
setup_params | Create facet parameters |
train_position_scales | Compute ranges for the x and y scales |
compute_layout
compute_layout(data)
Compute layout
Parameters
finish_data
finish_data(data, layout)
Modify data before it is drawn out by the geom
The default is to return the data without modification. Subclasses should override this method as the require.
Parameters
Returns
make_figure
make_figure()
Create and return Matplotlib figure and subplot axes
make_strips
make_strips(layout_info, ax)
Create strips for the facet
Parameters
layout_info : layout_details
-
Layout information. Row from the layout table
ax : Axes
-
Axes to label
map
map(data, layout)
Assign a data points to panels
Parameters
Returns
set_limits_breaks_and_labels
set_limits_breaks_and_labels(panel_params, ax)
Add limits, breaks and labels to the axes
Parameters
panel_params : panel_view
-
range information for the axes
ax : Axes
-
Axes
setup_data
setup_data(data)
Allow the facet to manipulate the data
Parameters
Returns
Notes
This method will be called after setup_params
, therefore the params
property will be set.
setup_params
setup_params(data)
Create facet parameters
Parameters
train_position_scales
train_position_scales(layout, layers)
Compute ranges for the x and y scales