plotnine.facet_grid
facet_grid(
rows=None,
cols=None,
*,
margins=False,
scales="fixed",
space="fixed",
shrink=True,
labeller="label_value",
as_table=True,
drop=True
)Wrap 1D Panels onto 2D surface
Parameters
rows : Optional[str | Sequence[str]] = None-
Variable expressions along the rows of the facets/panels. Each expression is evaluated within the context of the dataframe.
cols : Optional[str | Sequence[str]] = None-
Variable expressions along the columns of the facets/panels. Each expression is evaluated within the context of the dataframe.
margins : bool | Sequence[str] = False-
variable names to compute margins for. True will compute all possible margins.
space : Literal["fixed", "free", "free_x", "free_y"] | FacetSpaceRatios = "fixed"-
Control the size of the
xorysides of the panels. The size also depends to thescalesparameter.If a string, it should be one of
['fixed', 'free', 'free_x', 'free_y'].If a
dict, it indicates the relative facet size ratios such as:{"x": [1, 2], "y": [3, 1, 1]}This means that in the horizontal direction, the second panel will be twice the length of the first. In the vertical direction the top facet will be the 3 times longer then the second and third facets.
Note that the number of dimensions in the list must equal the number of facets that will be produced.
shrink : bool = True-
Whether to shrink the scales to the output of the statistics instead of the raw data.
labeller : Literal["label_value", "label_both", "label_context"] = "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. IfFalsethe 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.