KEMBAR78
Seaborn API Reference: Relational Plots | PDF | Scatter Plot | Regression Analysis
0% found this document useful (0 votes)
21 views7 pages

Seaborn API Reference: Relational Plots

Uploaded by

datachamp121
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views7 pages

Seaborn API Reference: Relational Plots

Uploaded by

datachamp121
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Seaborn API reference¶

Relational plots
relplot Figure-level interface for drawing relational plots onto a FacetGrid.
scatterplot Draw a scatter plot with possibility of several semantic groupings.
lineplot Draw a line plot with possibility of several semantic groupings.

Distribution plots
displot Figure-level interface for drawing distribution plots onto a FacetGrid.
histplot Plot univariate or bivariate histograms to show distributions of datasets.
kdeplot Plot univariate or bivariate distributions using kernel density estimation.
ecdfplot Plot empirical cumulative distribution functions.
rugplot Plot marginal distributions by drawing ticks along the x and y axes.
distplot DEPRECATED: Flexibly plot a univariate distribution of observations.

Categorical plots
catplot Figure-level interface for drawing categorical plots onto a FacetGrid.
stripplot Draw a scatterplot where one variable is categorical.
swarmplot Draw a categorical scatterplot with non-overlapping points.
boxplot Draw a box plot to show distributions with respect to categories.
violinplot Draw a combination of boxplot and kernel density estimate.
boxenplot Draw an enhanced box plot for larger datasets.
pointplot Show point estimates and confidence intervals using scatter plot glyphs.
barplot Show point estimates and confidence intervals as rectangular bars.
countplot Show the counts of observations in each categorical bin using bars.

Regression plots
lmplot Plot data and regression model fits across a FacetGrid.
regplot Plot data and a linear regression model fit.
residplot Plot the residuals of a linear regression.

Matrix plots
heatmap Plot rectangular data as a color-encoded matrix.
clustermap Plot a matrix dataset as a hierarchically-clustered heatmap.

Multi-plot grids
Facet grids
FacetGrid Multi-plot grid for plotting conditional relationships.

Pair grids
pairplot Plot pairwise relationships in a dataset.
PairGrid Subplot grid for plotting pairwise relationships in a dataset.

Joint grids
jointplot Draw a plot of two variables with bivariate and univariate graphs.
JointGrid Grid for drawing a bivariate plot with marginal univariate plots.

Themeing
set_theme Set aspects of the visual theme for all matplotlib and seaborn plots.
axes_style Get the parameters that control the general style of the plots.
set_style Set the parameters that control the general style of the plots.
plotting_context Get the parameters that control the scaling of plot elements.
set_context Set the parameters that control the scaling of plot elements.
set_color_codes Change how matplotlib color shorthands are interpreted.
reset_defaults Restore all RC params to default settings.
reset_orig Restore all RC params to original settings (respects custom rc).
set Alias for set_theme(), which is the preferred interface.

Color palettes
set_palette Set the matplotlib color cycle using a seaborn palette.
color_palette Return a list of colors or continuous colormap defining a palette.
husl_palette Get a set of evenly spaced colors in HUSL hue space.
hls_palette Get a set of evenly spaced colors in HLS hue space.
cubehelix_palette Make a sequential palette from the cubehelix system.
dark_palette Make a sequential palette that blends from dark to color.
light_palette Make a sequential palette that blends from light to color.
diverging_palette Make a diverging palette between two HUSL colors.
blend_palette Make a palette that blends between a list of colors.
xkcd_palette Make a palette with color names from the xkcd color survey.
crayon_palette Make a palette with color names from Crayola crayons.
mpl_palette Return discrete colors from a matplotlib palette.

Palette widgets
choose_colorbrewer_palette Select a palette from the ColorBrewer set.
choose_cubehelix_palette Launch an interactive widget to create a sequential cubeheli
choose_light_palette Launch an interactive widget to create a light sequential pale
choose_dark_palette Launch an interactive widget to create a dark sequential pale
choose_diverging_palette Launch an interactive widget to choose a diverging color pa

