plotnine.composition.Compose
Compose(items)Base class for those that create plot compositions
As a user, you will never directly work with this class, except through the operators that it makes possible. The operators are of two kinds:
1. Composing Operators
The combine plots or compositions into a single composition. Both operands are either a plot or a composition.
2. Plot Modifying Operators
The modify all or some of the plots in a composition. The left operand is a composition and the right operand is a plotaddable; any object that can be added to a ggplot object e.g. geoms, stats, themes, facets, … .
&-
Add right hand side to all plots in the composition.
*-
Add right hand side to all plots in the top-most nesting level of the composition.
+-
Add right hand side to the last plot in the composition.
Parameter Attributes
See Also
Beside-
To arrange plots side by side
Stack-
To arrange plots vertically
Stack-
To arrange in a grid
plot_spacer-
To add a blank space between plots
Methods
| Name | Description |
|---|---|
| draw | Render the arranged plots |
| save | Save a composition as an image file |
| show | Display plot in the cells output |
draw
draw(*, show=False)Render the arranged plots
Parameters
show : bool = False-
Whether to show the plot.
Returns
Figure-
Matplotlib figure
save
save(filename, format=None, dpi=None, **kwargs)Save a composition as an image file
Parameters
filename : str | Path | BytesIO-
File name to write the plot to. If not specified, a name
format : str | None = None-
Image format to use, automatically extract from file name extension.
dpi : int | None = None-
DPI to use for raster graphics. If None, defaults to using the
dpiof theme to the first plot. **kwargs-
These are ignored. Here to “softly” match the API of
ggplot.save().
show
show()Display plot in the cells output
This function is called for its side-effects.