Add seaborn stubs (#10721)

This commit is contained in:
Ali Hamdan
2023-10-28 16:44:36 +02:00
committed by GitHub
parent 56288ad2d0
commit c189ca0e15
52 changed files with 2412 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
seaborn._core.scales.(Pipeline|TransFuncs) # aliases defined in `if TYPE_CHECKING` block
seaborn.external.docscrape.ClassDoc.__init__ # stubtest doesn't like ABC class as default value
seaborn.external.docscrape.NumpyDocString.__str__ # weird signature

View File

@@ -0,0 +1,8 @@
version = "0.13.*"
# Requires a version of numpy and matplotlib with a `py.typed` file
requires = ["matplotlib>=3.8", "numpy>=1.20", "pandas-stubs"]
# matplotlib>=3.8 requires Python >=3.9
requires_python = ">=3.9"
[tool.stubtest]
ignore_missing_stub = false

View File

@@ -0,0 +1,13 @@
from . import cm as cm
from .axisgrid import *
from .categorical import *
from .colors import crayons as crayons, xkcd_rgb as xkcd_rgb
from .distributions import *
from .matrix import *
from .miscplot import *
from .palettes import *
from .rcmod import *
from .regression import *
from .relational import *
from .utils import *
from .widgets import *

View File

View File

@@ -0,0 +1,26 @@
from _typeshed import Incomplete
from collections.abc import Mapping
from typing import TypeVar, overload
from pandas import DataFrame
from pandas.core.interchange.dataframe_protocol import DataFrame as DataFrameProtocol
from seaborn._core.typing import DataSource, VariableSpec
_T = TypeVar("_T", Mapping[Incomplete, Incomplete], None)
class PlotData:
frame: DataFrame
frames: dict[tuple[str, str], DataFrame]
names: dict[str, str | None]
ids: dict[str, str | int]
source_data: DataSource
source_vars: dict[str, VariableSpec]
def __init__(self, data: DataSource, variables: dict[str, VariableSpec]) -> None: ...
def __contains__(self, key: str) -> bool: ...
def join(self, data: DataSource, variables: dict[str, VariableSpec] | None) -> PlotData: ...
@overload
def handle_data_source(data: _T) -> _T: ...
@overload
def handle_data_source(data: DataFrameProtocol) -> DataFrame: ...
def convert_dataframe_to_pandas(data: object) -> DataFrame: ...

View File

@@ -0,0 +1 @@
class PlotSpecError(RuntimeError): ...

View File

@@ -0,0 +1,10 @@
from _typeshed import Incomplete
from collections.abc import Callable
from pandas import DataFrame
class GroupBy:
order: dict[str, list[Incomplete] | None]
def __init__(self, order: list[str] | dict[str, list[Incomplete] | None]) -> None: ...
def agg(self, data: DataFrame, *args, **kwargs) -> DataFrame: ...
def apply(self, data: DataFrame, func: Callable[..., DataFrame], *args, **kwargs) -> DataFrame: ...

View File

@@ -0,0 +1,44 @@
from _typeshed import Incomplete
from collections.abc import Callable
from dataclasses import dataclass
from typing import ClassVar
from pandas import DataFrame
from seaborn._core.groupby import GroupBy
from seaborn._core.scales import Scale
from seaborn._core.typing import Default
default: Default
@dataclass
class Move:
group_by_orient: ClassVar[bool]
def __call__(self, data: DataFrame, groupby: GroupBy, orient: str, scales: dict[str, Scale]) -> DataFrame: ...
@dataclass
class Jitter(Move):
width: float | Default = ...
x: float = 0
y: float = 0
seed: int | None = None
@dataclass
class Dodge(Move):
empty: str = "keep"
gap: float = 0
by: list[str] | None = None
@dataclass
class Stack(Move): ...
@dataclass
class Shift(Move):
x: float = 0
y: float = 0
@dataclass
class Norm(Move):
func: Callable[..., Incomplete] | str = "max"
where: str | None = None
by: list[str] | None = None
percent: bool = False

View File

@@ -0,0 +1,107 @@
import inspect
import os
from _typeshed import Incomplete, SupportsKeysAndGetItem
from collections.abc import Callable, Generator
from contextlib import contextmanager
from typing import IO, Any, NoReturn, TypeVar
from typing_extensions import Literal, TypedDict
import matplotlib as mpl
from matplotlib.axes import Axes
from matplotlib.figure import Figure, SubFigure
from seaborn._core.data import PlotData
from seaborn._core.moves import Move
from seaborn._core.scales import Scale
from seaborn._core.typing import DataSource, Default, OrderSpec, VariableSpec, VariableSpecList
from seaborn._marks.base import Mark
from seaborn._stats.base import Stat
_ClsT = TypeVar("_ClsT", bound=type[Any])
default: Default
class Layer(TypedDict, total=False):
mark: Mark
stat: Stat | None
move: Move | list[Move] | None
data: PlotData
source: DataSource
vars: dict[str, VariableSpec]
orient: str
legend: bool
label: str | None
class FacetSpec(TypedDict, total=False):
variables: dict[str, VariableSpec]
structure: dict[str, list[str]]
wrap: int | None
class PairSpec(TypedDict, total=False):
variables: dict[str, VariableSpec]
structure: dict[str, list[str]]
cross: bool
wrap: int | None
@contextmanager
def theme_context(params: dict[str, Any]) -> Generator[None, None, None]: ...
def build_plot_signature(cls: _ClsT) -> _ClsT: ... # -> _ClsT & "__signature__ protocol"
class ThemeConfig(mpl.RcParams):
THEME_GROUPS: list[str]
def __init__(self) -> None: ...
def reset(self) -> None: ...
def update(self, __other: SupportsKeysAndGetItem[Incomplete, Incomplete] | None = None, **kwds: Incomplete) -> None: ... # type: ignore[override]
class DisplayConfig(TypedDict):
format: Literal["png", "svg"]
scaling: float
hidpi: bool
class PlotConfig:
def __init__(self) -> None: ...
@property
def theme(self) -> dict[str, Any]: ...
@property
def display(self) -> DisplayConfig: ...
@build_plot_signature
class Plot:
__signature__: inspect.Signature
config: PlotConfig
def __init__(self, *args: DataSource | VariableSpec, data: DataSource = None, **variables: VariableSpec) -> None: ...
def __add__(self, other) -> NoReturn: ...
def on(self, target: Axes | SubFigure | Figure) -> Plot: ...
def add(
self,
mark: Mark,
*transforms: Stat | Move,
orient: str | None = None,
legend: bool = True,
label: str | None = None,
data: DataSource = None,
**variables: VariableSpec,
) -> Plot: ...
def pair(
self, x: VariableSpecList = None, y: VariableSpecList = None, wrap: int | None = None, cross: bool = True
) -> Plot: ...
def facet(
self,
col: VariableSpec = None,
row: VariableSpec = None,
order: OrderSpec | dict[str, OrderSpec] = None,
wrap: int | None = None,
) -> Plot: ...
def scale(self, **scales: Scale) -> Plot: ...
def share(self, **shares: bool | str) -> Plot: ...
def limit(self, **limits: tuple[Any, Any]) -> Plot: ...
def label(self, *, title: str | None = None, legend: str | None = None, **variables: str | Callable[[str], str]) -> Plot: ...
def layout(self, *, size: tuple[float, float] | Default = ..., engine: str | None | Default = ...) -> Plot: ...
def theme(self, *args: dict[str, Any]) -> Plot: ...
def save(self, loc: str | os.PathLike[Any] | IO[Any], **kwargs) -> Plot: ...
def show(self, **kwargs) -> None: ...
def plot(self, pyplot: bool = False) -> Plotter: ...
class Plotter:
def __init__(self, pyplot: bool, theme: dict[str, Any]) -> None: ...
def save(self, loc: str | os.PathLike[Any] | IO[Any], **kwargs) -> Plotter: ...
def show(self, **kwargs) -> None: ...

View File

@@ -0,0 +1,98 @@
from _typeshed import Incomplete
from collections.abc import Callable
from typing import Any
from typing_extensions import TypeAlias
from matplotlib.markers import MarkerStyle
from matplotlib.path import Path
from numpy.typing import ArrayLike
from pandas import Series
from seaborn._core.scales import Scale
RGBTuple: TypeAlias = tuple[float, float, float]
RGBATuple: TypeAlias = tuple[float, float, float, float]
ColorSpec: TypeAlias = RGBTuple | RGBATuple | str
DashPattern: TypeAlias = tuple[float, ...]
DashPatternWithOffset: TypeAlias = tuple[float, DashPattern | None]
MarkerPattern: TypeAlias = float | str | tuple[int, int, float] | list[tuple[float, float]] | Path | MarkerStyle
Mapping: TypeAlias = Callable[[ArrayLike], ArrayLike]
class Property:
legend: bool
normed: bool
variable: Incomplete
def __init__(self, variable: str | None = None) -> None: ...
def default_scale(self, data: Series[Any]) -> Scale: ...
def infer_scale(self, arg: Any, data: Series[Any]) -> Scale: ...
def get_mapping(self, scale: Scale, data: Series[Any]) -> Mapping: ...
def standardize(self, val: Any) -> Any: ...
class Coordinate(Property):
legend: bool
normed: bool
class IntervalProperty(Property):
legend: bool
normed: bool
@property
def default_range(self) -> tuple[float, float]: ...
def infer_scale(self, arg: Any, data: Series[Any]) -> Scale: ...
def get_mapping(self, scale: Scale, data: Series[Any]) -> Mapping: ...
class PointSize(IntervalProperty): ...
class LineWidth(IntervalProperty):
@property
def default_range(self) -> tuple[float, float]: ...
class EdgeWidth(IntervalProperty):
@property
def default_range(self) -> tuple[float, float]: ...
class Stroke(IntervalProperty): ...
class Alpha(IntervalProperty): ...
class Offset(IntervalProperty): ...
class FontSize(IntervalProperty):
@property
def default_range(self) -> tuple[float, float]: ...
class ObjectProperty(Property):
legend: bool
normed: bool
null_value: Any
def default_scale(self, data: Series[Any]) -> Scale: ...
def infer_scale(self, arg: Any, data: Series[Any]) -> Scale: ...
def get_mapping(self, scale: Scale, data: Series[Any]) -> Mapping: ...
class Marker(ObjectProperty):
null_value: Incomplete
def standardize(self, val: MarkerPattern) -> MarkerStyle: ...
class LineStyle(ObjectProperty):
null_value: str
def standardize(self, val: str | DashPattern) -> DashPatternWithOffset: ...
class TextAlignment(ObjectProperty):
legend: bool
class HorizontalAlignment(TextAlignment): ...
class VerticalAlignment(TextAlignment): ...
class Color(Property):
legend: bool
normed: bool
def standardize(self, val: ColorSpec) -> RGBTuple | RGBATuple: ...
def infer_scale(self, arg: Any, data: Series[Any]) -> Scale: ...
def get_mapping(self, scale: Scale, data: Series[Any]) -> Mapping: ...
class Fill(Property):
legend: bool
normed: bool
def default_scale(self, data: Series[Any]) -> Scale: ...
def infer_scale(self, arg: Any, data: Series[Any]) -> Scale: ...
def standardize(self, val: Any) -> bool: ...
def get_mapping(self, scale: Scale, data: Series[Any]) -> Mapping: ...
PROPERTY_CLASSES: dict[str, type[Property]]
PROPERTIES: dict[str, Property]

View File

@@ -0,0 +1,15 @@
from collections import UserString
from typing import Any
from typing_extensions import Literal
from pandas import Series
class VarType(UserString):
allowed: tuple[str, ...]
def __init__(self, data: str) -> None: ...
def __eq__(self, other: str) -> bool: ... # type: ignore[override]
def variable_type(
vector: Series[Any], boolean_type: Literal["numeric", "categorical", "boolean"] = "numeric", strict_boolean: bool = False
) -> VarType: ...
def categorical_order(vector: Series[Any], order: list[Any] | None = None) -> list[Any]: ...

View File

@@ -0,0 +1,100 @@
from _typeshed import Incomplete
from collections.abc import Callable, Sequence
from dataclasses import dataclass
from typing import Any, ClassVar
from typing_extensions import Self, TypeAlias
from matplotlib.axis import Ticker
from matplotlib.scale import ScaleBase
from matplotlib.ticker import Formatter, Locator
from matplotlib.units import ConversionInterface
from numpy.typing import ArrayLike, NDArray
from pandas import Series
from seaborn._core.typing import Default
TransFuncs: TypeAlias = tuple[Callable[[ArrayLike], ArrayLike], Callable[[ArrayLike], ArrayLike]]
Pipeline: TypeAlias = Sequence[Callable[[Any], Any] | None]
class Scale:
values: tuple[Incomplete, ...] | str | list[Incomplete] | dict[Incomplete, Incomplete] | None
def __post_init__(self) -> None: ...
def tick(self) -> Self: ...
def label(self) -> Self: ...
def __call__(self, data: Series[Any]) -> ArrayLike: ...
@dataclass
class Boolean(Scale):
values: tuple[Incomplete, ...] | list[Incomplete] | dict[Incomplete, Incomplete] | None = None
def tick(self, locator: Locator | None = None) -> Self: ...
def label(self, formatter: Formatter | None = None) -> Self: ...
@dataclass
class Nominal(Scale):
values: tuple[Incomplete, ...] | str | list[Incomplete] | dict[Incomplete, Incomplete] | None = None
order: list[Incomplete] | None = None
def tick(self, locator: Locator | None = None) -> Self: ...
def label(self, formatter: Formatter | None = None) -> Self: ...
@dataclass
class Ordinal(Scale): ...
@dataclass
class Discrete(Scale): ...
@dataclass
class ContinuousBase(Scale):
values: tuple[Incomplete, ...] | str | None = None
norm: tuple[Incomplete, ...] | None = None
@dataclass
class Continuous(ContinuousBase):
values: tuple[Incomplete, ...] | str | None = None
trans: str | TransFuncs | None = None
def tick(
self,
locator: Locator | None = None,
*,
at: Sequence[float] | None = None,
upto: int | None = None,
count: int | None = None,
every: float | None = None,
between: tuple[float, float] | None = None,
minor: int | None = None,
) -> Self: ...
def label(
self,
formatter: Formatter | None = None,
*,
like: str | Callable[[float], str] | None = None,
base: int | None | Default = ...,
unit: str | None = None,
) -> Self: ...
@dataclass
class Temporal(ContinuousBase):
trans: ClassVar[Incomplete] # not sure it is a classvar but the runtime has no annotation so it is not a dataclass field
def tick(self, locator: Locator | None = None, *, upto: int | None = None) -> Self: ...
def label(self, formatter: Formatter | None = None, *, concise: bool = False) -> Self: ...
class PseudoAxis:
axis_name: str
converter: ConversionInterface | None
units: Incomplete | None
scale: ScaleBase
major: Ticker
minor: Ticker
def __init__(self, scale: ScaleBase) -> None: ...
def set_view_interval(self, vmin: float, vmax: float) -> None: ...
def get_view_interval(self) -> tuple[float, float]: ...
def set_data_interval(self, vmin: float, vmax: float) -> None: ...
def get_data_interval(self) -> tuple[float, float]: ...
def get_tick_space(self) -> int: ...
def set_major_locator(self, locator: Locator) -> None: ...
def set_major_formatter(self, formatter: Formatter) -> None: ...
def set_minor_locator(self, locator: Locator) -> None: ...
def set_minor_formatter(self, formatter: Formatter) -> None: ...
def set_units(self, units: Incomplete) -> None: ...
def update_units(self, x: Incomplete) -> None: ...
def convert_units(self, x: Incomplete) -> Incomplete: ...
def get_scale(self) -> ScaleBase: ...
def get_majorticklocs(self) -> NDArray[Incomplete]: ...

View File

@@ -0,0 +1,19 @@
from collections.abc import Generator
from typing import Any
from matplotlib.axes import Axes
from matplotlib.figure import Figure, SubFigure
from seaborn._core.plot import FacetSpec, PairSpec
class Subplots:
subplot_spec: dict[str, Any]
def __init__(self, subplot_spec: dict[str, Any], facet_spec: FacetSpec, pair_spec: PairSpec) -> None: ...
def init_figure(
self,
pair_spec: PairSpec,
pyplot: bool = False,
figure_kws: dict[str, Any] | None = None,
target: Axes | Figure | SubFigure | None = None,
) -> Figure: ...
def __iter__(self) -> Generator[dict[str, Any], None, None]: ...
def __len__(self) -> int: ...

View File

@@ -0,0 +1,26 @@
from _typeshed import Incomplete
from collections.abc import Iterable
from datetime import date, datetime, timedelta
from typing import Any
from typing_extensions import TypeAlias
from matplotlib.colors import Colormap, Normalize
from numpy import ndarray
from pandas import Index, Series, Timedelta, Timestamp
ColumnName: TypeAlias = str | bytes | date | datetime | timedelta | bool | complex | Timestamp | Timedelta
Vector: TypeAlias = Series[Any] | Index[Any] | ndarray[Any, Any]
VariableSpec: TypeAlias = ColumnName | Vector | None
VariableSpecList: TypeAlias = list[VariableSpec] | Index[Any] | None
DataSource: TypeAlias = Incomplete
OrderSpec: TypeAlias = Iterable[str] | None
NormSpec: TypeAlias = tuple[float | None, float | None] | Normalize | None
PaletteSpec: TypeAlias = str | list[Incomplete] | dict[Incomplete, Incomplete] | Colormap | None
DiscreteValueSpec: TypeAlias = dict[Incomplete, Incomplete] | list[Incomplete] | None
ContinuousValueSpec: TypeAlias = tuple[float, float] | list[float] | dict[Any, float] | None
class Default: ...
class Deprecated: ...
default: Default
deprecated: Deprecated

View File

@@ -0,0 +1,28 @@
from dataclasses import dataclass
from seaborn._marks.base import MappableBool, MappableColor, MappableFloat, MappableStyle, Mark, document_properties
class AreaBase: ...
@document_properties
@dataclass
class Area(AreaBase, Mark):
color: MappableColor = ...
alpha: MappableFloat = ...
fill: MappableBool = ...
edgecolor: MappableColor = ...
edgealpha: MappableFloat = ...
edgewidth: MappableFloat = ...
edgestyle: MappableStyle = ...
baseline: MappableFloat = ...
@document_properties
@dataclass
class Band(AreaBase, Mark):
color: MappableColor = ...
alpha: MappableFloat = ...
fill: MappableBool = ...
edgecolor: MappableColor = ...
edgealpha: MappableFloat = ...
edgewidth: MappableFloat = ...
edgestyle: MappableFloat = ...

View File

@@ -0,0 +1,31 @@
from dataclasses import dataclass
from seaborn._marks.base import MappableBool, MappableColor, MappableFloat, MappableStyle, Mark, document_properties
class BarBase(Mark): ...
@document_properties
@dataclass
class Bar(BarBase):
color: MappableColor = ...
alpha: MappableFloat = ...
fill: MappableBool = ...
edgecolor: MappableColor = ...
edgealpha: MappableFloat = ...
edgewidth: MappableFloat = ...
edgestyle: MappableStyle = ...
width: MappableFloat = ...
baseline: MappableFloat = ...
@document_properties
@dataclass
class Bars(BarBase):
color: MappableColor = ...
alpha: MappableFloat = ...
fill: MappableBool = ...
edgecolor: MappableColor = ...
edgealpha: MappableFloat = ...
edgewidth: MappableFloat = ...
edgestyle: MappableStyle = ...
width: MappableFloat = ...
baseline: MappableFloat = ...

View File

@@ -0,0 +1,38 @@
from _typeshed import Incomplete
from dataclasses import dataclass
from typing import Any, TypeVar
from typing_extensions import TypeAlias
from numpy.typing import NDArray
from pandas import DataFrame
from seaborn._core.properties import DashPattern, DashPatternWithOffset, RGBATuple
from seaborn._core.scales import Scale
_MarkT = TypeVar("_MarkT", bound=type[Mark])
class Mappable:
def __init__(
self, val: Any = None, depend: str | None = None, rc: str | None = None, auto: bool = False, grouping: bool = True
) -> None: ...
@property
def depend(self) -> Any: ... # -> str | None
@property
def grouping(self) -> bool: ...
@property
def default(self) -> Any: ...
MappableBool: TypeAlias = bool | Mappable
MappableString: TypeAlias = str | Mappable
MappableFloat: TypeAlias = float | Mappable
MappableColor: TypeAlias = str | tuple[Incomplete, ...] | Mappable
MappableStyle: TypeAlias = str | DashPattern | DashPatternWithOffset | Mappable
@dataclass
class Mark:
artist_kws: dict[str, Any] = ...
def resolve_properties(mark: Mark, data: DataFrame, scales: dict[str, Scale]) -> dict[str, Any]: ...
def resolve_color(
mark: Mark, data: DataFrame | dict[str, Any], prefix: str = "", scales: dict[str, Scale] | None = None
) -> RGBATuple | NDArray[Incomplete]: ...
def document_properties(mark: _MarkT) -> _MarkT: ...

View File

@@ -0,0 +1,39 @@
from dataclasses import dataclass
from seaborn._marks.base import (
MappableBool,
MappableColor,
MappableFloat,
MappableString,
MappableStyle,
Mark,
document_properties,
)
class DotBase(Mark): ...
@document_properties
@dataclass
class Dot(DotBase):
marker: MappableString = ...
pointsize: MappableFloat = ...
stroke: MappableFloat = ...
color: MappableColor = ...
alpha: MappableFloat = ...
fill: MappableBool = ...
edgecolor: MappableColor = ...
edgealpha: MappableFloat = ...
edgewidth: MappableFloat = ...
edgestyle: MappableStyle = ...
@document_properties
@dataclass
class Dots(DotBase):
marker: MappableString = ...
pointsize: MappableFloat = ...
stroke: MappableFloat = ...
color: MappableColor = ...
alpha: MappableFloat = ...
fill: MappableBool = ...
fillcolor: MappableColor = ...
fillalpha: MappableFloat = ...

View File

@@ -0,0 +1,42 @@
from dataclasses import dataclass
from seaborn._marks.base import MappableColor, MappableFloat, MappableString, Mark, document_properties
@document_properties
@dataclass
class Path(Mark):
color: MappableColor = ...
alpha: MappableFloat = ...
linewidth: MappableFloat = ...
linestyle: MappableString = ...
marker: MappableString = ...
pointsize: MappableFloat = ...
fillcolor: MappableColor = ...
edgecolor: MappableColor = ...
edgewidth: MappableFloat = ...
@document_properties
@dataclass
class Line(Path): ...
@document_properties
@dataclass
class Paths(Mark):
color: MappableColor = ...
alpha: MappableFloat = ...
linewidth: MappableFloat = ...
linestyle: MappableString = ...
def __post_init__(self) -> None: ...
@document_properties
@dataclass
class Lines(Paths): ...
@document_properties
@dataclass
class Range(Paths): ...
@document_properties
@dataclass
class Dash(Paths):
width: MappableFloat = ...

View File

@@ -0,0 +1,14 @@
from dataclasses import dataclass
from seaborn._marks.base import MappableColor, MappableFloat, MappableString, Mark, document_properties
@document_properties
@dataclass
class Text(Mark):
text: MappableString = ...
color: MappableColor = ...
alpha: MappableFloat = ...
fontsize: MappableFloat = ...
halign: MappableString = ...
valign: MappableString = ...
offset: MappableFloat = ...

View File

@@ -0,0 +1,19 @@
from collections.abc import Callable
from dataclasses import dataclass
from seaborn._core.typing import Vector
from seaborn._stats.base import Stat
@dataclass
class Agg(Stat):
func: str | Callable[[Vector], float] = "mean"
@dataclass
class Est(Stat):
func: str | Callable[[Vector], float] = "mean"
errorbar: str | tuple[str, float] = ... # ("ci", 95) # pytype parse error
n_boot: int = 1000
seed: int | None = None
@dataclass
class Rolling(Stat): ...

View File

@@ -0,0 +1,11 @@
from dataclasses import dataclass
from typing import ClassVar
from pandas import DataFrame
from seaborn._core.groupby import GroupBy
from seaborn._core.scales import Scale
@dataclass
class Stat:
group_by_orient: ClassVar[bool]
def __call__(self, data: DataFrame, groupby: GroupBy, orient: str, scales: dict[str, Scale]) -> DataFrame: ...

View File

@@ -0,0 +1,19 @@
from dataclasses import dataclass
from numpy.typing import ArrayLike
from seaborn._stats.base import Stat
@dataclass
class Count(Stat): ...
@dataclass
class Hist(Stat):
stat: str = "count"
bins: str | int | ArrayLike = "auto"
binwidth: float | None = None
binrange: tuple[float, float] | None = None
common_norm: bool | list[str] = True
common_bins: bool | list[str] = True
cumulative: bool = False
discrete: bool = False
def __post_init__(self) -> None: ...

View File

@@ -0,0 +1,16 @@
from collections.abc import Callable
from dataclasses import dataclass
from seaborn._stats.base import Stat
from seaborn.external.kde import gaussian_kde
@dataclass
class KDE(Stat):
bw_adjust: float = 1
bw_method: str | float | Callable[[gaussian_kde], float] = "scott"
common_norm: bool | list[str] = True
common_grid: bool | list[str] = True
gridsize: int | None = 200
cut: float = 3
cumulative: bool = False
def __post_init__(self) -> None: ...

View File

@@ -0,0 +1,8 @@
from dataclasses import dataclass
from seaborn._stats.base import Stat
@dataclass
class Perc(Stat):
k: int | list[float] = 5
method: str = "linear"

View File

@@ -0,0 +1,11 @@
from dataclasses import dataclass
from seaborn._stats.base import Stat
@dataclass
class PolyFit(Stat):
order: int = 2
gridsize: int = 100
@dataclass
class OLSFit(Stat): ...

View File

@@ -0,0 +1,16 @@
from collections.abc import Callable
from typing import Any
from numpy.typing import ArrayLike, NDArray
from .utils import _Seed
def bootstrap(
*args: ArrayLike,
n_boot: int = 10000,
func: str | Callable[..., Any] = "mean",
axis: int | None = None,
units: ArrayLike | None = None,
seed: _Seed | None = None,
random_seed: _Seed | None = None, # deprecated
) -> NDArray[Any]: ...

View File

@@ -0,0 +1,244 @@
from _typeshed import Incomplete
from collections.abc import Callable, Generator, Iterable, Mapping
from typing import Any, TypeVar
from typing_extensions import Concatenate, Literal, ParamSpec, Self
from matplotlib.artist import Artist
from matplotlib.axes import Axes
from matplotlib.colors import Colormap
from matplotlib.figure import Figure
from matplotlib.legend import Legend
from matplotlib.text import Text
from matplotlib.typing import ColorType
from numpy.typing import NDArray
from pandas import DataFrame, Series
from .palettes import _RGBColorPalette
from .utils import _Palette
__all__ = ["FacetGrid", "PairGrid", "JointGrid", "pairplot", "jointplot"]
_P = ParamSpec("_P")
_R = TypeVar("_R")
class _BaseGrid:
def set(self, **kwargs: Incomplete) -> Self: ... # **kwargs are passed to `matplotlib.axes.Axes.set`
@property
def fig(self) -> Figure: ...
@property
def figure(self) -> Figure: ...
def apply(self, func: Callable[Concatenate[Self, _P], object], *args: _P.args, **kwargs: _P.kwargs) -> Self: ...
def pipe(self, func: Callable[Concatenate[Self, _P], _R], *args: _P.args, **kwargs: _P.kwargs) -> _R: ...
def savefig(
self, *args: Incomplete, **kwargs: Incomplete
) -> None: ... # *args and **kwargs are passed to `matplotlib.figure.Figure.savefig`
class Grid(_BaseGrid):
def __init__(self) -> None: ...
def tight_layout(
self, *args: Incomplete, **kwargs: Incomplete
) -> Self: ... # *args and **kwargs are passed to `matplotlib.figure.Figure.tight_layout`
def add_legend(
self,
legend_data: Mapping[Any, Artist] | None = None, # cannot use precise key type because of invariant Mapping keys
title: str | None = None,
label_order: list[str] | None = None,
adjust_subtitles: bool = False,
**kwargs: Incomplete, # **kwargs are passed to `matplotlib.figure.Figure.legend`
) -> Self: ...
@property
def legend(self) -> Legend | None: ...
def tick_params(
self, axis: Literal["x", "y", "both"] = "both", **kwargs: Incomplete
) -> Self: ... # **kwargs are passed to `matplotlib.axes.Axes.tick_params`
class FacetGrid(Grid):
data: DataFrame
row_names: list[Any]
col_names: list[Any]
hue_names: list[Any] | None
hue_kws: dict[str, Any]
def __init__(
self,
data: DataFrame,
*,
row: str | None = None,
col: str | None = None,
hue: str | None = None,
col_wrap: int | None = None,
sharex: bool | Literal["col", "row"] = True,
sharey: bool | Literal["col", "row"] = True,
height: float = 3,
aspect: float = 1,
palette: _Palette | None = None,
row_order: Iterable[Any] | None = None,
col_order: Iterable[Any] | None = None,
hue_order: Iterable[Any] | None = None,
hue_kws: dict[str, Any] | None = None,
dropna: bool = False,
legend_out: bool = True,
despine: bool = True,
margin_titles: bool = False,
xlim: tuple[float, float] | None = None,
ylim: tuple[float, float] | None = None,
subplot_kws: dict[str, Any] | None = None,
gridspec_kws: dict[str, Any] | None = None,
) -> None: ...
def facet_data(self) -> Generator[tuple[tuple[int, int, int], DataFrame], None, None]: ...
def map(self, func: Callable[..., object], *args: str, **kwargs: Any) -> Self: ...
def map_dataframe(self, func: Callable[..., object], *args: str, **kwargs: Any) -> Self: ...
def facet_axis(self, row_i: int, col_j: int, modify_state: bool = True) -> Axes: ...
def despine(
self,
*,
fig: Figure | None = None,
ax: Axes | None = None,
top: bool = True,
right: bool = True,
left: bool = False,
bottom: bool = False,
offset: int | Mapping[str, int] | None = None,
trim: bool = False,
) -> Self: ...
def set_axis_labels(
self, x_var: str | None = None, y_var: str | None = None, clear_inner: bool = True, **kwargs: Any
) -> Self: ...
def set_xlabels(self, label: str | None = None, clear_inner: bool = True, **kwargs: Any) -> Self: ...
def set_ylabels(self, label: str | None = None, clear_inner: bool = True, **kwargs: Any) -> Self: ...
def set_xticklabels(self, labels: Iterable[str | Text] | None = None, step: int | None = None, **kwargs: Any) -> Self: ...
def set_yticklabels(self, labels: Iterable[str | Text] | None = None, **kwargs: Any) -> Self: ...
def set_titles(
self, template: str | None = None, row_template: str | None = None, col_template: str | None = None, **kwargs: Any
) -> Self: ...
def refline(
self, *, x: float | None = None, y: float | None = None, color: ColorType = ".5", linestyle: str = "--", **line_kws: Any
) -> Self: ...
@property
def axes(self) -> NDArray[Incomplete]: ... # array of `Axes`
@property
def ax(self) -> Axes: ...
@property
def axes_dict(self) -> dict[Any, Axes]: ...
class PairGrid(Grid):
x_vars: list[str]
y_vars: list[str]
square_grid: bool
axes: NDArray[Incomplete] # two-dimensional array of `Axes`
data: DataFrame
diag_sharey: bool
diag_vars: NDArray[Incomplete] | None # array of `str`
diag_axes: NDArray[Incomplete] | None # array of `Axes`
hue_names: list[str]
hue_vals: Series[Incomplete]
hue_kws: dict[str, Any]
palette: _RGBColorPalette
def __init__(
self,
data: DataFrame,
*,
hue: str | None = None,
vars: Iterable[str] | None = None,
x_vars: Iterable[str] | str | None = None,
y_vars: Iterable[str] | str | None = None,
hue_order: Iterable[str] | None = None,
palette: _Palette | None = None,
hue_kws: dict[str, Any] | None = None,
corner: bool = False,
diag_sharey: bool = True,
height: float = 2.5,
aspect: float = 1,
layout_pad: float = 0.5,
despine: bool = True,
dropna: bool = False,
) -> None: ...
def map(self, func: Callable[..., object], **kwargs: Any) -> Self: ...
def map_lower(self, func: Callable[..., object], **kwargs: Any) -> Self: ...
def map_upper(self, func: Callable[..., object], **kwargs: Any) -> Self: ...
def map_offdiag(self, func: Callable[..., object], **kwargs: Any) -> Self: ...
def map_diag(self, func: Callable[..., object], **kwargs: Any) -> Self: ...
class JointGrid(_BaseGrid):
ax_joint: Axes
ax_marg_x: Axes
ax_marg_y: Axes
x: Series[Incomplete]
y: Series[Incomplete]
hue: Series[Incomplete]
def __init__(
self,
data: Incomplete | None = None,
*,
x: Incomplete | None = None,
y: Incomplete | None = None,
hue: Incomplete | None = None,
height: float = 6,
ratio: float = 5,
space: float = 0.2,
palette: _Palette | Colormap | None = None,
hue_order: Iterable[str] | None = None,
hue_norm: Incomplete | None = None,
dropna: bool = False,
xlim: Incomplete | None = None,
ylim: Incomplete | None = None,
marginal_ticks: bool = False,
) -> None: ...
def plot(self, joint_func: Callable[..., object], marginal_func: Callable[..., object], **kwargs: Any) -> Self: ...
def plot_joint(self, func: Callable[..., object], **kwargs: Any) -> Self: ...
def plot_marginals(self, func: Callable[..., object], **kwargs: Any) -> Self: ...
def refline(
self,
*,
x: float | None = None,
y: float | None = None,
joint: bool = True,
marginal: bool = True,
color: ColorType = ".5",
linestyle: str = "--",
**line_kws: Any,
) -> Self: ...
def set_axis_labels(self, xlabel: str = "", ylabel: str = "", **kwargs: Any) -> Self: ...
def pairplot(
data: DataFrame,
*,
hue: str | None = None,
hue_order: Iterable[str] | None = None,
palette: _Palette | None = None,
vars: Iterable[str] | None = None,
x_vars: Iterable[str] | str | None = None,
y_vars: Iterable[str] | str | None = None,
kind: Literal["scatter", "kde", "hist", "reg"] = "scatter",
diag_kind: Literal["auto", "hist", "kde"] | None = "auto",
markers: Incomplete | None = None,
height: float = 2.5,
aspect: float = 1,
corner: bool = False,
dropna: bool = False,
plot_kws: dict[str, Any] | None = None,
diag_kws: dict[str, Any] | None = None,
grid_kws: dict[str, Any] | None = None,
size: float | None = None, # deprecated
) -> PairGrid: ...
def jointplot(
data: Incomplete | None = None,
*,
x: Incomplete | None = None,
y: Incomplete | None = None,
hue: Incomplete | None = None,
kind: str = "scatter", # ideally Literal["scatter", "kde", "hist", "hex", "reg", "resid"] but it is checked with startswith
height: float = 6,
ratio: float = 5,
space: float = 0.2,
dropna: bool = False,
xlim: Incomplete | None = None,
ylim: Incomplete | None = None,
color: ColorType | None = None,
palette: _Palette | Colormap | None = None,
hue_order: Iterable[str] | None = None,
hue_norm: Incomplete | None = None,
marginal_ticks: bool = False,
joint_kws: dict[str, Any] | None = None,
marginal_kws: dict[str, Any] | None = None,
**kwargs: Any,
) -> JointGrid: ...

View File

@@ -0,0 +1,292 @@
from _typeshed import Incomplete
from collections.abc import Callable, Iterable
from typing import Any
from typing_extensions import Literal
from matplotlib.axes import Axes
from matplotlib.typing import ColorType
from ._core.typing import Default
from .axisgrid import FacetGrid
from .utils import _ErrorBar, _Estimator, _Legend, _LogScale, _Palette, _Seed
__all__ = ["catplot", "stripplot", "swarmplot", "boxplot", "violinplot", "boxenplot", "pointplot", "barplot", "countplot"]
def boxplot(
data: Incomplete | None = None,
*,
x: Incomplete | None = None,
y: Incomplete | None = None,
hue: Incomplete | None = None,
order: Incomplete | None = None,
hue_order: Incomplete | None = None,
orient: Literal["v", "h", "x", "y"] | None = None,
color: ColorType | None = None,
palette: _Palette | None = None,
saturation: float = 0.75,
fill: bool = True,
dodge: bool | Literal["auto"] = "auto",
width: float = 0.8,
gap: float = 0,
whis: float = 1.5,
linecolor: ColorType = "auto",
linewidth: float | None = None,
fliersize: float | None = None,
ax: Axes | None = None,
hue_norm: Incomplete | None = None,
native_scale: bool = False,
log_scale: _LogScale | None = None,
formatter: Callable[[Any], str] | None = None,
legend: _Legend = "auto",
**kwargs: Any,
) -> Axes: ...
def violinplot(
data: Incomplete | None = None,
*,
x: Incomplete | None = None,
y: Incomplete | None = None,
hue: Incomplete | None = None,
order: Incomplete | None = None,
hue_order: Incomplete | None = None,
orient: Literal["v", "h", "x", "y"] | None = None,
color: ColorType | None = None,
palette: _Palette | None = None,
saturation: float = 0.75,
fill: bool = True,
inner: str = "box",
split: bool = False,
width: float = 0.8,
dodge: bool | Literal["auto"] = "auto",
gap: float = 0,
linewidth: float | None = None,
linecolor: ColorType = "auto",
cut: float = 2,
gridsize: int = 100,
bw_method: str | float = "scott",
bw_adjust: float = 1,
density_norm: Literal["area", "count", "width"] = "area",
common_norm: bool | None = False,
hue_norm: Incomplete | None = None,
formatter: Callable[[Any], str] | None = None,
log_scale: _LogScale | None = None,
native_scale: bool = False,
legend: _Legend = "auto",
scale: Incomplete = ..., # deprecated
scale_hue: Incomplete = ..., # deprecated
bw: Incomplete = ..., # deprecated
inner_kws: dict[str, Any] | None = None,
ax: Axes | None = None,
**kwargs: Any,
) -> Axes: ...
def boxenplot(
data: Incomplete | None = None,
*,
x: Incomplete | None = None,
y: Incomplete | None = None,
hue: Incomplete | None = None,
order: Incomplete | None = None,
hue_order: Incomplete | None = None,
orient: Literal["v", "h", "x", "y"] | None = None,
color: ColorType | None = None,
palette: _Palette | None = None,
saturation: float = 0.75,
fill: bool = True,
dodge: bool | Literal["auto"] = "auto",
width: float = 0.8,
gap: float = 0,
linewidth: float | None = None,
linecolor: ColorType | None = None,
width_method: Literal["exponential", "linear", "area"] = "exponential",
k_depth: Literal["tukey", "proportion", "trustworthy", "full"] | int = "tukey",
outlier_prop: float = 0.007,
trust_alpha: float = 0.05,
showfliers: bool = True,
hue_norm: Incomplete | None = None,
log_scale: _LogScale | None = None,
native_scale: bool = False,
formatter: Callable[[Any], str] | None = None,
legend: _Legend = "auto",
scale: Incomplete = ..., # deprecated
box_kws: dict[str, Any] | None = None,
flier_kws: dict[str, Any] | None = None,
line_kws: dict[str, Any] | None = None,
ax: Axes | None = None,
**kwargs: Any,
) -> Axes: ...
def stripplot(
data: Incomplete | None = None,
*,
x: Incomplete | None = None,
y: Incomplete | None = None,
hue: Incomplete | None = None,
order: Incomplete | None = None,
hue_order: Incomplete | None = None,
jitter: bool = True,
dodge: bool = False,
orient: Literal["v", "h", "x", "y"] | None = None,
color: ColorType | None = None,
palette: _Palette | None = None,
size: float = 5,
edgecolor: ColorType | Default = ...,
linewidth: float = 0,
hue_norm: Incomplete | None = None,
log_scale: _LogScale | None = None,
native_scale: bool = False,
formatter: Callable[[Any], str] | None = None,
legend: _Legend = "auto",
ax: Axes | None = None,
**kwargs: Any,
) -> Axes: ...
def swarmplot(
data: Incomplete | None = None,
*,
x: Incomplete | None = None,
y: Incomplete | None = None,
hue: Incomplete | None = None,
order: Incomplete | None = None,
hue_order: Incomplete | None = None,
dodge: bool = False,
orient: Literal["v", "h", "x", "y"] | None = None,
color: ColorType | None = None,
palette: _Palette | None = None,
size: float = 5,
edgecolor: ColorType | None = None,
linewidth: float = 0,
hue_norm: Incomplete | None = None,
log_scale: _LogScale | None = None,
native_scale: bool = False,
formatter: Callable[[Any], str] | None = None,
legend: _Legend = "auto",
warn_thresh: float = 0.05,
ax: Axes | None = None,
**kwargs: Any,
) -> Axes: ...
def barplot(
data: Incomplete | None = None,
*,
x: Incomplete | None = None,
y: Incomplete | None = None,
hue: Incomplete | None = None,
order: Iterable[str] | None = None,
hue_order: Iterable[str] | None = None,
estimator: _Estimator = "mean",
errorbar: _ErrorBar | None = ("ci", 95),
n_boot: int = 1000,
units: Incomplete | None = None,
seed: _Seed | None = None,
orient: Literal["v", "h", "x", "y"] | None = None,
color: ColorType | None = None,
palette: _Palette | None = None,
saturation: float = 0.75,
fill: bool = True,
hue_norm: Incomplete | None = None,
width: float = 0.8,
dodge: bool | Literal["auto"] = "auto",
gap: float = 0,
log_scale: _LogScale | None = None,
native_scale: bool = False,
formatter: Callable[[Any], str] | None = None,
legend: _Legend = "auto",
capsize: float = 0,
err_kws: dict[str, Any] | None = None,
ci: Incomplete = ..., # deprecated
errcolor: Incomplete = ..., # deprecated
errwidth: Incomplete = ..., # deprecated
ax: Axes | None = None,
**kwargs: Any,
) -> Axes: ...
def pointplot(
data: Incomplete | None = None,
*,
x: Incomplete | None = None,
y: Incomplete | None = None,
hue: Incomplete | None = None,
order: Incomplete | None = None,
hue_order: Incomplete | None = None,
estimator: _Estimator = "mean",
errorbar: _ErrorBar | None = ("ci", 95),
n_boot: int = 1000,
units: Incomplete | None = None,
seed: _Seed | None = None,
color: ColorType | None = None,
palette: _Palette | None = None,
hue_norm: Incomplete | None = None,
markers: str | Incomplete = ..., # string or list of strings
linestyles: str | Incomplete = ..., # string or list of strings
dodge: bool = False,
log_scale: _LogScale | None = None,
native_scale: bool = False,
orient: Literal["v", "h", "x", "y"] | None = None,
capsize: float = 0,
formatter: Callable[[Any], str] | None = None,
legend: _Legend = "auto",
err_kws: dict[str, Any] | None = None,
ci: Incomplete = ..., # deprecated
errwidth: Incomplete = ..., # deprecated
join: Incomplete = ..., # deprecated
scale: Incomplete = ..., # deprecated
ax: Axes | None = None,
**kwargs: Any,
) -> Axes: ...
def countplot(
data: Incomplete | None = None,
*,
x: Incomplete | None = None,
y: Incomplete | None = None,
hue: Incomplete | None = None,
order: Incomplete | None = None,
hue_order: Incomplete | None = None,
orient: Literal["v", "h", "x", "y"] | None = None,
color: ColorType | None = None,
palette: _Palette | None = None,
saturation: float = 0.75,
fill: bool = True,
hue_norm: Incomplete | None = None,
stat: Literal["count", "percent", "proportion", "probability"] = "count",
width: float = 0.8,
dodge: bool | Literal["auto"] = "auto",
gap: float = 0,
log_scale: _LogScale | None = None,
native_scale: bool = False,
formatter: Callable[[Any], str] | None = None,
legend: _Legend = "auto",
ax: Axes | None = None,
**kwargs: Any,
) -> Axes: ...
def catplot(
data: Incomplete | None = None,
*,
x: Incomplete | None = None,
y: Incomplete | None = None,
hue: Incomplete | None = None,
row: Incomplete | None = None,
col: Incomplete | None = None,
kind: Literal["strip", "swarm", "box", "violin", "boxen", "point", "bar", "count"] = "strip",
estimator: _Estimator = "mean",
errorbar: _ErrorBar | None = ("ci", 95),
n_boot: int = 1000,
units: Incomplete | None = None,
seed: _Seed | None = None,
order: Iterable[str] | None = None,
hue_order: Iterable[str] | None = None,
row_order: Iterable[str] | None = None,
col_order: Iterable[str] | None = None,
col_wrap: int | None = None,
height: float = 5,
aspect: float = 1,
log_scale: _LogScale | None = None,
native_scale: bool = False,
formatter: Callable[[Any], str] | None = None,
orient: Literal["v", "h", "x", "y"] | None = None,
color: ColorType | None = None,
palette: _Palette | None = None,
hue_norm: Incomplete | None = None,
legend: _Legend = "auto",
legend_out: bool = True,
sharex: bool = True,
sharey: bool = True,
margin_titles: bool = False,
facet_kws: dict[str, Any] | None = None,
ci: Incomplete = ..., # deprecated
**kwargs: Any,
) -> FacetGrid: ...

View File

@@ -0,0 +1,15 @@
from matplotlib.colors import ListedColormap
# generated
rocket: ListedColormap
mako: ListedColormap
icefire: ListedColormap
vlag: ListedColormap
flare: ListedColormap
crest: ListedColormap
rocket_r: ListedColormap
mako_r: ListedColormap
icefire_r: ListedColormap
vlag_r: ListedColormap
flare_r: ListedColormap
crest_r: ListedColormap

View File

@@ -0,0 +1,2 @@
from .crayons import crayons as crayons
from .xkcd_rgb import xkcd_rgb as xkcd_rgb

View File

@@ -0,0 +1 @@
crayons: dict[str, str]

View File

@@ -0,0 +1 @@
xkcd_rgb: dict[str, str]

View File

@@ -0,0 +1,160 @@
from _typeshed import Incomplete
from collections.abc import Iterable
from typing import Any
from typing_extensions import Literal
from matplotlib.axes import Axes
from matplotlib.colors import Colormap
from matplotlib.typing import ColorType
from .axisgrid import FacetGrid
from .utils import _LogScale, _Palette
__all__ = ["displot", "histplot", "kdeplot", "ecdfplot", "rugplot", "distplot"]
def histplot(
data: Incomplete | None = None,
*,
x: Incomplete | None = None,
y: Incomplete | None = None,
hue: Incomplete | None = None,
weights: Incomplete | None = None,
stat: str = "count",
bins: Incomplete = "auto",
binwidth: float | tuple[float, float] | None = None,
binrange: Incomplete | None = None,
discrete: bool | None = None,
cumulative: bool = False,
common_bins: bool = True,
common_norm: bool = True,
multiple: Literal["layer", "dodge", "stack", "fill"] = "layer",
element: Literal["bars", "step", "poly"] = "bars",
fill: bool = True,
shrink: float = 1,
kde: bool = False,
kde_kws: dict[str, Any] | None = None,
line_kws: dict[str, Any] | None = None,
thresh: float | None = 0,
pthresh: float | None = None,
pmax: float | None = None,
cbar: bool = False,
cbar_ax: Axes | None = None,
cbar_kws: dict[str, Any] | None = None,
palette: _Palette | Colormap | None = None,
hue_order: Iterable[str] | None = None,
hue_norm: Incomplete | None = None,
color: ColorType | None = None,
log_scale: _LogScale | None = None,
legend: bool = True,
ax: Axes | None = None,
**kwargs: Any,
) -> Axes: ...
def kdeplot(
data: Incomplete | None = None,
*,
x: Incomplete | None = None,
y: Incomplete | None = None,
hue: Incomplete | None = None,
weights: Incomplete | None = None,
palette: _Palette | Colormap | None = None,
hue_order: Iterable[str] | None = None,
hue_norm: Incomplete | None = None,
color: ColorType | None = None,
fill: bool | None = None,
multiple: Literal["layer", "stack", "fill"] = "layer",
common_norm: bool = True,
common_grid: bool = False,
cumulative: bool = False,
bw_method: str = "scott",
bw_adjust: float = 1,
warn_singular: bool = True,
log_scale: _LogScale | None = None,
levels: int | Iterable[int] = 10,
thresh: float = 0.05,
gridsize: int = 200,
cut: float = 3,
clip: Incomplete | None = None,
legend: bool = True,
cbar: bool = False,
cbar_ax: Axes | None = None,
cbar_kws: dict[str, Any] | None = None,
ax: Axes | None = None,
**kwargs: Any,
) -> Axes: ...
def ecdfplot(
data: Incomplete | None = None,
*,
x: Incomplete | None = None,
y: Incomplete | None = None,
hue: Incomplete | None = None,
weights: Incomplete | None = None,
stat: Literal["proportion", "count"] = "proportion",
complementary: bool = False,
palette: _Palette | Colormap | None = None,
hue_order: Iterable[str] | None = None,
hue_norm: Incomplete | None = None,
log_scale: _LogScale | None = None,
legend: bool = True,
ax: Axes | None = None,
**kwargs: Any,
) -> Axes: ...
def rugplot(
data: Incomplete | None = None,
*,
x: Incomplete | None = None,
y: Incomplete | None = None,
hue: Incomplete | None = None,
height: float = 0.025,
expand_margins: bool = True,
palette: _Palette | Colormap | None = None,
hue_order: Iterable[str] | None = None,
hue_norm: Incomplete | None = None,
legend: bool = True,
ax: Axes | None = None,
**kwargs: Any,
) -> Axes: ...
def displot(
data: Incomplete | None = None,
*,
x: Incomplete | None = None,
y: Incomplete | None = None,
hue: Incomplete | None = None,
row: Incomplete | None = None,
col: Incomplete | None = None,
weights: Incomplete | None = None,
kind: Literal["hist", "kde", "ecdf"] = "hist",
rug: bool = False,
rug_kws: dict[str, Any] | None = None,
log_scale: _LogScale | None = None,
legend: bool = True,
palette: _Palette | Colormap | None = None,
hue_order: Iterable[str] | None = None,
hue_norm: Incomplete | None = None,
color: ColorType | None = None,
col_wrap: int | None = None,
row_order: Iterable[str] | None = None,
col_order: Iterable[str] | None = None,
height: float = 5,
aspect: float = 1,
facet_kws: dict[str, Any] | None = None,
**kwargs: Any,
) -> FacetGrid: ...
def distplot( # deprecated
a: Incomplete | None = None,
bins: Incomplete | None = None,
hist: bool = True,
kde: bool = True,
rug: bool = False,
fit: Incomplete | None = None,
hist_kws: dict[str, Any] | None = None,
kde_kws: dict[str, Any] | None = None,
rug_kws: dict[str, Any] | None = None,
fit_kws: dict[str, Any] | None = None,
color: ColorType | None = None,
vertical: bool = False,
norm_hist: bool = False,
axlabel: str | Literal[False] | None = None,
label: Incomplete | None = None,
ax: Axes | None = None,
x: Incomplete | None = None,
) -> Axes: ...

View File

View File

@@ -0,0 +1,9 @@
from typing_extensions import Literal
__version__: str
__version_info__: tuple[int, int, int]
system: str
def user_cache_dir(
appname: str | None = None, appauthor: Literal[False] | str | None = None, version: str | None = None, opinion: bool = True
) -> str: ...

View File

@@ -0,0 +1,69 @@
from _typeshed import Incomplete, Unused
from collections.abc import Callable, Iterable, Iterator, Mapping, MutableSequence
from typing import Any, ClassVar, NamedTuple, TypeVar, overload
from typing_extensions import SupportsIndex
_S = TypeVar("_S", bound=MutableSequence[str])
def strip_blank_lines(l: _S) -> _S: ...
class Reader:
def __init__(self, data: str | list[str]) -> None: ...
@overload
def __getitem__(self, n: slice) -> list[str]: ...
@overload
def __getitem__(self, n: SupportsIndex) -> str: ...
def reset(self) -> None: ...
def read(self) -> str: ...
def seek_next_non_empty_line(self) -> None: ...
def eof(self) -> bool: ...
def read_to_condition(self, condition_func: Callable[[str], bool]) -> list[str]: ...
def read_to_next_empty_line(self) -> list[str]: ...
def read_to_next_unindented_line(self) -> list[str]: ...
def peek(self, n: int = 0) -> str: ...
def is_empty(self) -> bool: ...
class ParseError(Exception): ...
class Parameter(NamedTuple):
name: str
type: str
desc: list[str]
class NumpyDocString(Mapping[str, Any]):
sections: ClassVar[dict[str, Any]]
def __init__(self, docstring: str, config: Unused = {}) -> None: ...
def __getitem__(self, key: str) -> Any: ...
def __setitem__(self, key: str, val: Any) -> None: ...
def __iter__(self) -> Iterator[str]: ...
def __len__(self) -> int: ...
empty_description: str
def indent(str: str | None, indent: int = 4) -> str: ...
def dedent_lines(lines: Iterable[str]) -> list[str]: ...
def header(text: str, style: str = "-") -> str: ...
class FunctionDoc(NumpyDocString):
def __init__(self, func, role: str = "func", doc: str | None = None, config: Unused = {}) -> None: ...
def get_func(self) -> tuple[Incomplete, str]: ...
class ClassDoc(NumpyDocString):
extra_public_methods: list[str]
show_inherited_members: bool
@overload
def __init__(
self, cls: None, doc: str, modulename: str = "", func_doc: type[FunctionDoc] = ..., config: Mapping[str, Any] = {}
) -> None: ...
@overload
def __init__(
self,
cls: type,
doc: str | None = None,
modulename: str = "",
func_doc: type[FunctionDoc] = ...,
config: Mapping[str, Any] = {},
) -> None: ...
@property
def methods(self) -> list[str]: ...
@property
def properties(self) -> list[str]: ...

42
stubs/seaborn/seaborn/external/husl.pyi vendored Normal file
View File

@@ -0,0 +1,42 @@
from collections.abc import Iterable
m: list[list[float]]
m_inv: list[list[float]]
refX: float
refY: float
refZ: float
refU: float
refV: float
lab_e: float
lab_k: float
def husl_to_rgb(h: float, s: float, l: float) -> list[float]: ...
def husl_to_hex(h: float, s: float, l: float) -> str: ...
def rgb_to_husl(r: float, g: float, b: float) -> list[float]: ...
def hex_to_husl(hex: str) -> list[float]: ...
def huslp_to_rgb(h: float, s: float, l: float) -> list[float]: ...
def huslp_to_hex(h: float, s: float, l: float) -> str: ...
def rgb_to_huslp(r: float, g: float, b: float) -> list[float]: ...
def hex_to_huslp(hex: str) -> list[float]: ...
def lch_to_rgb(l: float, c: float, h: float) -> list[float]: ...
def rgb_to_lch(r: float, g: float, b: float) -> list[float]: ...
def max_chroma(L: float, H: float) -> float: ...
def max_chroma_pastel(L: float) -> float: ...
def dot_product(a: Iterable[float], b: Iterable[float]) -> float: ...
def f(t: float) -> float: ...
def f_inv(t: float) -> float: ...
def from_linear(c: float) -> float: ...
def to_linear(c: float) -> float: ...
def rgb_prepare(triple: Iterable[float]) -> list[int]: ...
def hex_to_rgb(hex: str) -> list[float]: ...
def rgb_to_hex(triple: Iterable[float]) -> str: ...
def xyz_to_rgb(triple: Iterable[float]) -> list[float]: ...
def rgb_to_xyz(triple: Iterable[float]) -> list[float]: ...
def xyz_to_luv(triple: Iterable[float]) -> list[float]: ...
def luv_to_xyz(triple: Iterable[float]) -> list[float]: ...
def luv_to_lch(triple: Iterable[float]) -> list[float]: ...
def lch_to_luv(triple: Iterable[float]) -> list[float]: ...
def husl_to_lch(triple: Iterable[float]) -> list[float]: ...
def lch_to_husl(triple: Iterable[float]) -> list[float]: ...
def huslp_to_lch(triple: Iterable[float]) -> list[float]: ...
def lch_to_huslp(triple: Iterable[float]) -> list[float]: ...

25
stubs/seaborn/seaborn/external/kde.pyi vendored Normal file
View File

@@ -0,0 +1,25 @@
from collections.abc import Callable
from typing_extensions import Literal, TypeAlias
import numpy as np
from numpy.typing import ArrayLike, NDArray
__all__ = ["gaussian_kde"]
_Scalar: TypeAlias = np.generic | bool | int | float | complex | bytes | memoryview # see np.isscalar
_BwMethodType: TypeAlias = Literal["scott", "silverman"] | Callable[[gaussian_kde], object] | _Scalar | None
class gaussian_kde:
dataset: NDArray[np.float64]
def __init__(self, dataset: ArrayLike, bw_method: _BwMethodType = None, weights: ArrayLike | None = None) -> None: ...
def evaluate(self, points: ArrayLike) -> NDArray[np.float64]: ...
__call__ = evaluate
def scotts_factor(self) -> float: ...
def silverman_factor(self) -> float: ...
covariance_factor = scotts_factor
def set_bandwidth(self, bw_method: _BwMethodType = None) -> None: ...
def pdf(self, x: ArrayLike) -> NDArray[np.float64]: ...
@property
def weights(self) -> NDArray[np.float64]: ...
@property
def neff(self) -> NDArray[np.float64]: ...

View File

@@ -0,0 +1,45 @@
__all__ = ["Version", "InvalidVersion", "VERSION_PATTERN"]
class InvalidVersion(ValueError): ...
class _BaseVersion:
def __hash__(self) -> int: ...
def __lt__(self, other: _BaseVersion) -> bool: ...
def __le__(self, other: _BaseVersion) -> bool: ...
def __eq__(self, other: object) -> bool: ...
def __ge__(self, other: _BaseVersion) -> bool: ...
def __gt__(self, other: _BaseVersion) -> bool: ...
def __ne__(self, other: object) -> bool: ...
VERSION_PATTERN: str
class Version(_BaseVersion):
def __init__(self, version: str) -> None: ...
@property
def epoch(self) -> int: ...
@property
def release(self) -> tuple[int, ...]: ...
@property
def pre(self) -> tuple[str, int] | None: ...
@property
def post(self) -> int | None: ...
@property
def dev(self) -> int | None: ...
@property
def local(self) -> str | None: ...
@property
def public(self) -> str: ...
@property
def base_version(self) -> str: ...
@property
def is_prerelease(self) -> bool: ...
@property
def is_postrelease(self) -> bool: ...
@property
def is_devrelease(self) -> bool: ...
@property
def major(self) -> int: ...
@property
def minor(self) -> int: ...
@property
def micro(self) -> int: ...

View File

@@ -0,0 +1,179 @@
from _typeshed import Incomplete
from collections.abc import Mapping, Sequence
from typing_extensions import Literal, Self
import numpy as np
from matplotlib.axes import Axes
from matplotlib.colors import Colormap, ListedColormap
from matplotlib.gridspec import GridSpec
from matplotlib.typing import ColorType
from numpy.typing import ArrayLike, NDArray
from pandas import DataFrame
from .axisgrid import Grid
__all__ = ["heatmap", "clustermap"]
def heatmap(
data: Incomplete,
*,
vmin: float | None = None,
vmax: float | None = None,
cmap: str | list[ColorType] | Colormap | None = None,
center: float | None = None,
robust: bool = False,
annot: bool | ArrayLike | None = None,
fmt: str = ".2g",
annot_kws: dict[str, Incomplete] | None = None,
linewidths: float = 0,
linecolor: ColorType = "white",
cbar: bool = True,
cbar_kws: dict[str, Incomplete] | None = None,
cbar_ax: Axes | None = None,
square: bool = False,
xticklabels: Literal["auto"] | bool | int | Sequence[str] = "auto",
yticklabels: Literal["auto"] | bool | int | Sequence[str] = "auto",
mask: NDArray[np.bool_] | DataFrame | None = None,
ax: Axes | None = None,
**kwargs: Incomplete,
) -> Axes: ...
class _DendrogramPlotter:
axis: int
array: NDArray[Incomplete]
data: DataFrame
shape: tuple[int, int]
metric: str
method: str
label: bool
rotate: bool
linkage: NDArray[Incomplete]
dendrogram: dict[str, list[Incomplete]]
xticks: list[float] | NDArray[Incomplete]
yticks: list[float] | NDArray[Incomplete]
xticklabels: list[str]
yticklabels: list[str]
ylabel: str
xlabel: str
dependent_coord: list[list[float]]
independent_coord: list[list[float]]
def __init__(
self, data: DataFrame, linkage: NDArray[Incomplete] | None, metric: str, method: str, axis: int, label: bool, rotate: bool
) -> None: ...
@property
def calculated_linkage(self) -> NDArray[Incomplete]: ...
def calculate_dendrogram(self) -> dict[str, list[Incomplete]]: ...
@property
def reordered_ind(self) -> list[int]: ...
def plot(self, ax: Axes, tree_kws: dict[str, Incomplete]) -> Self: ...
def dendrogram(
data: DataFrame,
*,
linkage: NDArray[Incomplete] | None = None,
axis: int = 1,
label: bool = True,
metric: str = "euclidean",
method: str = "average",
rotate: bool = False,
tree_kws: dict[str, Incomplete] | None = None,
ax: Axes | None = None,
) -> _DendrogramPlotter: ...
class ClusterGrid(Grid):
data: DataFrame
data2d: DataFrame
mask: DataFrame
row_colors: Incomplete
row_color_labels: Incomplete
col_colors: Incomplete
col_color_labels: Incomplete
gs: GridSpec
ax_row_dendrogram: Axes
ax_col_dendrogram: Axes
ax_row_colors: Axes | None
ax_col_colors: Axes | None
ax_heatmap: Axes
ax_cbar: Axes | None
cax: Axes | None
cbar_pos: Incomplete
dendrogram_row: _DendrogramPlotter | None
dendrogram_col: _DendrogramPlotter | None
def __init__(
self,
data: Incomplete,
pivot_kws: Mapping[str, Incomplete] | None = None,
z_score: int | None = None,
standard_scale: int | None = None,
figsize: tuple[float, float] | None = None,
row_colors: Incomplete | None = None,
col_colors: Incomplete | None = None,
mask: NDArray[np.bool_] | DataFrame | None = None,
dendrogram_ratio: float | tuple[float, float] | None = None,
colors_ratio: float | tuple[float, float] | None = None,
cbar_pos: tuple[float, float, float, float] | None = None,
) -> None: ...
def format_data(
self,
data: DataFrame,
pivot_kws: Mapping[str, Incomplete] | None,
z_score: int | None = None,
standard_scale: int | None = None,
) -> DataFrame: ...
@staticmethod
def z_score(data2d: DataFrame, axis: int = 1) -> DataFrame: ...
@staticmethod
def standard_scale(data2d: DataFrame, axis: int = 1) -> DataFrame: ...
def dim_ratios(self, colors: Incomplete, dendrogram_ratio: float, colors_ratio: float) -> list[float]: ...
@staticmethod
def color_list_to_matrix_and_cmap(
colors: Sequence[ColorType], ind: list[int], axis: int = 0
) -> tuple[NDArray[np.int_], ListedColormap]: ...
def plot_dendrograms(
self,
row_cluster: bool,
col_cluster: bool,
metric: str,
method: str,
row_linkage: NDArray[Incomplete] | None,
col_linkage: NDArray[Incomplete] | None,
tree_kws: dict[str, Incomplete] | None,
) -> None: ...
def plot_colors(self, xind: Incomplete, yind: Incomplete, **kws: Incomplete) -> None: ...
def plot_matrix(self, colorbar_kws: dict[str, Incomplete], xind: Incomplete, yind: Incomplete, **kws: Incomplete) -> None: ...
def plot(
self,
metric: str,
method: str,
colorbar_kws: dict[str, Incomplete] | None,
row_cluster: bool,
col_cluster: bool,
row_linkage: NDArray[Incomplete] | None,
col_linkage: NDArray[Incomplete] | None,
tree_kws: dict[str, Incomplete] | None,
**kws: Incomplete,
) -> Self: ...
def clustermap(
data: Incomplete,
*,
pivot_kws: dict[str, Incomplete] | None = None,
method: str = "average",
metric: str = "euclidean",
z_score: int | None = None,
standard_scale: int | None = None,
figsize: tuple[float, float] | None = (10, 10),
cbar_kws: dict[str, Incomplete] | None = None,
row_cluster: bool = True,
col_cluster: bool = True,
row_linkage: NDArray[Incomplete] | None = None,
col_linkage: NDArray[Incomplete] | None = None,
row_colors: Incomplete | None = None,
col_colors: Incomplete | None = None,
mask: NDArray[np.bool_] | DataFrame | None = None,
dendrogram_ratio: float | tuple[float, float] = 0.2,
colors_ratio: float | tuple[float, float] = 0.03,
cbar_pos: tuple[float, float, float, float] | None = (0.02, 0.8, 0.05, 0.18),
tree_kws: dict[str, Incomplete] | None = None,
**kwargs: Incomplete,
) -> ClusterGrid: ...

View File

@@ -0,0 +1,8 @@
from collections.abc import Sequence
from matplotlib.typing import ColorType
__all__ = ["palplot", "dogplot"]
def palplot(pal: Sequence[ColorType], size: int = 1) -> None: ...
def dogplot(*_, **__) -> None: ...

View File

@@ -0,0 +1,21 @@
from seaborn._core.moves import Dodge as Dodge, Jitter as Jitter, Move as Move, Norm as Norm, Shift as Shift, Stack as Stack
from seaborn._core.plot import Plot as Plot
from seaborn._core.scales import (
Boolean as Boolean,
Continuous as Continuous,
Nominal as Nominal,
Scale as Scale,
Temporal as Temporal,
)
from seaborn._marks.area import Area as Area, Band as Band
from seaborn._marks.bar import Bar as Bar, Bars as Bars
from seaborn._marks.base import Mark as Mark
from seaborn._marks.dot import Dot as Dot, Dots as Dots
from seaborn._marks.line import Dash as Dash, Line as Line, Lines as Lines, Path as Path, Paths as Paths, Range as Range
from seaborn._marks.text import Text as Text
from seaborn._stats.aggregation import Agg as Agg, Est as Est
from seaborn._stats.base import Stat as Stat
from seaborn._stats.counting import Count as Count, Hist as Hist
from seaborn._stats.density import KDE as KDE
from seaborn._stats.order import Perc as Perc
from seaborn._stats.regression import PolyFit as PolyFit

View File

@@ -0,0 +1,149 @@
from collections.abc import Iterable, Sequence
from typing import TypeVar, overload
from typing_extensions import Literal, Self, TypeAlias
from matplotlib.colors import Colormap, LinearSegmentedColormap, ListedColormap
from matplotlib.typing import ColorType
__all__ = [
"color_palette",
"hls_palette",
"husl_palette",
"mpl_palette",
"dark_palette",
"light_palette",
"diverging_palette",
"blend_palette",
"xkcd_palette",
"crayon_palette",
"cubehelix_palette",
"set_color_codes",
]
_ColorT = TypeVar("_ColorT", bound=ColorType)
SEABORN_PALETTES: dict[str, list[str]]
MPL_QUAL_PALS: dict[str, int]
QUAL_PALETTE_SIZES: dict[str, int]
QUAL_PALETTES: list[str]
class _ColorPalette(list[_ColorT]):
def __enter__(self) -> Self: ...
def __exit__(self, *args: object) -> None: ...
def as_hex(self) -> _ColorPalette[str]: ...
_RGBColorPalette: TypeAlias = _ColorPalette[tuple[float, float, float]]
_SeabornPaletteName: TypeAlias = Literal[
"deep", "deep6", "muted", "muted6", "pastel", "pastel6", "bright", "bright6", "dark", "dark6", "colorblind", "colorblind6"
]
@overload
def color_palette( # type: ignore[misc]
palette: _SeabornPaletteName | None = None, n_colors: int | None = None, desat: float | None = None, *, as_cmap: Literal[True]
) -> list[str]: ... # this might be a bug in seaborn because we expect the return type to be a Colormap instance
@overload
def color_palette(
palette: str | Sequence[ColorType], n_colors: int | None = None, desat: float | None = None, *, as_cmap: Literal[True]
) -> Colormap: ...
@overload
def color_palette(
palette: str | Sequence[ColorType] | None = None,
n_colors: int | None = None,
desat: float | None = None,
as_cmap: Literal[False] = False,
) -> _RGBColorPalette: ...
@overload
def hls_palette(
n_colors: int = 6, h: float = 0.01, l: float = 0.6, s: float = 0.65, *, as_cmap: Literal[True]
) -> ListedColormap: ...
@overload
def hls_palette(
n_colors: int = 6, h: float = 0.01, l: float = 0.6, s: float = 0.65, as_cmap: Literal[False] = False
) -> _RGBColorPalette: ...
@overload
def husl_palette(
n_colors: int = 6, h: float = 0.01, s: float = 0.9, l: float = 0.65, *, as_cmap: Literal[True]
) -> ListedColormap: ...
@overload
def husl_palette(
n_colors: int = 6, h: float = 0.01, s: float = 0.9, l: float = 0.65, as_cmap: Literal[False] = False
) -> _RGBColorPalette: ...
@overload
def mpl_palette(name: str, n_colors: int = 6, *, as_cmap: Literal[True]) -> LinearSegmentedColormap: ...
@overload
def mpl_palette(name: str, n_colors: int = 6, as_cmap: Literal[False] = False) -> _RGBColorPalette: ...
@overload
def dark_palette(
color: ColorType, n_colors: int = 6, reverse: bool = False, *, as_cmap: Literal[True], input: str = "rgb"
) -> LinearSegmentedColormap: ...
@overload
def dark_palette(
color: ColorType, n_colors: int = 6, reverse: bool = False, as_cmap: Literal[False] = False, input: str = "rgb"
) -> _RGBColorPalette: ...
@overload
def light_palette(
color: ColorType, n_colors: int = 6, reverse: bool = False, *, as_cmap: Literal[True], input: str = "rgb"
) -> LinearSegmentedColormap: ...
@overload
def light_palette(
color: ColorType, n_colors: int = 6, reverse: bool = False, as_cmap: Literal[False] = False, input: str = "rgb"
) -> _RGBColorPalette: ...
@overload
def diverging_palette(
h_neg: float,
h_pos: float,
s: float = 75,
l: float = 50,
sep: int = 1,
n: int = 6,
center: Literal["light", "dark"] = "light",
*,
as_cmap: Literal[True],
) -> LinearSegmentedColormap: ...
@overload
def diverging_palette(
h_neg: float,
h_pos: float,
s: float = 75,
l: float = 50,
sep: int = 1,
n: int = 6,
center: Literal["light", "dark"] = "light",
as_cmap: Literal[False] = False,
) -> _RGBColorPalette: ...
@overload
def blend_palette(
colors: Iterable[ColorType], n_colors: int = 6, *, as_cmap: Literal[True], input: str = "rgb"
) -> LinearSegmentedColormap: ...
@overload
def blend_palette(
colors: Iterable[ColorType], n_colors: int = 6, as_cmap: Literal[False] = False, input: str = "rgb"
) -> _RGBColorPalette: ...
def xkcd_palette(colors: Iterable[str]) -> _RGBColorPalette: ...
def crayon_palette(colors: Iterable[str]) -> _RGBColorPalette: ...
@overload
def cubehelix_palette(
n_colors: int = 6,
start: float = 0,
rot: float = 0.4,
gamma: float = 1.0,
hue: float = 0.8,
light: float = 0.85,
dark: float = 0.15,
reverse: bool = False,
*,
as_cmap: Literal[True],
) -> ListedColormap: ...
@overload
def cubehelix_palette(
n_colors: int = 6,
start: float = 0,
rot: float = 0.4,
gamma: float = 1.0,
hue: float = 0.8,
light: float = 0.85,
dark: float = 0.15,
reverse: bool = False,
as_cmap: Literal[False] = False,
) -> _RGBColorPalette: ...
def set_color_codes(palette: str = "deep") -> None: ...

View File

@@ -0,0 +1,67 @@
from collections.abc import Callable, Sequence
from typing import Any, TypeVar
from typing_extensions import Literal
from matplotlib.typing import ColorType
__all__ = [
"set_theme",
"set",
"reset_defaults",
"reset_orig",
"axes_style",
"set_style",
"plotting_context",
"set_context",
"set_palette",
]
_KT = TypeVar("_KT")
_VT = TypeVar("_VT")
_F = TypeVar("_F", bound=Callable[..., Any])
def set_theme(
context: Literal["paper", "notebook", "talk", "poster"] | dict[str, Any] = "notebook",
style: Literal["white", "dark", "whitegrid", "darkgrid", "ticks"] | dict[str, Any] = "darkgrid",
palette: str | Sequence[ColorType] | None = "deep",
font: str = "sans-serif",
font_scale: float = 1,
color_codes: bool = True,
rc: dict[str, Any] | None = None,
) -> None: ...
# def set(*args, **kwargs) -> None: ... # deprecated alias for set_theme
set = set_theme
def reset_defaults() -> None: ...
def reset_orig() -> None: ...
def axes_style(
style: Literal["white", "dark", "whitegrid", "darkgrid", "ticks"] | dict[str, Any] | None = None,
rc: dict[str, Any] | None = None,
) -> _AxesStyle[str, Any]: ...
def set_style(
style: Literal["white", "dark", "whitegrid", "darkgrid", "ticks"] | dict[str, Any] | None = None,
rc: dict[str, Any] | None = None,
) -> None: ...
def plotting_context(
context: Literal["paper", "notebook", "talk", "poster"] | dict[str, Any] | None = None,
font_scale: float = 1,
rc: dict[str, Any] | None = None,
) -> _PlottingContext[str, Any]: ...
def set_context(
context: Literal["paper", "notebook", "talk", "poster"] | dict[str, Any] | None = None,
font_scale: float = 1,
rc: dict[str, Any] | None = None,
) -> None: ...
class _RCAesthetics(dict[_KT, _VT]):
def __enter__(self) -> None: ...
def __exit__(self, exc_type, exc_value, exc_tb) -> None: ...
def __call__(self, func: _F) -> _F: ...
class _AxesStyle(_RCAesthetics[_KT, _VT]): ...
class _PlottingContext(_RCAesthetics[_KT, _VT]): ...
def set_palette(
palette: str | Sequence[ColorType] | None, n_colors: int | None = None, desat: float | None = None, color_codes: bool = False
) -> None: ...

View File

@@ -0,0 +1,106 @@
from _typeshed import Incomplete
from collections.abc import Iterable
from typing import Any
from typing_extensions import Literal
import pandas as pd
from matplotlib.axes import Axes
from matplotlib.typing import ColorType
from .axisgrid import FacetGrid
from .utils import _Palette, _Seed
__all__ = ["lmplot", "regplot", "residplot"]
def lmplot(
data: Incomplete | None = None,
*,
x: str | None = None,
y: str | None = None,
hue: str | None = None,
col: str | None = None,
row: str | None = None,
palette: _Palette | None = None,
col_wrap: int | None = None,
height: float = 5,
aspect: float = 1,
markers: str = "o",
sharex: bool | Literal["col", "row"] | None = None,
sharey: bool | Literal["col", "row"] | None = None,
hue_order: Iterable[str] | None = None,
col_order: Iterable[str] | None = None,
row_order: Iterable[str] | None = None,
legend: bool = True,
legend_out: Incomplete | None = None,
x_estimator: Incomplete | None = None,
x_bins: Incomplete | None = None,
x_ci: Literal["ci", "sd"] | int | None = "ci",
scatter: bool = True,
fit_reg: bool = True,
ci: int | None = 95,
n_boot: int = 1000,
units: str | None = None,
seed: _Seed | None = None,
order: int = 1,
logistic: bool = False,
lowess: bool = False,
robust: bool = False,
logx: bool = False,
x_partial: str | None = None,
y_partial: str | None = None,
truncate: bool = True,
x_jitter: float | None = None,
y_jitter: float | None = None,
scatter_kws: dict[str, Any] | None = None,
line_kws: dict[str, Any] | None = None,
facet_kws: dict[str, Any] | None = None,
) -> FacetGrid: ...
def regplot(
data: pd.DataFrame | None = None,
*,
x: Incomplete | None = None,
y: Incomplete | None = None,
x_estimator: Incomplete | None = None,
x_bins: Incomplete | None = None,
x_ci: Literal["ci", "sd"] | int | None = "ci",
scatter: bool = True,
fit_reg: bool = True,
ci: int | None = 95,
n_boot: int = 1000,
units: str | None = None,
seed: _Seed | None = None,
order: int = 1,
logistic: bool = False,
lowess: bool = False,
robust: bool = False,
logx: bool = False,
x_partial: str | None = None,
y_partial: str | None = None,
truncate: bool = True,
dropna: bool = True,
x_jitter: float | None = None,
y_jitter: float | None = None,
label: str | None = None,
color: ColorType | None = None,
marker: str = "o",
scatter_kws: dict[str, Any] | None = None,
line_kws: dict[str, Any] | None = None,
ax: Axes | None = None,
) -> Axes: ...
def residplot(
data: Incomplete | None = None,
*,
x: Incomplete | None = None,
y: Incomplete | None = None,
x_partial: Incomplete | None = None,
y_partial: Incomplete | None = None,
lowess: bool = False,
order: int = 1,
robust: bool = False,
dropna: bool = True,
label: str | None = None,
color: ColorType | None = None,
scatter_kws: dict[str, Any] | None = None,
line_kws: dict[str, Any] | None = None,
ax: Axes | None = None,
) -> Axes: ...

View File

@@ -0,0 +1,96 @@
from _typeshed import Incomplete
from collections.abc import Iterable
from typing import Any
from typing_extensions import Literal, TypeAlias
from matplotlib.axes import Axes
from matplotlib.colors import Colormap
from .axisgrid import FacetGrid
from .utils import _ErrorBar, _Estimator, _Legend, _Palette, _Seed
__all__ = ["relplot", "scatterplot", "lineplot"]
_Sizes: TypeAlias = list[float] | dict[str, float] | tuple[float, float]
def lineplot(
data: Incomplete | None = None,
*,
x: Incomplete | None = None,
y: Incomplete | None = None,
hue: Incomplete | None = None,
size: Incomplete | None = None,
style: Incomplete | None = None,
units: Incomplete | None = None,
palette: _Palette | Colormap | None = None,
hue_order: Iterable[Any] | None = None,
hue_norm: Incomplete | None = None,
sizes: _Sizes | None = None,
size_order: Iterable[Any] | None = None,
size_norm: Incomplete | None = None,
dashes: bool | list[Incomplete] | dict[str, Incomplete] = True,
markers: Incomplete | None = None,
style_order: Iterable[Any] | None = None,
estimator: _Estimator | None = "mean",
errorbar: _ErrorBar | None = ("ci", 95),
n_boot: int = 1000,
seed: _Seed | None = None,
orient: Literal["x", "y"] = "x",
sort: bool = True,
err_style: Literal["band", "bars"] = "band",
err_kws: dict[str, Any] | None = None,
legend: _Legend = "auto",
ci: str | int | None = "deprecated", # deprecated
ax: Axes | None = None,
**kwargs: Any,
) -> Axes: ...
def scatterplot(
data: Incomplete | None = None,
*,
x: Incomplete | None = None,
y: Incomplete | None = None,
hue: Incomplete | None = None,
size: Incomplete | None = None,
style: Incomplete | None = None,
palette: _Palette | Colormap | None = None,
hue_order: Iterable[Any] | None = None,
hue_norm: Incomplete | None = None,
sizes: _Sizes | None = None,
size_order: Iterable[Any] | None = None,
size_norm: Incomplete | None = None,
markers: Incomplete = True,
style_order: Iterable[Any] | None = None,
legend: _Legend = "auto",
ax: Axes | None = None,
**kwargs: Any,
) -> Axes: ...
def relplot(
data: Incomplete | None = None,
*,
x: Incomplete | None = None,
y: Incomplete | None = None,
hue: Incomplete | None = None,
size: Incomplete | None = None,
style: Incomplete | None = None,
units: Incomplete | None = None,
row: Incomplete | None = None,
col: Incomplete | None = None,
col_wrap: int | None = None,
row_order: Iterable[Any] | None = None,
col_order: Iterable[Any] | None = None,
palette: _Palette | Colormap | None = None,
hue_order: Iterable[Any] | None = None,
hue_norm: Incomplete | None = None,
sizes: _Sizes | None = None,
size_order: Iterable[Any] | None = None,
size_norm: Incomplete | None = None,
markers: Incomplete | None = None,
dashes: Incomplete | None = None,
style_order: Iterable[Any] | None = None,
legend: _Legend = "auto",
kind: Literal["scatter", "line"] = "scatter",
height: float = 5,
aspect: float = 1,
facet_kws: dict[str, Any] | None = None,
**kwargs: Any,
) -> FacetGrid: ...

View File

@@ -0,0 +1,81 @@
from _typeshed import Incomplete, SupportsGetItem
from collections.abc import Callable, Iterable, Mapping, Sequence
from typing import Any, TypeVar, overload
from typing_extensions import Literal, SupportsIndex, TypeAlias
import numpy as np
from matplotlib.axes import Axes
from matplotlib.figure import Figure
from matplotlib.legend import Legend
from matplotlib.text import Text
from matplotlib.ticker import Locator
from matplotlib.typing import ColorType
from numpy.typing import ArrayLike, NDArray
from pandas import DataFrame
from seaborn.axisgrid import Grid
__all__ = [
"desaturate",
"saturate",
"set_hls_values",
"move_legend",
"despine",
"get_dataset_names",
"get_data_home",
"load_dataset",
]
_VectorT = TypeVar("_VectorT", bound=SupportsGetItem[Any, Any])
# Type aliases used heavily throughout seaborn
_ErrorBar: TypeAlias = str | tuple[str, float] | Callable[[Iterable[float]], tuple[float, float]] # noqa: Y047
_Estimator: TypeAlias = str | Callable[..., Incomplete] # noqa: Y047
_Legend: TypeAlias = Literal["auto", "brief", "full"] | bool # noqa: Y047
_LogScale: TypeAlias = bool | float | tuple[bool | float, bool | float] # noqa: Y047
_Palette: TypeAlias = str | Sequence[ColorType] | dict[Incomplete, ColorType] # noqa: Y047
_Seed: TypeAlias = int | np.random.Generator | np.random.RandomState # noqa: Y047
DATASET_SOURCE: str
DATASET_NAMES_URL: str
def ci_to_errsize(cis: ArrayLike, heights: ArrayLike) -> NDArray[np.float64]: ...
def desaturate(color: ColorType, prop: float) -> tuple[float, float, float]: ...
def saturate(color: ColorType) -> tuple[float, float, float]: ...
def set_hls_values(
color: ColorType, h: float | None = None, l: float | None = None, s: float | None = None
) -> tuple[float, float, float]: ...
def axlabel(xlabel: str, ylabel: str, **kwargs: Any) -> None: ... # deprecated
def remove_na(vector: _VectorT) -> _VectorT: ...
def get_color_cycle() -> list[str]: ...
# Please modify `seaborn.axisgrid.FacetGrid.despine` when modifying despine here.
def despine(
fig: Figure | None = None,
ax: Axes | None = None,
top: bool = True,
right: bool = True,
left: bool = False,
bottom: bool = False,
offset: int | Mapping[str, int] | None = None,
trim: bool = False,
) -> None: ...
def move_legend(obj: Grid | Axes | Figure, loc: str | int, **kwargs: Any) -> None: ...
def ci(
a: float | ArrayLike, which: float | ArrayLike = 95, axis: SupportsIndex | Sequence[SupportsIndex] | None = None
) -> NDArray[np.float64]: ...
def get_dataset_names() -> list[str]: ...
def get_data_home(data_home: str | None = None) -> str: ...
def load_dataset(name: str, cache: bool = True, data_home: str | None = None, **kws: Any) -> DataFrame: ...
def axis_ticklabels_overlap(labels: Iterable[Text]) -> bool: ...
def axes_ticklabels_overlap(ax: Axes) -> tuple[bool, bool]: ...
def locator_to_legend_entries(
locator: Locator, limits: Iterable[float], dtype: Incomplete
) -> tuple[list[Incomplete], list[str]]: ...
@overload
def relative_luminance(color: ColorType) -> float: ... # type: ignore[misc]
@overload
def relative_luminance(color: Sequence[ColorType]) -> NDArray[np.float64]: ...
@overload
def relative_luminance(color: ColorType | Sequence[ColorType] | ArrayLike) -> float | NDArray[np.float64]: ...
def to_utf8(obj: object) -> str: ...
def adjust_legend_subtitles(legend: Legend) -> None: ... # not public API

View File

@@ -0,0 +1,37 @@
from typing import overload
from typing_extensions import Literal
from matplotlib.colors import LinearSegmentedColormap
__all__ = [
"choose_colorbrewer_palette",
"choose_cubehelix_palette",
"choose_dark_palette",
"choose_light_palette",
"choose_diverging_palette",
]
@overload
def choose_colorbrewer_palette(
data_type: Literal["sequential", "diverging", "qualitative"], as_cmap: Literal[True]
) -> LinearSegmentedColormap: ...
@overload
def choose_colorbrewer_palette(
data_type: Literal["sequential", "diverging", "qualitative"], as_cmap: Literal[False] = False
) -> list[tuple[float, float, float]]: ...
@overload
def choose_dark_palette(input: str = "husl", *, as_cmap: Literal[True]) -> LinearSegmentedColormap: ...
@overload
def choose_dark_palette(input: str = "husl", as_cmap: Literal[False] = False) -> list[tuple[float, float, float]]: ...
@overload
def choose_light_palette(input: str = "husl", *, as_cmap: Literal[True]) -> LinearSegmentedColormap: ...
@overload
def choose_light_palette(input: str = "husl", as_cmap: Literal[False] = False) -> list[tuple[float, float, float]]: ...
@overload
def choose_diverging_palette(as_cmap: Literal[True]) -> LinearSegmentedColormap: ...
@overload
def choose_diverging_palette(as_cmap: Literal[False] = False) -> list[tuple[float, float, float]]: ...
@overload
def choose_cubehelix_palette(as_cmap: Literal[True]) -> LinearSegmentedColormap: ...
@overload
def choose_cubehelix_palette(as_cmap: Literal[False] = False) -> list[tuple[float, float, float]]: ...