Initial configuration commit
This commit is contained in:
commit
31c8abea59
266 changed files with 780274 additions and 0 deletions
548
typings/seaborn/axisgrid.pyi
Normal file
548
typings/seaborn/axisgrid.pyi
Normal file
|
@ -0,0 +1,548 @@
|
|||
"""
|
||||
This type stub file was generated by pyright.
|
||||
"""
|
||||
|
||||
from ._decorators import _deprecate_positional_args
|
||||
|
||||
__all__ = ["FacetGrid", "PairGrid", "JointGrid", "pairplot", "jointplot"]
|
||||
_param_docs = ...
|
||||
class Grid:
|
||||
"""Base class for grids of subplots."""
|
||||
_margin_titles = ...
|
||||
_legend_out = ...
|
||||
def __init__(self) -> None:
|
||||
...
|
||||
|
||||
def set(self, **kwargs): # -> Self@Grid:
|
||||
"""Set attributes on each subplot Axes."""
|
||||
...
|
||||
|
||||
def savefig(self, *args, **kwargs): # -> None:
|
||||
"""Save the figure."""
|
||||
...
|
||||
|
||||
def tight_layout(self, *args, **kwargs): # -> None:
|
||||
"""Call fig.tight_layout within rect that exclude the legend."""
|
||||
...
|
||||
|
||||
def add_legend(self, legend_data=..., title=..., label_order=..., adjust_subtitles=..., **kwargs): # -> Self@Grid:
|
||||
"""Draw a legend, maybe placing it outside axes and resizing the figure.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
legend_data : dict
|
||||
Dictionary mapping label names (or two-element tuples where the
|
||||
second element is a label name) to matplotlib artist handles. The
|
||||
default reads from ``self._legend_data``.
|
||||
title : string
|
||||
Title for the legend. The default reads from ``self._hue_var``.
|
||||
label_order : list of labels
|
||||
The order that the legend entries should appear in. The default
|
||||
reads from ``self.hue_names``.
|
||||
adjust_subtitles : bool
|
||||
If True, modify entries with invisible artists to left-align
|
||||
the labels and set the font size to that of a title.
|
||||
kwargs : key, value pairings
|
||||
Other keyword arguments are passed to the underlying legend methods
|
||||
on the Figure or Axes object.
|
||||
|
||||
Returns
|
||||
-------
|
||||
self : Grid instance
|
||||
Returns self for easy chaining.
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
@property
|
||||
def legend(self): # -> None:
|
||||
"""The :class:`matplotlib.legend.Legend` object, if present."""
|
||||
...
|
||||
|
||||
|
||||
|
||||
_facet_docs = ...
|
||||
class FacetGrid(Grid):
|
||||
"""Multi-plot grid for plotting conditional relationships."""
|
||||
@_deprecate_positional_args
|
||||
def __init__(self, data, *, row=..., col=..., hue=..., col_wrap=..., sharex=..., sharey=..., height=..., aspect=..., palette=..., row_order=..., col_order=..., hue_order=..., hue_kws=..., dropna=..., legend_out=..., despine=..., margin_titles=..., xlim=..., ylim=..., subplot_kws=..., gridspec_kws=..., size=...) -> None:
|
||||
...
|
||||
|
||||
def facet_data(self): # -> Generator[tuple[tuple[int, int, int], Unknown], Any, None]:
|
||||
"""Generator for name indices and data subsets for each facet.
|
||||
|
||||
Yields
|
||||
------
|
||||
(i, j, k), data_ijk : tuple of ints, DataFrame
|
||||
The ints provide an index into the {row, col, hue}_names attribute,
|
||||
and the dataframe contains a subset of the full data corresponding
|
||||
to each facet. The generator yields subsets that correspond with
|
||||
the self.axes.flat iterator, or self.axes[i, j] when `col_wrap`
|
||||
is None.
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def map(self, func, *args, **kwargs): # -> Self@FacetGrid:
|
||||
"""Apply a plotting function to each facet's subset of the data.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
func : callable
|
||||
A plotting function that takes data and keyword arguments. It
|
||||
must plot to the currently active matplotlib Axes and take a
|
||||
`color` keyword argument. If faceting on the `hue` dimension,
|
||||
it must also take a `label` keyword argument.
|
||||
args : strings
|
||||
Column names in self.data that identify variables with data to
|
||||
plot. The data for each variable is passed to `func` in the
|
||||
order the variables are specified in the call.
|
||||
kwargs : keyword arguments
|
||||
All keyword arguments are passed to the plotting function.
|
||||
|
||||
Returns
|
||||
-------
|
||||
self : object
|
||||
Returns self.
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def map_dataframe(self, func, *args, **kwargs): # -> Self@FacetGrid:
|
||||
"""Like ``.map`` but passes args as strings and inserts data in kwargs.
|
||||
|
||||
This method is suitable for plotting with functions that accept a
|
||||
long-form DataFrame as a `data` keyword argument and access the
|
||||
data in that DataFrame using string variable names.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
func : callable
|
||||
A plotting function that takes data and keyword arguments. Unlike
|
||||
the `map` method, a function used here must "understand" Pandas
|
||||
objects. It also must plot to the currently active matplotlib Axes
|
||||
and take a `color` keyword argument. If faceting on the `hue`
|
||||
dimension, it must also take a `label` keyword argument.
|
||||
args : strings
|
||||
Column names in self.data that identify variables with data to
|
||||
plot. The data for each variable is passed to `func` in the
|
||||
order the variables are specified in the call.
|
||||
kwargs : keyword arguments
|
||||
All keyword arguments are passed to the plotting function.
|
||||
|
||||
Returns
|
||||
-------
|
||||
self : object
|
||||
Returns self.
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def facet_axis(self, row_i, col_j, modify_state=...): # -> Any | ndarray[Any, dtype[Any]]:
|
||||
"""Make the axis identified by these indices active and return it."""
|
||||
...
|
||||
|
||||
def despine(self, **kwargs): # -> Self@FacetGrid:
|
||||
"""Remove axis spines from the facets."""
|
||||
...
|
||||
|
||||
def set_axis_labels(self, x_var=..., y_var=..., clear_inner=..., **kwargs): # -> Self@FacetGrid:
|
||||
"""Set axis labels on the left column and bottom row of the grid."""
|
||||
...
|
||||
|
||||
def set_xlabels(self, label=..., clear_inner=..., **kwargs): # -> Self@FacetGrid:
|
||||
"""Label the x axis on the bottom row of the grid."""
|
||||
...
|
||||
|
||||
def set_ylabels(self, label=..., clear_inner=..., **kwargs): # -> Self@FacetGrid:
|
||||
"""Label the y axis on the left column of the grid."""
|
||||
...
|
||||
|
||||
def set_xticklabels(self, labels=..., step=..., **kwargs): # -> Self@FacetGrid:
|
||||
"""Set x axis tick labels of the grid."""
|
||||
...
|
||||
|
||||
def set_yticklabels(self, labels=..., **kwargs): # -> Self@FacetGrid:
|
||||
"""Set y axis tick labels on the left column of the grid."""
|
||||
...
|
||||
|
||||
def set_titles(self, template=..., row_template=..., col_template=..., **kwargs): # -> Self@FacetGrid:
|
||||
"""Draw titles either above each facet or on the grid margins.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
template : string
|
||||
Template for all titles with the formatting keys {col_var} and
|
||||
{col_name} (if using a `col` faceting variable) and/or {row_var}
|
||||
and {row_name} (if using a `row` faceting variable).
|
||||
row_template:
|
||||
Template for the row variable when titles are drawn on the grid
|
||||
margins. Must have {row_var} and {row_name} formatting keys.
|
||||
col_template:
|
||||
Template for the row variable when titles are drawn on the grid
|
||||
margins. Must have {col_var} and {col_name} formatting keys.
|
||||
|
||||
Returns
|
||||
-------
|
||||
self: object
|
||||
Returns self.
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
@property
|
||||
def fig(self): # -> Figure:
|
||||
"""The :class:`matplotlib.figure.Figure` with the plot."""
|
||||
...
|
||||
|
||||
@property
|
||||
def axes(self): # -> Any | NDArray[Any]:
|
||||
"""An array of the :class:`matplotlib.axes.Axes` objects in the grid."""
|
||||
...
|
||||
|
||||
@property
|
||||
def ax(self): # -> Any:
|
||||
"""The :class:`matplotlib.axes.Axes` when no faceting variables are assigned."""
|
||||
...
|
||||
|
||||
@property
|
||||
def axes_dict(self): # -> dict[Any, Any] | dict[tuple[Any, Any], Any]:
|
||||
"""A mapping of facet names to corresponding :class:`matplotlib.axes.Axes`.
|
||||
|
||||
If only one of ``row`` or ``col`` is assigned, each key is a string
|
||||
representing a level of that variable. If both facet dimensions are
|
||||
assigned, each key is a ``({row_level}, {col_level})`` tuple.
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
|
||||
|
||||
class PairGrid(Grid):
|
||||
"""Subplot grid for plotting pairwise relationships in a dataset.
|
||||
|
||||
This object maps each variable in a dataset onto a column and row in a
|
||||
grid of multiple axes. Different axes-level plotting functions can be
|
||||
used to draw bivariate plots in the upper and lower triangles, and the
|
||||
the marginal distribution of each variable can be shown on the diagonal.
|
||||
|
||||
Several different common plots can be generated in a single line using
|
||||
:func:`pairplot`. Use :class:`PairGrid` when you need more flexibility.
|
||||
|
||||
See the :ref:`tutorial <grid_tutorial>` for more information.
|
||||
|
||||
"""
|
||||
@_deprecate_positional_args
|
||||
def __init__(self, data, *, hue=..., hue_order=..., palette=..., hue_kws=..., vars=..., x_vars=..., y_vars=..., corner=..., diag_sharey=..., height=..., aspect=..., layout_pad=..., despine=..., dropna=..., size=...) -> None:
|
||||
"""Initialize the plot figure and PairGrid object.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
data : DataFrame
|
||||
Tidy (long-form) dataframe where each column is a variable and
|
||||
each row is an observation.
|
||||
hue : string (variable name)
|
||||
Variable in ``data`` to map plot aspects to different colors. This
|
||||
variable will be excluded from the default x and y variables.
|
||||
hue_order : list of strings
|
||||
Order for the levels of the hue variable in the palette
|
||||
palette : dict or seaborn color palette
|
||||
Set of colors for mapping the ``hue`` variable. If a dict, keys
|
||||
should be values in the ``hue`` variable.
|
||||
hue_kws : dictionary of param -> list of values mapping
|
||||
Other keyword arguments to insert into the plotting call to let
|
||||
other plot attributes vary across levels of the hue variable (e.g.
|
||||
the markers in a scatterplot).
|
||||
vars : list of variable names
|
||||
Variables within ``data`` to use, otherwise use every column with
|
||||
a numeric datatype.
|
||||
{x, y}_vars : lists of variable names
|
||||
Variables within ``data`` to use separately for the rows and
|
||||
columns of the figure; i.e. to make a non-square plot.
|
||||
corner : bool
|
||||
If True, don't add axes to the upper (off-diagonal) triangle of the
|
||||
grid, making this a "corner" plot.
|
||||
height : scalar
|
||||
Height (in inches) of each facet.
|
||||
aspect : scalar
|
||||
Aspect * height gives the width (in inches) of each facet.
|
||||
layout_pad : scalar
|
||||
Padding between axes; passed to ``fig.tight_layout``.
|
||||
despine : boolean
|
||||
Remove the top and right spines from the plots.
|
||||
dropna : boolean
|
||||
Drop missing values from the data before plotting.
|
||||
|
||||
See Also
|
||||
--------
|
||||
pairplot : Easily drawing common uses of :class:`PairGrid`.
|
||||
FacetGrid : Subplot grid for plotting conditional relationships.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
.. include:: ../docstrings/PairGrid.rst
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def map(self, func, **kwargs): # -> Self@PairGrid:
|
||||
"""Plot with the same function in every subplot.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
func : callable plotting function
|
||||
Must take x, y arrays as positional arguments and draw onto the
|
||||
"currently active" matplotlib Axes. Also needs to accept kwargs
|
||||
called ``color`` and ``label``.
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def map_lower(self, func, **kwargs): # -> Self@PairGrid:
|
||||
"""Plot with a bivariate function on the lower diagonal subplots.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
func : callable plotting function
|
||||
Must take x, y arrays as positional arguments and draw onto the
|
||||
"currently active" matplotlib Axes. Also needs to accept kwargs
|
||||
called ``color`` and ``label``.
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def map_upper(self, func, **kwargs): # -> Self@PairGrid:
|
||||
"""Plot with a bivariate function on the upper diagonal subplots.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
func : callable plotting function
|
||||
Must take x, y arrays as positional arguments and draw onto the
|
||||
"currently active" matplotlib Axes. Also needs to accept kwargs
|
||||
called ``color`` and ``label``.
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def map_offdiag(self, func, **kwargs): # -> Self@PairGrid:
|
||||
"""Plot with a bivariate function on the off-diagonal subplots.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
func : callable plotting function
|
||||
Must take x, y arrays as positional arguments and draw onto the
|
||||
"currently active" matplotlib Axes. Also needs to accept kwargs
|
||||
called ``color`` and ``label``.
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def map_diag(self, func, **kwargs): # -> Self@PairGrid:
|
||||
"""Plot with a univariate function on each diagonal subplot.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
func : callable plotting function
|
||||
Must take an x array as a positional argument and draw onto the
|
||||
"currently active" matplotlib Axes. Also needs to accept kwargs
|
||||
called ``color`` and ``label``.
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
|
||||
|
||||
class JointGrid:
|
||||
"""Grid for drawing a bivariate plot with marginal univariate plots.
|
||||
|
||||
Many plots can be drawn by using the figure-level interface :func:`jointplot`.
|
||||
Use this class directly when you need more flexibility.
|
||||
|
||||
"""
|
||||
@_deprecate_positional_args
|
||||
def __init__(self, *, x=..., y=..., data=..., height=..., ratio=..., space=..., dropna=..., xlim=..., ylim=..., size=..., marginal_ticks=..., hue=..., palette=..., hue_order=..., hue_norm=...) -> None:
|
||||
...
|
||||
|
||||
def plot(self, joint_func, marginal_func, **kwargs): # -> Self@JointGrid:
|
||||
"""Draw the plot by passing functions for joint and marginal axes.
|
||||
|
||||
This method passes the ``kwargs`` dictionary to both functions. If you
|
||||
need more control, call :meth:`JointGrid.plot_joint` and
|
||||
:meth:`JointGrid.plot_marginals` directly with specific parameters.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
joint_func, marginal_func: callables
|
||||
Functions to draw the bivariate and univariate plots. See methods
|
||||
referenced above for information about the required characteristics
|
||||
of these functions.
|
||||
kwargs
|
||||
Additional keyword arguments are passed to both functions.
|
||||
|
||||
Returns
|
||||
-------
|
||||
:class:`JointGrid` instance
|
||||
Returns ``self`` for easy method chaining.
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def plot_joint(self, func, **kwargs): # -> Self@JointGrid:
|
||||
"""Draw a bivariate plot on the joint axes of the grid.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
func : plotting callable
|
||||
If a seaborn function, it should accept ``x`` and ``y``. Otherwise,
|
||||
it must accept ``x`` and ``y`` vectors of data as the first two
|
||||
positional arguments, and it must plot on the "current" axes.
|
||||
If ``hue`` was defined in the class constructor, the function must
|
||||
accept ``hue`` as a parameter.
|
||||
kwargs
|
||||
Keyword argument are passed to the plotting function.
|
||||
|
||||
Returns
|
||||
-------
|
||||
:class:`JointGrid` instance
|
||||
Returns ``self`` for easy method chaining.
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def plot_marginals(self, func, **kwargs): # -> Self@JointGrid:
|
||||
"""Draw univariate plots on each marginal axes.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
func : plotting callable
|
||||
If a seaborn function, it should accept ``x`` and ``y`` and plot
|
||||
when only one of them is defined. Otherwise, it must accept a vector
|
||||
of data as the first positional argument and determine its orientation
|
||||
using the ``vertical`` parameter, and it must plot on the "current" axes.
|
||||
If ``hue`` was defined in the class constructor, it must accept ``hue``
|
||||
as a parameter.
|
||||
kwargs
|
||||
Keyword argument are passed to the plotting function.
|
||||
|
||||
Returns
|
||||
-------
|
||||
:class:`JointGrid` instance
|
||||
Returns ``self`` for easy method chaining.
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def set_axis_labels(self, xlabel=..., ylabel=..., **kwargs): # -> Self@JointGrid:
|
||||
"""Set axis labels on the bivariate axes.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
xlabel, ylabel : strings
|
||||
Label names for the x and y variables.
|
||||
kwargs : key, value mappings
|
||||
Other keyword arguments are passed to the following functions:
|
||||
|
||||
- :meth:`matplotlib.axes.Axes.set_xlabel`
|
||||
- :meth:`matplotlib.axes.Axes.set_ylabel`
|
||||
|
||||
Returns
|
||||
-------
|
||||
:class:`JointGrid` instance
|
||||
Returns ``self`` for easy method chaining.
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def savefig(self, *args, **kwargs): # -> None:
|
||||
"""Save the figure using a "tight" bounding box by default.
|
||||
|
||||
Wraps :meth:`matplotlib.figure.Figure.savefig`.
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
|
||||
|
||||
@_deprecate_positional_args
|
||||
def pairplot(data, *, hue=..., hue_order=..., palette=..., vars=..., x_vars=..., y_vars=..., kind=..., diag_kind=..., markers=..., height=..., aspect=..., corner=..., dropna=..., plot_kws=..., diag_kws=..., grid_kws=..., size=...):
|
||||
"""Plot pairwise relationships in a dataset.
|
||||
|
||||
By default, this function will create a grid of Axes such that each numeric
|
||||
variable in ``data`` will by shared across the y-axes across a single row and
|
||||
the x-axes across a single column. The diagonal plots are treated
|
||||
differently: a univariate distribution plot is drawn to show the marginal
|
||||
distribution of the data in each column.
|
||||
|
||||
It is also possible to show a subset of variables or plot different
|
||||
variables on the rows and columns.
|
||||
|
||||
This is a high-level interface for :class:`PairGrid` that is intended to
|
||||
make it easy to draw a few common styles. You should use :class:`PairGrid`
|
||||
directly if you need more flexibility.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
data : `pandas.DataFrame`
|
||||
Tidy (long-form) dataframe where each column is a variable and
|
||||
each row is an observation.
|
||||
hue : name of variable in ``data``
|
||||
Variable in ``data`` to map plot aspects to different colors.
|
||||
hue_order : list of strings
|
||||
Order for the levels of the hue variable in the palette
|
||||
palette : dict or seaborn color palette
|
||||
Set of colors for mapping the ``hue`` variable. If a dict, keys
|
||||
should be values in the ``hue`` variable.
|
||||
vars : list of variable names
|
||||
Variables within ``data`` to use, otherwise use every column with
|
||||
a numeric datatype.
|
||||
{x, y}_vars : lists of variable names
|
||||
Variables within ``data`` to use separately for the rows and
|
||||
columns of the figure; i.e. to make a non-square plot.
|
||||
kind : {'scatter', 'kde', 'hist', 'reg'}
|
||||
Kind of plot to make.
|
||||
diag_kind : {'auto', 'hist', 'kde', None}
|
||||
Kind of plot for the diagonal subplots. If 'auto', choose based on
|
||||
whether or not ``hue`` is used.
|
||||
markers : single matplotlib marker code or list
|
||||
Either the marker to use for all scatterplot points or a list of markers
|
||||
with a length the same as the number of levels in the hue variable so that
|
||||
differently colored points will also have different scatterplot
|
||||
markers.
|
||||
height : scalar
|
||||
Height (in inches) of each facet.
|
||||
aspect : scalar
|
||||
Aspect * height gives the width (in inches) of each facet.
|
||||
corner : bool
|
||||
If True, don't add axes to the upper (off-diagonal) triangle of the
|
||||
grid, making this a "corner" plot.
|
||||
dropna : boolean
|
||||
Drop missing values from the data before plotting.
|
||||
{plot, diag, grid}_kws : dicts
|
||||
Dictionaries of keyword arguments. ``plot_kws`` are passed to the
|
||||
bivariate plotting function, ``diag_kws`` are passed to the univariate
|
||||
plotting function, and ``grid_kws`` are passed to the :class:`PairGrid`
|
||||
constructor.
|
||||
|
||||
Returns
|
||||
-------
|
||||
grid : :class:`PairGrid`
|
||||
Returns the underlying :class:`PairGrid` instance for further tweaking.
|
||||
|
||||
See Also
|
||||
--------
|
||||
PairGrid : Subplot grid for more flexible plotting of pairwise relationships.
|
||||
JointGrid : Grid for plotting joint and marginal distributions of two variables.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
.. include:: ../docstrings/pairplot.rst
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
@_deprecate_positional_args
|
||||
def jointplot(*, x=..., y=..., data=..., kind=..., color=..., height=..., ratio=..., space=..., dropna=..., xlim=..., ylim=..., marginal_ticks=..., joint_kws=..., marginal_kws=..., hue=..., palette=..., hue_order=..., hue_norm=..., **kwargs):
|
||||
...
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue