seaborn.objects.Plot#
- class seaborn.objects.Plot(*args, data=None, x=None, y=None, color=None, alpha=None, fill=None, marker=None, pointsize=None, stroke=None, linewidth=None, linestyle=None, fillcolor=None, fillalpha=None, edgewidth=None, edgestyle=None, edgecolor=None, edgealpha=None, text=None, halign=None, valign=None, offset=None, fontsize=None, xmin=None, xmax=None, ymin=None, ymax=None, group=None)#
An interface for declaratively specifying statistical graphics.
Plots are constructed by initializing this class and adding one or more layers, comprising a
Mark
and optionalStat
orMove
. Additionally, faceting variables or variable pairings may be defined to divide the space into multiple subplots. The mappings from data values to visual properties can be parametrized using scales, although the plot will try to infer good defaults when scales are not explicitly defined.The constructor accepts a data source (a
pandas.DataFrame
or dictionary with columnar values) and variable assignments. Variables can be passed as keys to the data source or directly as data vectors. If multiple data-containing objects are provided, they will be index-aligned.The data source and variables defined in the constructor will be used for all layers in the plot, unless overridden or disabled when adding a layer.
- The following variables can be defined in the constructor:
x, y, color, alpha, fill, marker, pointsize, stroke, linewidth, linestyle, fillcolor, fillalpha, edgewidth, edgestyle, edgecolor, edgealpha, text, halign, valign, offset, fontsize, xmin, xmax, ymin, ymax, group
The
data
,x
, andy
variables can be passed as positional arguments or using keywords. Whether the first positional argument is interpreted as a data source orx
variable depends on its type.The methods of this class return a copy of the instance; use chaining to build up a plot through multiple calls. Methods can be called in any order.
Most methods only add information to the plot spec; no actual processing happens until the plot is shown or saved. It is also possible to compile the plot without rendering it to access the lower-level representation.
Specification methods
Specify a layer of the visualization in terms of mark and data transform(s).
Specify mappings from data units to visual properties.
Subplot methods
Produce subplots with conditional subsets of the data.
Produce subplots by pairing multiple
x
and/ory
variables.Customization methods
Control the figure size and layout.
Control the labels and titles for axes, legends, and subplots.
Control the range of visible data.
Control sharing of axis limits and ticks across subplots.
Control the default appearance of elements in the plot.
Integration methods
Provide existing Matplotlib figure or axes for drawing the plot.
Output methods
Compile the plot spec and return the Plotter object.
Compile the plot and write it to a buffer or file on disk.
Compile the plot and display it by hooking into pyplot.