plotnine.facets.facet_wrap¶
- class plotnine.facets.facet_wrap(facets: str | list[str], *, nrow: Optional[int] = None, ncol: Optional[int] = None, scales: Literal['fixed', 'free', 'free_x', 'free_y'] = 'fixed', shrink: bool = True, labeller: Literal['label_value', 'label_both', 'label_context'] = 'label_value', as_table: bool = True, drop: bool = True, dir: Literal['h', 'v'] = 'h')[source]¶
Wrap 1D Panels onto 2D surface
- Parameters
- facets
formula
|python:tuple
|python:list
Variables to groupby and plot on different panels. If a formula is used it should be right sided, e.g
'~ a + b'
,('a', 'b')
- nrow
python:int
, optional Number of rows
- ncol
python:int
, optional Number of columns
- scales
python:str
in
['fixed', 'free', 'free_x', 'free_y']
Whether
x
ory
scales should be allowed (free) to vary according to the data on each of the panel. Default is'fixed'
.- shrinkbool
Whether to shrink the scales to the output of the statistics instead of the raw data. Default is
True
.- labeller
python:str
|function
How to label the facets. If it is a
str
, it should be one of'label_value'
'label_both'
or'label_context'
. Default is'label_value'
- as_tablebool
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. Default itTrue
.- dropbool
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. Default isTrue
.- dir
python:str
in
['h', 'v']
Direction in which to layout the panels.
h
for horizontal andv
for vertical.
- facets