Utility functions
despine Remove the top and right spines from plot(s).
move_legend Recreate a plot’s legend at a new location.
saturate Return a fully saturated color with the same hue.
desaturate Decrease the saturation channel of a color by some percent.
set_hls_values Independently manipulate the h, l, or s channels of a color.
load_dataset Load an example dataset from the online repository (requires internet).
get_dataset_names Report available example datasets, useful for reporting issues.
get_data_home Return a path to the cache directory for example datasets.

Matplot API Overview¶


 Usage patterns
o The pyplot API
o The object-oriented API
o The pylab API (disapproved)
 Modules
 Toolkits

See also the API Changes.

Usage patterns
Below we describe several common approaches to plotting with Matplotlib.
The pyplot API
matplotlib.pyplot is a collection of command style functions that make Matplotlib work like
MATLAB. Each pyplot function makes some change to a figure: e.g., creates a figure, creates a
plotting area in a figure, plots some lines in a plotting area, decorates the plot with labels, etc.

pyplot is mainly intended for interactive plots and simple cases of programmatic plot generation.

Further reading:

 The matplotlib.pyplot function reference


 Pyplot tutorial
 Pyplot examples

The object-oriented API


At its core, Matplotlib is object-oriented. We recommend directly working with the objects, if you
need more control and customization of your plots.

In many cases you will create a Figure and one or more Axes using pyplot.subplots and from
then on only work on these objects. However, it's also possible to create Figures explicitly (e.g.
when including them in GUI applications).

Further reading:

 matplotlib.axes.Axes and matplotlib.figure.Figure for an overview of plotting


functions.
 Most of the examples use the object-oriented approach (except for the pyplot section)

The pylab API (disapproved)


Warning
Since heavily importing into the global namespace may result in unexpected behavior, the use of
pylab is strongly discouraged. Use matplotlib.pyplot instead.

pylab is a module that


includes matplotlib.pyplot, numpy, numpy.fft, numpy.linalg, numpy.random, and some
additional functions, all within a single namespace. Its original purpose was to mimic a MATLAB-like
way of working by importing all functions into the global namespace. This is considered bad style
nowadays.

Modules
Matplotlib consists of the following submodules:

 matplotlib
 matplotlib.afm
 matplotlib.animation
 matplotlib.artist
 matplotlib.axes
 matplotlib.axis
 matplotlib.backend_bases
 matplotlib.backend_managers
 matplotlib.backend_tools
 matplotlib.backends
 matplotlib.bezier
 matplotlib.blocking_input
 matplotlib.category
 matplotlib.cbook
 matplotlib.cm
 matplotlib.collections
 matplotlib.colorbar
 matplotlib.colors
 matplotlib.container
 matplotlib.contour
 matplotlib.dates
 matplotlib.docstring
 matplotlib.dviread
 matplotlib.figure
 matplotlib.font_manager
 matplotlib.fontconfig_pattern
 matplotlib.gridspec
 matplotlib.image
 matplotlib.legend
 matplotlib.legend_handler
 matplotlib.lines
 matplotlib.markers
 matplotlib.mathtext
 matplotlib.mlab
 matplotlib.offsetbox
 matplotlib.patches
 matplotlib.path
 matplotlib.patheffects
 matplotlib.pyplot
 matplotlib.projections
 matplotlib.projections.polar
 matplotlib.quiver
 matplotlib.rcsetup
 matplotlib.sankey
 matplotlib.scale
 matplotlib.sphinxext.plot_directive
 matplotlib.spines
 matplotlib.style
 matplotlib.table
 matplotlib.testing
 matplotlib.text
 matplotlib.texmanager
 matplotlib.textpath
 matplotlib.ticker
 matplotlib.tight_bbox
 matplotlib.tight_layout
 matplotlib.transforms
 matplotlib.tri
 matplotlib.type1font
 matplotlib.units
 matplotlib.widgets
 matplotlib._api
 matplotlib._enums
Toolkits
Toolkits are collections of application-specific functions that extend Matplotlib. The following toolkits
are included:

 mplot3d API
 Matplotlib axes_grid1 Toolkit
 Matplotlib axisartist Toolkit
 Matplotlib axes_grid Toolkit

You might also like