up follow livre
This commit is contained in:
parent
70a5c3465c
commit
cffb31c1ef
12198 changed files with 2562132 additions and 35 deletions
|
|
@ -0,0 +1,18 @@
|
|||
from . import _base
|
||||
from ._axes import Axes
|
||||
|
||||
# Backcompat.
|
||||
Subplot = Axes
|
||||
|
||||
|
||||
class _SubplotBaseMeta(type):
|
||||
def __instancecheck__(self, obj):
|
||||
return (isinstance(obj, _base._AxesBase)
|
||||
and obj.get_subplotspec() is not None)
|
||||
|
||||
|
||||
class SubplotBase(metaclass=_SubplotBaseMeta):
|
||||
pass
|
||||
|
||||
|
||||
def subplot_class_factory(cls): return cls
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
from typing import TypeVar
|
||||
|
||||
from ._axes import Axes as Axes
|
||||
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
# Backcompat.
|
||||
Subplot = Axes
|
||||
|
||||
class _SubplotBaseMeta(type):
|
||||
def __instancecheck__(self, obj) -> bool: ...
|
||||
|
||||
class SubplotBase(metaclass=_SubplotBaseMeta): ...
|
||||
|
||||
def subplot_class_factory(cls: type[_T]) -> type[_T]: ...
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
8871
venv/lib/python3.13/site-packages/matplotlib/axes/_axes.py
Normal file
8871
venv/lib/python3.13/site-packages/matplotlib/axes/_axes.py
Normal file
File diff suppressed because it is too large
Load diff
780
venv/lib/python3.13/site-packages/matplotlib/axes/_axes.pyi
Normal file
780
venv/lib/python3.13/site-packages/matplotlib/axes/_axes.pyi
Normal file
|
|
@ -0,0 +1,780 @@
|
|||
from matplotlib.axes._base import _AxesBase
|
||||
from matplotlib.axes._secondary_axes import SecondaryAxis
|
||||
|
||||
from matplotlib.artist import Artist
|
||||
from matplotlib.backend_bases import RendererBase
|
||||
from matplotlib.collections import (
|
||||
Collection,
|
||||
FillBetweenPolyCollection,
|
||||
LineCollection,
|
||||
PathCollection,
|
||||
PolyCollection,
|
||||
EventCollection,
|
||||
QuadMesh,
|
||||
)
|
||||
from matplotlib.colorizer import Colorizer
|
||||
from matplotlib.colors import Colormap, Normalize
|
||||
from matplotlib.container import BarContainer, ErrorbarContainer, StemContainer
|
||||
from matplotlib.contour import ContourSet, QuadContourSet
|
||||
from matplotlib.image import AxesImage, PcolorImage
|
||||
from matplotlib.inset import InsetIndicator
|
||||
from matplotlib.legend import Legend
|
||||
from matplotlib.legend_handler import HandlerBase
|
||||
from matplotlib.lines import Line2D, AxLine
|
||||
from matplotlib.mlab import GaussianKDE
|
||||
from matplotlib.patches import Rectangle, FancyArrow, Polygon, StepPatch, Wedge
|
||||
from matplotlib.quiver import Quiver, QuiverKey, Barbs
|
||||
from matplotlib.text import Annotation, Text
|
||||
from matplotlib.transforms import Transform
|
||||
from matplotlib.typing import CoordsType
|
||||
import matplotlib.tri as mtri
|
||||
import matplotlib.table as mtable
|
||||
import matplotlib.stackplot as mstack
|
||||
import matplotlib.streamplot as mstream
|
||||
|
||||
import datetime
|
||||
import PIL.Image
|
||||
from collections.abc import Callable, Iterable, Sequence
|
||||
from typing import Any, Literal, overload
|
||||
import numpy as np
|
||||
from numpy.typing import ArrayLike
|
||||
from matplotlib.typing import ColorType, MarkerType, LineStyleType
|
||||
|
||||
class Axes(_AxesBase):
|
||||
def get_title(self, loc: Literal["left", "center", "right"] = ...) -> str: ...
|
||||
def set_title(
|
||||
self,
|
||||
label: str,
|
||||
fontdict: dict[str, Any] | None = ...,
|
||||
loc: Literal["left", "center", "right"] | None = ...,
|
||||
pad: float | None = ...,
|
||||
*,
|
||||
y: float | None = ...,
|
||||
**kwargs
|
||||
) -> Text: ...
|
||||
def get_legend_handles_labels(
|
||||
self, legend_handler_map: dict[type, HandlerBase] | None = ...
|
||||
) -> tuple[list[Artist], list[Any]]: ...
|
||||
legend_: Legend | None
|
||||
|
||||
@overload
|
||||
def legend(self) -> Legend: ...
|
||||
@overload
|
||||
def legend(self, handles: Iterable[Artist | tuple[Artist, ...]], labels: Iterable[str], **kwargs) -> Legend: ...
|
||||
@overload
|
||||
def legend(self, *, handles: Iterable[Artist | tuple[Artist, ...]], **kwargs) -> Legend: ...
|
||||
@overload
|
||||
def legend(self, labels: Iterable[str], **kwargs) -> Legend: ...
|
||||
@overload
|
||||
def legend(self, **kwargs) -> Legend: ...
|
||||
|
||||
def inset_axes(
|
||||
self,
|
||||
bounds: tuple[float, float, float, float],
|
||||
*,
|
||||
transform: Transform | None = ...,
|
||||
zorder: float = ...,
|
||||
**kwargs
|
||||
) -> Axes: ...
|
||||
def indicate_inset(
|
||||
self,
|
||||
bounds: tuple[float, float, float, float] | None = ...,
|
||||
inset_ax: Axes | None = ...,
|
||||
*,
|
||||
transform: Transform | None = ...,
|
||||
facecolor: ColorType = ...,
|
||||
edgecolor: ColorType = ...,
|
||||
alpha: float = ...,
|
||||
zorder: float | None = ...,
|
||||
**kwargs
|
||||
) -> InsetIndicator: ...
|
||||
def indicate_inset_zoom(self, inset_ax: Axes, **kwargs) -> InsetIndicator: ...
|
||||
def secondary_xaxis(
|
||||
self,
|
||||
location: Literal["top", "bottom"] | float,
|
||||
functions: tuple[
|
||||
Callable[[ArrayLike], ArrayLike], Callable[[ArrayLike], ArrayLike]
|
||||
]
|
||||
| Transform
|
||||
| None = ...,
|
||||
*,
|
||||
transform: Transform | None = ...,
|
||||
**kwargs
|
||||
) -> SecondaryAxis: ...
|
||||
def secondary_yaxis(
|
||||
self,
|
||||
location: Literal["left", "right"] | float,
|
||||
functions: tuple[
|
||||
Callable[[ArrayLike], ArrayLike], Callable[[ArrayLike], ArrayLike]
|
||||
]
|
||||
| Transform
|
||||
| None = ...,
|
||||
*,
|
||||
transform: Transform | None = ...,
|
||||
**kwargs
|
||||
) -> SecondaryAxis: ...
|
||||
def text(
|
||||
self,
|
||||
x: float,
|
||||
y: float,
|
||||
s: str,
|
||||
fontdict: dict[str, Any] | None = ...,
|
||||
**kwargs
|
||||
) -> Text: ...
|
||||
def annotate(
|
||||
self,
|
||||
text: str,
|
||||
xy: tuple[float, float],
|
||||
xytext: tuple[float, float] | None = ...,
|
||||
xycoords: CoordsType = ...,
|
||||
textcoords: CoordsType | None = ...,
|
||||
arrowprops: dict[str, Any] | None = ...,
|
||||
annotation_clip: bool | None = ...,
|
||||
**kwargs
|
||||
) -> Annotation: ...
|
||||
def axhline(
|
||||
self, y: float = ..., xmin: float = ..., xmax: float = ..., **kwargs
|
||||
) -> Line2D: ...
|
||||
def axvline(
|
||||
self, x: float = ..., ymin: float = ..., ymax: float = ..., **kwargs
|
||||
) -> Line2D: ...
|
||||
|
||||
# TODO: Could separate the xy2 and slope signatures
|
||||
def axline(
|
||||
self,
|
||||
xy1: tuple[float, float],
|
||||
xy2: tuple[float, float] | None = ...,
|
||||
*,
|
||||
slope: float | None = ...,
|
||||
**kwargs
|
||||
) -> AxLine: ...
|
||||
def axhspan(
|
||||
self, ymin: float, ymax: float, xmin: float = ..., xmax: float = ..., **kwargs
|
||||
) -> Rectangle: ...
|
||||
def axvspan(
|
||||
self, xmin: float, xmax: float, ymin: float = ..., ymax: float = ..., **kwargs
|
||||
) -> Rectangle: ...
|
||||
def hlines(
|
||||
self,
|
||||
y: float | ArrayLike,
|
||||
xmin: float | ArrayLike,
|
||||
xmax: float | ArrayLike,
|
||||
colors: ColorType | Sequence[ColorType] | None = ...,
|
||||
linestyles: LineStyleType = ...,
|
||||
*,
|
||||
label: str = ...,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> LineCollection: ...
|
||||
def vlines(
|
||||
self,
|
||||
x: float | ArrayLike,
|
||||
ymin: float | ArrayLike,
|
||||
ymax: float | ArrayLike,
|
||||
colors: ColorType | Sequence[ColorType] | None = ...,
|
||||
linestyles: LineStyleType = ...,
|
||||
*,
|
||||
label: str = ...,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> LineCollection: ...
|
||||
def eventplot(
|
||||
self,
|
||||
positions: ArrayLike | Sequence[ArrayLike],
|
||||
*,
|
||||
orientation: Literal["horizontal", "vertical"] = ...,
|
||||
lineoffsets: float | Sequence[float] = ...,
|
||||
linelengths: float | Sequence[float] = ...,
|
||||
linewidths: float | Sequence[float] | None = ...,
|
||||
colors: ColorType | Sequence[ColorType] | None = ...,
|
||||
alpha: float | Sequence[float] | None = ...,
|
||||
linestyles: LineStyleType | Sequence[LineStyleType] = ...,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> EventCollection: ...
|
||||
def plot(
|
||||
self,
|
||||
*args: float | ArrayLike | str,
|
||||
scalex: bool = ...,
|
||||
scaley: bool = ...,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> list[Line2D]: ...
|
||||
def plot_date(
|
||||
self,
|
||||
x: ArrayLike,
|
||||
y: ArrayLike,
|
||||
fmt: str = ...,
|
||||
tz: str | datetime.tzinfo | None = ...,
|
||||
xdate: bool = ...,
|
||||
ydate: bool = ...,
|
||||
*,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> list[Line2D]: ...
|
||||
def loglog(self, *args, **kwargs) -> list[Line2D]: ...
|
||||
def semilogx(self, *args, **kwargs) -> list[Line2D]: ...
|
||||
def semilogy(self, *args, **kwargs) -> list[Line2D]: ...
|
||||
def acorr(
|
||||
self, x: ArrayLike, *, data=..., **kwargs
|
||||
) -> tuple[np.ndarray, np.ndarray, LineCollection | Line2D, Line2D | None]: ...
|
||||
def xcorr(
|
||||
self,
|
||||
x: ArrayLike,
|
||||
y: ArrayLike,
|
||||
*,
|
||||
normed: bool = ...,
|
||||
detrend: Callable[[ArrayLike], ArrayLike] = ...,
|
||||
usevlines: bool = ...,
|
||||
maxlags: int = ...,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> tuple[np.ndarray, np.ndarray, LineCollection | Line2D, Line2D | None]: ...
|
||||
def step(
|
||||
self,
|
||||
x: ArrayLike,
|
||||
y: ArrayLike,
|
||||
*args,
|
||||
where: Literal["pre", "post", "mid"] = ...,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> list[Line2D]: ...
|
||||
def bar(
|
||||
self,
|
||||
x: float | ArrayLike,
|
||||
height: float | ArrayLike,
|
||||
width: float | ArrayLike = ...,
|
||||
bottom: float | ArrayLike | None = ...,
|
||||
*,
|
||||
align: Literal["center", "edge"] = ...,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> BarContainer: ...
|
||||
def barh(
|
||||
self,
|
||||
y: float | ArrayLike,
|
||||
width: float | ArrayLike,
|
||||
height: float | ArrayLike = ...,
|
||||
left: float | ArrayLike | None = ...,
|
||||
*,
|
||||
align: Literal["center", "edge"] = ...,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> BarContainer: ...
|
||||
def bar_label(
|
||||
self,
|
||||
container: BarContainer,
|
||||
labels: ArrayLike | None = ...,
|
||||
*,
|
||||
fmt: str | Callable[[float], str] = ...,
|
||||
label_type: Literal["center", "edge"] = ...,
|
||||
padding: float = ...,
|
||||
**kwargs
|
||||
) -> list[Annotation]: ...
|
||||
def broken_barh(
|
||||
self,
|
||||
xranges: Sequence[tuple[float, float]],
|
||||
yrange: tuple[float, float],
|
||||
*,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> PolyCollection: ...
|
||||
def stem(
|
||||
self,
|
||||
*args: ArrayLike | str,
|
||||
linefmt: str | None = ...,
|
||||
markerfmt: str | None = ...,
|
||||
basefmt: str | None = ...,
|
||||
bottom: float = ...,
|
||||
label: str | None = ...,
|
||||
orientation: Literal["vertical", "horizontal"] = ...,
|
||||
data=...,
|
||||
) -> StemContainer: ...
|
||||
|
||||
# TODO: data kwarg preprocessor?
|
||||
def pie(
|
||||
self,
|
||||
x: ArrayLike,
|
||||
*,
|
||||
explode: ArrayLike | None = ...,
|
||||
labels: Sequence[str] | None = ...,
|
||||
colors: ColorType | Sequence[ColorType] | None = ...,
|
||||
autopct: str | Callable[[float], str] | None = ...,
|
||||
pctdistance: float = ...,
|
||||
shadow: bool = ...,
|
||||
labeldistance: float | None = ...,
|
||||
startangle: float = ...,
|
||||
radius: float = ...,
|
||||
counterclock: bool = ...,
|
||||
wedgeprops: dict[str, Any] | None = ...,
|
||||
textprops: dict[str, Any] | None = ...,
|
||||
center: tuple[float, float] = ...,
|
||||
frame: bool = ...,
|
||||
rotatelabels: bool = ...,
|
||||
normalize: bool = ...,
|
||||
hatch: str | Sequence[str] | None = ...,
|
||||
data=...,
|
||||
) -> tuple[list[Wedge], list[Text]] | tuple[
|
||||
list[Wedge], list[Text], list[Text]
|
||||
]: ...
|
||||
def errorbar(
|
||||
self,
|
||||
x: float | ArrayLike,
|
||||
y: float | ArrayLike,
|
||||
yerr: float | ArrayLike | None = ...,
|
||||
xerr: float | ArrayLike | None = ...,
|
||||
fmt: str = ...,
|
||||
*,
|
||||
ecolor: ColorType | None = ...,
|
||||
elinewidth: float | None = ...,
|
||||
capsize: float | None = ...,
|
||||
barsabove: bool = ...,
|
||||
lolims: bool | ArrayLike = ...,
|
||||
uplims: bool | ArrayLike = ...,
|
||||
xlolims: bool | ArrayLike = ...,
|
||||
xuplims: bool | ArrayLike = ...,
|
||||
errorevery: int | tuple[int, int] = ...,
|
||||
capthick: float | None = ...,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> ErrorbarContainer: ...
|
||||
def boxplot(
|
||||
self,
|
||||
x: ArrayLike | Sequence[ArrayLike],
|
||||
*,
|
||||
notch: bool | None = ...,
|
||||
sym: str | None = ...,
|
||||
vert: bool | None = ...,
|
||||
orientation: Literal["vertical", "horizontal"] = ...,
|
||||
whis: float | tuple[float, float] | None = ...,
|
||||
positions: ArrayLike | None = ...,
|
||||
widths: float | ArrayLike | None = ...,
|
||||
patch_artist: bool | None = ...,
|
||||
bootstrap: int | None = ...,
|
||||
usermedians: ArrayLike | None = ...,
|
||||
conf_intervals: ArrayLike | None = ...,
|
||||
meanline: bool | None = ...,
|
||||
showmeans: bool | None = ...,
|
||||
showcaps: bool | None = ...,
|
||||
showbox: bool | None = ...,
|
||||
showfliers: bool | None = ...,
|
||||
boxprops: dict[str, Any] | None = ...,
|
||||
tick_labels: Sequence[str] | None = ...,
|
||||
flierprops: dict[str, Any] | None = ...,
|
||||
medianprops: dict[str, Any] | None = ...,
|
||||
meanprops: dict[str, Any] | None = ...,
|
||||
capprops: dict[str, Any] | None = ...,
|
||||
whiskerprops: dict[str, Any] | None = ...,
|
||||
manage_ticks: bool = ...,
|
||||
autorange: bool = ...,
|
||||
zorder: float | None = ...,
|
||||
capwidths: float | ArrayLike | None = ...,
|
||||
label: Sequence[str] | None = ...,
|
||||
data=...,
|
||||
) -> dict[str, Any]: ...
|
||||
def bxp(
|
||||
self,
|
||||
bxpstats: Sequence[dict[str, Any]],
|
||||
positions: ArrayLike | None = ...,
|
||||
*,
|
||||
widths: float | ArrayLike | None = ...,
|
||||
vert: bool | None = ...,
|
||||
orientation: Literal["vertical", "horizontal"] = ...,
|
||||
patch_artist: bool = ...,
|
||||
shownotches: bool = ...,
|
||||
showmeans: bool = ...,
|
||||
showcaps: bool = ...,
|
||||
showbox: bool = ...,
|
||||
showfliers: bool = ...,
|
||||
boxprops: dict[str, Any] | None = ...,
|
||||
whiskerprops: dict[str, Any] | None = ...,
|
||||
flierprops: dict[str, Any] | None = ...,
|
||||
medianprops: dict[str, Any] | None = ...,
|
||||
capprops: dict[str, Any] | None = ...,
|
||||
meanprops: dict[str, Any] | None = ...,
|
||||
meanline: bool = ...,
|
||||
manage_ticks: bool = ...,
|
||||
zorder: float | None = ...,
|
||||
capwidths: float | ArrayLike | None = ...,
|
||||
label: Sequence[str] | None = ...,
|
||||
) -> dict[str, Any]: ...
|
||||
def scatter(
|
||||
self,
|
||||
x: float | ArrayLike,
|
||||
y: float | ArrayLike,
|
||||
s: float | ArrayLike | None = ...,
|
||||
c: ArrayLike | Sequence[ColorType] | ColorType | None = ...,
|
||||
*,
|
||||
marker: MarkerType | None = ...,
|
||||
cmap: str | Colormap | None = ...,
|
||||
norm: str | Normalize | None = ...,
|
||||
vmin: float | None = ...,
|
||||
vmax: float | None = ...,
|
||||
alpha: float | None = ...,
|
||||
linewidths: float | Sequence[float] | None = ...,
|
||||
edgecolors: Literal["face", "none"] | ColorType | Sequence[ColorType] | None = ...,
|
||||
colorizer: Colorizer | None = ...,
|
||||
plotnonfinite: bool = ...,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> PathCollection: ...
|
||||
def hexbin(
|
||||
self,
|
||||
x: ArrayLike,
|
||||
y: ArrayLike,
|
||||
C: ArrayLike | None = ...,
|
||||
*,
|
||||
gridsize: int | tuple[int, int] = ...,
|
||||
bins: Literal["log"] | int | Sequence[float] | None = ...,
|
||||
xscale: Literal["linear", "log"] = ...,
|
||||
yscale: Literal["linear", "log"] = ...,
|
||||
extent: tuple[float, float, float, float] | None = ...,
|
||||
cmap: str | Colormap | None = ...,
|
||||
norm: str | Normalize | None = ...,
|
||||
vmin: float | None = ...,
|
||||
vmax: float | None = ...,
|
||||
alpha: float | None = ...,
|
||||
linewidths: float | None = ...,
|
||||
edgecolors: Literal["face", "none"] | ColorType = ...,
|
||||
reduce_C_function: Callable[[np.ndarray | list[float]], float] = ...,
|
||||
mincnt: int | None = ...,
|
||||
marginals: bool = ...,
|
||||
colorizer: Colorizer | None = ...,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> PolyCollection: ...
|
||||
def arrow(
|
||||
self, x: float, y: float, dx: float, dy: float, **kwargs
|
||||
) -> FancyArrow: ...
|
||||
def quiverkey(
|
||||
self, Q: Quiver, X: float, Y: float, U: float, label: str, **kwargs
|
||||
) -> QuiverKey: ...
|
||||
def quiver(self, *args, data=..., **kwargs) -> Quiver: ...
|
||||
def barbs(self, *args, data=..., **kwargs) -> Barbs: ...
|
||||
def fill(self, *args, data=..., **kwargs) -> list[Polygon]: ...
|
||||
def fill_between(
|
||||
self,
|
||||
x: ArrayLike,
|
||||
y1: ArrayLike | float,
|
||||
y2: ArrayLike | float = ...,
|
||||
where: Sequence[bool] | None = ...,
|
||||
interpolate: bool = ...,
|
||||
step: Literal["pre", "post", "mid"] | None = ...,
|
||||
*,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> FillBetweenPolyCollection: ...
|
||||
def fill_betweenx(
|
||||
self,
|
||||
y: ArrayLike,
|
||||
x1: ArrayLike | float,
|
||||
x2: ArrayLike | float = ...,
|
||||
where: Sequence[bool] | None = ...,
|
||||
step: Literal["pre", "post", "mid"] | None = ...,
|
||||
interpolate: bool = ...,
|
||||
*,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> FillBetweenPolyCollection: ...
|
||||
def imshow(
|
||||
self,
|
||||
X: ArrayLike | PIL.Image.Image,
|
||||
cmap: str | Colormap | None = ...,
|
||||
norm: str | Normalize | None = ...,
|
||||
*,
|
||||
aspect: Literal["equal", "auto"] | float | None = ...,
|
||||
interpolation: str | None = ...,
|
||||
alpha: float | ArrayLike | None = ...,
|
||||
vmin: float | None = ...,
|
||||
vmax: float | None = ...,
|
||||
colorizer: Colorizer | None = ...,
|
||||
origin: Literal["upper", "lower"] | None = ...,
|
||||
extent: tuple[float, float, float, float] | None = ...,
|
||||
interpolation_stage: Literal["data", "rgba", "auto"] | None = ...,
|
||||
filternorm: bool = ...,
|
||||
filterrad: float = ...,
|
||||
resample: bool | None = ...,
|
||||
url: str | None = ...,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> AxesImage: ...
|
||||
def pcolor(
|
||||
self,
|
||||
*args: ArrayLike,
|
||||
shading: Literal["flat", "nearest", "auto"] | None = ...,
|
||||
alpha: float | None = ...,
|
||||
norm: str | Normalize | None = ...,
|
||||
cmap: str | Colormap | None = ...,
|
||||
vmin: float | None = ...,
|
||||
vmax: float | None = ...,
|
||||
colorizer: Colorizer | None = ...,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> Collection: ...
|
||||
def pcolormesh(
|
||||
self,
|
||||
*args: ArrayLike,
|
||||
alpha: float | None = ...,
|
||||
norm: str | Normalize | None = ...,
|
||||
cmap: str | Colormap | None = ...,
|
||||
vmin: float | None = ...,
|
||||
vmax: float | None = ...,
|
||||
colorizer: Colorizer | None = ...,
|
||||
shading: Literal["flat", "nearest", "gouraud", "auto"] | None = ...,
|
||||
antialiased: bool = ...,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> QuadMesh: ...
|
||||
def pcolorfast(
|
||||
self,
|
||||
*args: ArrayLike | tuple[float, float],
|
||||
alpha: float | None = ...,
|
||||
norm: str | Normalize | None = ...,
|
||||
cmap: str | Colormap | None = ...,
|
||||
vmin: float | None = ...,
|
||||
vmax: float | None = ...,
|
||||
colorizer: Colorizer | None = ...,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> AxesImage | PcolorImage | QuadMesh: ...
|
||||
def contour(self, *args, data=..., **kwargs) -> QuadContourSet: ...
|
||||
def contourf(self, *args, data=..., **kwargs) -> QuadContourSet: ...
|
||||
def clabel(
|
||||
self, CS: ContourSet, levels: ArrayLike | None = ..., **kwargs
|
||||
) -> list[Text]: ...
|
||||
def hist(
|
||||
self,
|
||||
x: ArrayLike | Sequence[ArrayLike],
|
||||
bins: int | Sequence[float] | str | None = ...,
|
||||
*,
|
||||
range: tuple[float, float] | None = ...,
|
||||
density: bool = ...,
|
||||
weights: ArrayLike | None = ...,
|
||||
cumulative: bool | float = ...,
|
||||
bottom: ArrayLike | float | None = ...,
|
||||
histtype: Literal["bar", "barstacked", "step", "stepfilled"] = ...,
|
||||
align: Literal["left", "mid", "right"] = ...,
|
||||
orientation: Literal["vertical", "horizontal"] = ...,
|
||||
rwidth: float | None = ...,
|
||||
log: bool = ...,
|
||||
color: ColorType | Sequence[ColorType] | None = ...,
|
||||
label: str | Sequence[str] | None = ...,
|
||||
stacked: bool = ...,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> tuple[
|
||||
np.ndarray | list[np.ndarray],
|
||||
np.ndarray,
|
||||
BarContainer | Polygon | list[BarContainer | Polygon],
|
||||
]: ...
|
||||
def stairs(
|
||||
self,
|
||||
values: ArrayLike,
|
||||
edges: ArrayLike | None = ...,
|
||||
*,
|
||||
orientation: Literal["vertical", "horizontal"] = ...,
|
||||
baseline: float | ArrayLike | None = ...,
|
||||
fill: bool = ...,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> StepPatch: ...
|
||||
def hist2d(
|
||||
self,
|
||||
x: ArrayLike,
|
||||
y: ArrayLike,
|
||||
bins: None
|
||||
| int
|
||||
| tuple[int, int]
|
||||
| ArrayLike
|
||||
| tuple[ArrayLike, ArrayLike] = ...,
|
||||
*,
|
||||
range: ArrayLike | None = ...,
|
||||
density: bool = ...,
|
||||
weights: ArrayLike | None = ...,
|
||||
cmin: float | None = ...,
|
||||
cmax: float | None = ...,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> tuple[np.ndarray, np.ndarray, np.ndarray, QuadMesh]: ...
|
||||
def ecdf(
|
||||
self,
|
||||
x: ArrayLike,
|
||||
weights: ArrayLike | None = ...,
|
||||
*,
|
||||
complementary: bool=...,
|
||||
orientation: Literal["vertical", "horizontal"]=...,
|
||||
compress: bool=...,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> Line2D: ...
|
||||
def psd(
|
||||
self,
|
||||
x: ArrayLike,
|
||||
*,
|
||||
NFFT: int | None = ...,
|
||||
Fs: float | None = ...,
|
||||
Fc: int | None = ...,
|
||||
detrend: Literal["none", "mean", "linear"]
|
||||
| Callable[[ArrayLike], ArrayLike]
|
||||
| None = ...,
|
||||
window: Callable[[ArrayLike], ArrayLike] | ArrayLike | None = ...,
|
||||
noverlap: int | None = ...,
|
||||
pad_to: int | None = ...,
|
||||
sides: Literal["default", "onesided", "twosided"] | None = ...,
|
||||
scale_by_freq: bool | None = ...,
|
||||
return_line: bool | None = ...,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> tuple[np.ndarray, np.ndarray] | tuple[np.ndarray, np.ndarray, Line2D]: ...
|
||||
def csd(
|
||||
self,
|
||||
x: ArrayLike,
|
||||
y: ArrayLike,
|
||||
*,
|
||||
NFFT: int | None = ...,
|
||||
Fs: float | None = ...,
|
||||
Fc: int | None = ...,
|
||||
detrend: Literal["none", "mean", "linear"]
|
||||
| Callable[[ArrayLike], ArrayLike]
|
||||
| None = ...,
|
||||
window: Callable[[ArrayLike], ArrayLike] | ArrayLike | None = ...,
|
||||
noverlap: int | None = ...,
|
||||
pad_to: int | None = ...,
|
||||
sides: Literal["default", "onesided", "twosided"] | None = ...,
|
||||
scale_by_freq: bool | None = ...,
|
||||
return_line: bool | None = ...,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> tuple[np.ndarray, np.ndarray] | tuple[np.ndarray, np.ndarray, Line2D]: ...
|
||||
def magnitude_spectrum(
|
||||
self,
|
||||
x: ArrayLike,
|
||||
*,
|
||||
Fs: float | None = ...,
|
||||
Fc: int | None = ...,
|
||||
window: Callable[[ArrayLike], ArrayLike] | ArrayLike | None = ...,
|
||||
pad_to: int | None = ...,
|
||||
sides: Literal["default", "onesided", "twosided"] | None = ...,
|
||||
scale: Literal["default", "linear", "dB"] | None = ...,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> tuple[np.ndarray, np.ndarray, Line2D]: ...
|
||||
def angle_spectrum(
|
||||
self,
|
||||
x: ArrayLike,
|
||||
*,
|
||||
Fs: float | None = ...,
|
||||
Fc: int | None = ...,
|
||||
window: Callable[[ArrayLike], ArrayLike] | ArrayLike | None = ...,
|
||||
pad_to: int | None = ...,
|
||||
sides: Literal["default", "onesided", "twosided"] | None = ...,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> tuple[np.ndarray, np.ndarray, Line2D]: ...
|
||||
def phase_spectrum(
|
||||
self,
|
||||
x: ArrayLike,
|
||||
*,
|
||||
Fs: float | None = ...,
|
||||
Fc: int | None = ...,
|
||||
window: Callable[[ArrayLike], ArrayLike] | ArrayLike | None = ...,
|
||||
pad_to: int | None = ...,
|
||||
sides: Literal["default", "onesided", "twosided"] | None = ...,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> tuple[np.ndarray, np.ndarray, Line2D]: ...
|
||||
def cohere(
|
||||
self,
|
||||
x: ArrayLike,
|
||||
y: ArrayLike,
|
||||
*,
|
||||
NFFT: int = ...,
|
||||
Fs: float = ...,
|
||||
Fc: int = ...,
|
||||
detrend: Literal["none", "mean", "linear"]
|
||||
| Callable[[ArrayLike], ArrayLike] = ...,
|
||||
window: Callable[[ArrayLike], ArrayLike] | ArrayLike = ...,
|
||||
noverlap: int = ...,
|
||||
pad_to: int | None = ...,
|
||||
sides: Literal["default", "onesided", "twosided"] = ...,
|
||||
scale_by_freq: bool | None = ...,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> tuple[np.ndarray, np.ndarray]: ...
|
||||
def specgram(
|
||||
self,
|
||||
x: ArrayLike,
|
||||
*,
|
||||
NFFT: int | None = ...,
|
||||
Fs: float | None = ...,
|
||||
Fc: int | None = ...,
|
||||
detrend: Literal["none", "mean", "linear"]
|
||||
| Callable[[ArrayLike], ArrayLike]
|
||||
| None = ...,
|
||||
window: Callable[[ArrayLike], ArrayLike] | ArrayLike | None = ...,
|
||||
noverlap: int | None = ...,
|
||||
cmap: str | Colormap | None = ...,
|
||||
xextent: tuple[float, float] | None = ...,
|
||||
pad_to: int | None = ...,
|
||||
sides: Literal["default", "onesided", "twosided"] | None = ...,
|
||||
scale_by_freq: bool | None = ...,
|
||||
mode: Literal["default", "psd", "magnitude", "angle", "phase"] | None = ...,
|
||||
scale: Literal["default", "linear", "dB"] | None = ...,
|
||||
vmin: float | None = ...,
|
||||
vmax: float | None = ...,
|
||||
data=...,
|
||||
**kwargs
|
||||
) -> tuple[np.ndarray, np.ndarray, np.ndarray, AxesImage]: ...
|
||||
def spy(
|
||||
self,
|
||||
Z: ArrayLike,
|
||||
*,
|
||||
precision: float | Literal["present"] = ...,
|
||||
marker: str | None = ...,
|
||||
markersize: float | None = ...,
|
||||
aspect: Literal["equal", "auto"] | float | None = ...,
|
||||
origin: Literal["upper", "lower"] = ...,
|
||||
**kwargs
|
||||
) -> AxesImage: ...
|
||||
def matshow(self, Z: ArrayLike, **kwargs) -> AxesImage: ...
|
||||
def violinplot(
|
||||
self,
|
||||
dataset: ArrayLike | Sequence[ArrayLike],
|
||||
positions: ArrayLike | None = ...,
|
||||
*,
|
||||
vert: bool | None = ...,
|
||||
orientation: Literal["vertical", "horizontal"] = ...,
|
||||
widths: float | ArrayLike = ...,
|
||||
showmeans: bool = ...,
|
||||
showextrema: bool = ...,
|
||||
showmedians: bool = ...,
|
||||
quantiles: Sequence[float | Sequence[float]] | None = ...,
|
||||
points: int = ...,
|
||||
bw_method: Literal["scott", "silverman"]
|
||||
| float
|
||||
| Callable[[GaussianKDE], float]
|
||||
| None = ...,
|
||||
side: Literal["both", "low", "high"] = ...,
|
||||
data=...,
|
||||
) -> dict[str, Collection]: ...
|
||||
def violin(
|
||||
self,
|
||||
vpstats: Sequence[dict[str, Any]],
|
||||
positions: ArrayLike | None = ...,
|
||||
*,
|
||||
vert: bool | None = ...,
|
||||
orientation: Literal["vertical", "horizontal"] = ...,
|
||||
widths: float | ArrayLike = ...,
|
||||
showmeans: bool = ...,
|
||||
showextrema: bool = ...,
|
||||
showmedians: bool = ...,
|
||||
side: Literal["both", "low", "high"] = ...,
|
||||
) -> dict[str, Collection]: ...
|
||||
|
||||
table = mtable.table
|
||||
stackplot = mstack.stackplot
|
||||
streamplot = mstream.streamplot
|
||||
tricontour = mtri.tricontour
|
||||
tricontourf = mtri.tricontourf
|
||||
tripcolor = mtri.tripcolor
|
||||
triplot = mtri.triplot
|
||||
4857
venv/lib/python3.13/site-packages/matplotlib/axes/_base.py
Normal file
4857
venv/lib/python3.13/site-packages/matplotlib/axes/_base.py
Normal file
File diff suppressed because it is too large
Load diff
459
venv/lib/python3.13/site-packages/matplotlib/axes/_base.pyi
Normal file
459
venv/lib/python3.13/site-packages/matplotlib/axes/_base.pyi
Normal file
|
|
@ -0,0 +1,459 @@
|
|||
import matplotlib.artist as martist
|
||||
|
||||
import datetime
|
||||
from collections.abc import Callable, Iterable, Iterator, Sequence
|
||||
from matplotlib import cbook
|
||||
from matplotlib.artist import Artist
|
||||
from matplotlib.axes import Axes
|
||||
from matplotlib.axis import XAxis, YAxis, Tick
|
||||
from matplotlib.backend_bases import RendererBase, MouseButton, MouseEvent
|
||||
from matplotlib.cbook import CallbackRegistry
|
||||
from matplotlib.container import Container
|
||||
from matplotlib.collections import Collection
|
||||
from matplotlib.colorizer import ColorizingArtist
|
||||
from matplotlib.legend import Legend
|
||||
from matplotlib.lines import Line2D
|
||||
from matplotlib.gridspec import SubplotSpec, GridSpec
|
||||
from matplotlib.figure import Figure, SubFigure
|
||||
from matplotlib.image import AxesImage
|
||||
from matplotlib.patches import Patch
|
||||
from matplotlib.scale import ScaleBase
|
||||
from matplotlib.spines import Spines
|
||||
from matplotlib.table import Table
|
||||
from matplotlib.text import Text
|
||||
from matplotlib.transforms import Transform, Bbox
|
||||
|
||||
from cycler import Cycler
|
||||
|
||||
import numpy as np
|
||||
from numpy.typing import ArrayLike
|
||||
from typing import Any, Literal, TypeVar, overload
|
||||
from matplotlib.typing import ColorType
|
||||
|
||||
_T = TypeVar("_T", bound=Artist)
|
||||
|
||||
class _axis_method_wrapper:
|
||||
attr_name: str
|
||||
method_name: str
|
||||
__doc__: str
|
||||
def __init__(
|
||||
self, attr_name: str, method_name: str, *, doc_sub: dict[str, str] | None = ...
|
||||
) -> None: ...
|
||||
def __set_name__(self, owner: Any, name: str) -> None: ...
|
||||
|
||||
class _AxesBase(martist.Artist):
|
||||
name: str
|
||||
patch: Patch
|
||||
spines: Spines
|
||||
fmt_xdata: Callable[[float], str] | None
|
||||
fmt_ydata: Callable[[float], str] | None
|
||||
xaxis: XAxis
|
||||
yaxis: YAxis
|
||||
bbox: Bbox
|
||||
dataLim: Bbox
|
||||
transAxes: Transform
|
||||
transScale: Transform
|
||||
transLimits: Transform
|
||||
transData: Transform
|
||||
ignore_existing_data_limits: bool
|
||||
axison: bool
|
||||
containers: list[Container]
|
||||
callbacks: CallbackRegistry
|
||||
child_axes: list[_AxesBase]
|
||||
legend_: Legend | None
|
||||
title: Text
|
||||
_projection_init: Any
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
fig: Figure,
|
||||
*args: tuple[float, float, float, float] | Bbox | int,
|
||||
facecolor: ColorType | None = ...,
|
||||
frameon: bool = ...,
|
||||
sharex: _AxesBase | None = ...,
|
||||
sharey: _AxesBase | None = ...,
|
||||
label: Any = ...,
|
||||
xscale: str | ScaleBase | None = ...,
|
||||
yscale: str | ScaleBase | None = ...,
|
||||
box_aspect: float | None = ...,
|
||||
forward_navigation_events: bool | Literal["auto"] = ...,
|
||||
**kwargs
|
||||
) -> None: ...
|
||||
def get_subplotspec(self) -> SubplotSpec | None: ...
|
||||
def set_subplotspec(self, subplotspec: SubplotSpec) -> None: ...
|
||||
def get_gridspec(self) -> GridSpec | None: ...
|
||||
def set_figure(self, fig: Figure | SubFigure) -> None: ...
|
||||
@property
|
||||
def viewLim(self) -> Bbox: ...
|
||||
def get_xaxis_transform(
|
||||
self, which: Literal["grid", "tick1", "tick2"] = ...
|
||||
) -> Transform: ...
|
||||
def get_xaxis_text1_transform(
|
||||
self, pad_points: float
|
||||
) -> tuple[
|
||||
Transform,
|
||||
Literal["center", "top", "bottom", "baseline", "center_baseline"],
|
||||
Literal["center", "left", "right"],
|
||||
]: ...
|
||||
def get_xaxis_text2_transform(
|
||||
self, pad_points
|
||||
) -> tuple[
|
||||
Transform,
|
||||
Literal["center", "top", "bottom", "baseline", "center_baseline"],
|
||||
Literal["center", "left", "right"],
|
||||
]: ...
|
||||
def get_yaxis_transform(
|
||||
self, which: Literal["grid", "tick1", "tick2"] = ...
|
||||
) -> Transform: ...
|
||||
def get_yaxis_text1_transform(
|
||||
self, pad_points
|
||||
) -> tuple[
|
||||
Transform,
|
||||
Literal["center", "top", "bottom", "baseline", "center_baseline"],
|
||||
Literal["center", "left", "right"],
|
||||
]: ...
|
||||
def get_yaxis_text2_transform(
|
||||
self, pad_points
|
||||
) -> tuple[
|
||||
Transform,
|
||||
Literal["center", "top", "bottom", "baseline", "center_baseline"],
|
||||
Literal["center", "left", "right"],
|
||||
]: ...
|
||||
def get_position(self, original: bool = ...) -> Bbox: ...
|
||||
def set_position(
|
||||
self,
|
||||
pos: Bbox | tuple[float, float, float, float],
|
||||
which: Literal["both", "active", "original"] = ...,
|
||||
) -> None: ...
|
||||
def reset_position(self) -> None: ...
|
||||
def set_axes_locator(
|
||||
self, locator: Callable[[_AxesBase, RendererBase], Bbox]
|
||||
) -> None: ...
|
||||
def get_axes_locator(self) -> Callable[[_AxesBase, RendererBase], Bbox]: ...
|
||||
def sharex(self, other: _AxesBase) -> None: ...
|
||||
def sharey(self, other: _AxesBase) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
def cla(self) -> None: ...
|
||||
|
||||
class ArtistList(Sequence[_T]):
|
||||
def __init__(
|
||||
self,
|
||||
axes: _AxesBase,
|
||||
prop_name: str,
|
||||
valid_types: type | Iterable[type] | None = ...,
|
||||
invalid_types: type | Iterable[type] | None = ...,
|
||||
) -> None: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __iter__(self) -> Iterator[_T]: ...
|
||||
@overload
|
||||
def __getitem__(self, key: int) -> _T: ...
|
||||
@overload
|
||||
def __getitem__(self, key: slice) -> list[_T]: ...
|
||||
|
||||
@overload
|
||||
def __add__(self, other: _AxesBase.ArtistList[_T]) -> list[_T]: ...
|
||||
@overload
|
||||
def __add__(self, other: list[Any]) -> list[Any]: ...
|
||||
@overload
|
||||
def __add__(self, other: tuple[Any]) -> tuple[Any]: ...
|
||||
|
||||
@overload
|
||||
def __radd__(self, other: _AxesBase.ArtistList[_T]) -> list[_T]: ...
|
||||
@overload
|
||||
def __radd__(self, other: list[Any]) -> list[Any]: ...
|
||||
@overload
|
||||
def __radd__(self, other: tuple[Any]) -> tuple[Any]: ...
|
||||
|
||||
@property
|
||||
def artists(self) -> _AxesBase.ArtistList[Artist]: ...
|
||||
@property
|
||||
def collections(self) -> _AxesBase.ArtistList[Collection]: ...
|
||||
@property
|
||||
def images(self) -> _AxesBase.ArtistList[AxesImage]: ...
|
||||
@property
|
||||
def lines(self) -> _AxesBase.ArtistList[Line2D]: ...
|
||||
@property
|
||||
def patches(self) -> _AxesBase.ArtistList[Patch]: ...
|
||||
@property
|
||||
def tables(self) -> _AxesBase.ArtistList[Table]: ...
|
||||
@property
|
||||
def texts(self) -> _AxesBase.ArtistList[Text]: ...
|
||||
def get_facecolor(self) -> ColorType: ...
|
||||
def set_facecolor(self, color: ColorType | None) -> None: ...
|
||||
@overload
|
||||
def set_prop_cycle(self, cycler: Cycler | None) -> None: ...
|
||||
@overload
|
||||
def set_prop_cycle(self, label: str, values: Iterable[Any]) -> None: ...
|
||||
@overload
|
||||
def set_prop_cycle(self, **kwargs: Iterable[Any]) -> None: ...
|
||||
def get_aspect(self) -> float | Literal["auto"]: ...
|
||||
def set_aspect(
|
||||
self,
|
||||
aspect: float | Literal["auto", "equal"],
|
||||
adjustable: Literal["box", "datalim"] | None = ...,
|
||||
anchor: str | tuple[float, float] | None = ...,
|
||||
share: bool = ...,
|
||||
) -> None: ...
|
||||
def get_adjustable(self) -> Literal["box", "datalim"]: ...
|
||||
def set_adjustable(
|
||||
self, adjustable: Literal["box", "datalim"], share: bool = ...
|
||||
) -> None: ...
|
||||
def get_box_aspect(self) -> float | None: ...
|
||||
def set_box_aspect(self, aspect: float | None = ...) -> None: ...
|
||||
def get_anchor(self) -> str | tuple[float, float]: ...
|
||||
def set_anchor(
|
||||
self, anchor: str | tuple[float, float], share: bool = ...
|
||||
) -> None: ...
|
||||
def get_data_ratio(self) -> float: ...
|
||||
def apply_aspect(self, position: Bbox | None = ...) -> None: ...
|
||||
@overload
|
||||
def axis(
|
||||
self,
|
||||
arg: tuple[float, float, float, float] | bool | str | None = ...,
|
||||
/,
|
||||
*,
|
||||
emit: bool = ...
|
||||
) -> tuple[float, float, float, float]: ...
|
||||
@overload
|
||||
def axis(
|
||||
self,
|
||||
*,
|
||||
emit: bool = ...,
|
||||
xmin: float | None = ...,
|
||||
xmax: float | None = ...,
|
||||
ymin: float | None = ...,
|
||||
ymax: float | None = ...
|
||||
) -> tuple[float, float, float, float]: ...
|
||||
def get_legend(self) -> Legend | None: ...
|
||||
def get_images(self) -> list[AxesImage]: ...
|
||||
def get_lines(self) -> list[Line2D]: ...
|
||||
def get_xaxis(self) -> XAxis: ...
|
||||
def get_yaxis(self) -> YAxis: ...
|
||||
def has_data(self) -> bool: ...
|
||||
def add_artist(self, a: Artist) -> Artist: ...
|
||||
def add_child_axes(self, ax: _AxesBase) -> _AxesBase: ...
|
||||
def add_collection(
|
||||
self, collection: Collection, autolim: bool = ...
|
||||
) -> Collection: ...
|
||||
def add_image(self, image: AxesImage) -> AxesImage: ...
|
||||
def add_line(self, line: Line2D) -> Line2D: ...
|
||||
def add_patch(self, p: Patch) -> Patch: ...
|
||||
def add_table(self, tab: Table) -> Table: ...
|
||||
def add_container(self, container: Container) -> Container: ...
|
||||
def relim(self, visible_only: bool = ...) -> None: ...
|
||||
def update_datalim(
|
||||
self, xys: ArrayLike, updatex: bool = ..., updatey: bool = ...
|
||||
) -> None: ...
|
||||
def in_axes(self, mouseevent: MouseEvent) -> bool: ...
|
||||
def get_autoscale_on(self) -> bool: ...
|
||||
def set_autoscale_on(self, b: bool) -> None: ...
|
||||
@property
|
||||
def use_sticky_edges(self) -> bool: ...
|
||||
@use_sticky_edges.setter
|
||||
def use_sticky_edges(self, b: bool) -> None: ...
|
||||
def get_xmargin(self) -> float: ...
|
||||
def get_ymargin(self) -> float: ...
|
||||
def set_xmargin(self, m: float) -> None: ...
|
||||
def set_ymargin(self, m: float) -> None: ...
|
||||
|
||||
# Probably could be made better with overloads
|
||||
def margins(
|
||||
self,
|
||||
*margins: float,
|
||||
x: float | None = ...,
|
||||
y: float | None = ...,
|
||||
tight: bool | None = ...
|
||||
) -> tuple[float, float] | None: ...
|
||||
def set_rasterization_zorder(self, z: float | None) -> None: ...
|
||||
def get_rasterization_zorder(self) -> float | None: ...
|
||||
def autoscale(
|
||||
self,
|
||||
enable: bool = ...,
|
||||
axis: Literal["both", "x", "y"] = ...,
|
||||
tight: bool | None = ...,
|
||||
) -> None: ...
|
||||
def autoscale_view(
|
||||
self, tight: bool | None = ..., scalex: bool = ..., scaley: bool = ...
|
||||
) -> None: ...
|
||||
def draw_artist(self, a: Artist) -> None: ...
|
||||
def redraw_in_frame(self) -> None: ...
|
||||
def get_frame_on(self) -> bool: ...
|
||||
def set_frame_on(self, b: bool) -> None: ...
|
||||
def get_axisbelow(self) -> bool | Literal["line"]: ...
|
||||
def set_axisbelow(self, b: bool | Literal["line"]) -> None: ...
|
||||
def grid(
|
||||
self,
|
||||
visible: bool | None = ...,
|
||||
which: Literal["major", "minor", "both"] = ...,
|
||||
axis: Literal["both", "x", "y"] = ...,
|
||||
**kwargs
|
||||
) -> None: ...
|
||||
def ticklabel_format(
|
||||
self,
|
||||
*,
|
||||
axis: Literal["both", "x", "y"] = ...,
|
||||
style: Literal["", "sci", "scientific", "plain"] | None = ...,
|
||||
scilimits: tuple[int, int] | None = ...,
|
||||
useOffset: bool | float | None = ...,
|
||||
useLocale: bool | None = ...,
|
||||
useMathText: bool | None = ...
|
||||
) -> None: ...
|
||||
def locator_params(
|
||||
self, axis: Literal["both", "x", "y"] = ..., tight: bool | None = ..., **kwargs
|
||||
) -> None: ...
|
||||
def tick_params(self, axis: Literal["both", "x", "y"] = ..., **kwargs) -> None: ...
|
||||
def set_axis_off(self) -> None: ...
|
||||
def set_axis_on(self) -> None: ...
|
||||
def get_xlabel(self) -> str: ...
|
||||
def set_xlabel(
|
||||
self,
|
||||
xlabel: str,
|
||||
fontdict: dict[str, Any] | None = ...,
|
||||
labelpad: float | None = ...,
|
||||
*,
|
||||
loc: Literal["left", "center", "right"] | None = ...,
|
||||
**kwargs
|
||||
) -> Text: ...
|
||||
def invert_xaxis(self) -> None: ...
|
||||
def get_xbound(self) -> tuple[float, float]: ...
|
||||
def set_xbound(
|
||||
self, lower: float | None = ..., upper: float | None = ...
|
||||
) -> None: ...
|
||||
def get_xlim(self) -> tuple[float, float]: ...
|
||||
def set_xlim(
|
||||
self,
|
||||
left: float | tuple[float, float] | None = ...,
|
||||
right: float | None = ...,
|
||||
*,
|
||||
emit: bool = ...,
|
||||
auto: bool | None = ...,
|
||||
xmin: float | None = ...,
|
||||
xmax: float | None = ...
|
||||
) -> tuple[float, float]: ...
|
||||
def get_ylabel(self) -> str: ...
|
||||
def set_ylabel(
|
||||
self,
|
||||
ylabel: str,
|
||||
fontdict: dict[str, Any] | None = ...,
|
||||
labelpad: float | None = ...,
|
||||
*,
|
||||
loc: Literal["bottom", "center", "top"] | None = ...,
|
||||
**kwargs
|
||||
) -> Text: ...
|
||||
def invert_yaxis(self) -> None: ...
|
||||
def get_ybound(self) -> tuple[float, float]: ...
|
||||
def set_ybound(
|
||||
self, lower: float | None = ..., upper: float | None = ...
|
||||
) -> None: ...
|
||||
def get_ylim(self) -> tuple[float, float]: ...
|
||||
def set_ylim(
|
||||
self,
|
||||
bottom: float | tuple[float, float] | None = ...,
|
||||
top: float | None = ...,
|
||||
*,
|
||||
emit: bool = ...,
|
||||
auto: bool | None = ...,
|
||||
ymin: float | None = ...,
|
||||
ymax: float | None = ...
|
||||
) -> tuple[float, float]: ...
|
||||
def format_xdata(self, x: float) -> str: ...
|
||||
def format_ydata(self, y: float) -> str: ...
|
||||
def format_coord(self, x: float, y: float) -> str: ...
|
||||
def minorticks_on(self) -> None: ...
|
||||
def minorticks_off(self) -> None: ...
|
||||
def can_zoom(self) -> bool: ...
|
||||
def can_pan(self) -> bool: ...
|
||||
def get_navigate(self) -> bool: ...
|
||||
def set_navigate(self, b: bool) -> None: ...
|
||||
def get_forward_navigation_events(self) -> bool | Literal["auto"]: ...
|
||||
def set_forward_navigation_events(self, forward: bool | Literal["auto"]) -> None: ...
|
||||
def get_navigate_mode(self) -> Literal["PAN", "ZOOM"] | None: ...
|
||||
def set_navigate_mode(self, b: Literal["PAN", "ZOOM"] | None) -> None: ...
|
||||
def start_pan(self, x: float, y: float, button: MouseButton) -> None: ...
|
||||
def end_pan(self) -> None: ...
|
||||
def drag_pan(
|
||||
self, button: MouseButton, key: str | None, x: float, y: float
|
||||
) -> None: ...
|
||||
def get_children(self) -> list[Artist]: ...
|
||||
def contains_point(self, point: tuple[int, int]) -> bool: ...
|
||||
def get_default_bbox_extra_artists(self) -> list[Artist]: ...
|
||||
def get_tightbbox(
|
||||
self,
|
||||
renderer: RendererBase | None = ...,
|
||||
*,
|
||||
call_axes_locator: bool = ...,
|
||||
bbox_extra_artists: Sequence[Artist] | None = ...,
|
||||
for_layout_only: bool = ...
|
||||
) -> Bbox | None: ...
|
||||
def twinx(self) -> Axes: ...
|
||||
def twiny(self) -> Axes: ...
|
||||
def get_shared_x_axes(self) -> cbook.GrouperView: ...
|
||||
def get_shared_y_axes(self) -> cbook.GrouperView: ...
|
||||
def label_outer(self, remove_inner_ticks: bool = ...) -> None: ...
|
||||
|
||||
# The methods underneath this line are added via the `_axis_method_wrapper` class
|
||||
# Initially they are set to an object, but that object uses `__set_name__` to override
|
||||
# itself with a method modified from the Axis methods for the x or y Axis.
|
||||
# As such, they are typed according to the resultant method rather than as that object.
|
||||
|
||||
def get_xgridlines(self) -> list[Line2D]: ...
|
||||
def get_xticklines(self, minor: bool = ...) -> list[Line2D]: ...
|
||||
def get_ygridlines(self) -> list[Line2D]: ...
|
||||
def get_yticklines(self, minor: bool = ...) -> list[Line2D]: ...
|
||||
def _sci(self, im: ColorizingArtist) -> None: ...
|
||||
def get_autoscalex_on(self) -> bool: ...
|
||||
def get_autoscaley_on(self) -> bool: ...
|
||||
def set_autoscalex_on(self, b: bool) -> None: ...
|
||||
def set_autoscaley_on(self, b: bool) -> None: ...
|
||||
def xaxis_inverted(self) -> bool: ...
|
||||
def get_xscale(self) -> str: ...
|
||||
def set_xscale(self, value: str | ScaleBase, **kwargs) -> None: ...
|
||||
def get_xticks(self, *, minor: bool = ...) -> np.ndarray: ...
|
||||
def set_xticks(
|
||||
self,
|
||||
ticks: ArrayLike,
|
||||
labels: Iterable[str] | None = ...,
|
||||
*,
|
||||
minor: bool = ...,
|
||||
**kwargs
|
||||
) -> list[Tick]: ...
|
||||
def get_xmajorticklabels(self) -> list[Text]: ...
|
||||
def get_xminorticklabels(self) -> list[Text]: ...
|
||||
def get_xticklabels(
|
||||
self, minor: bool = ..., which: Literal["major", "minor", "both"] | None = ...
|
||||
) -> list[Text]: ...
|
||||
def set_xticklabels(
|
||||
self,
|
||||
labels: Iterable[str | Text],
|
||||
*,
|
||||
minor: bool = ...,
|
||||
fontdict: dict[str, Any] | None = ...,
|
||||
**kwargs
|
||||
) -> list[Text]: ...
|
||||
def yaxis_inverted(self) -> bool: ...
|
||||
def get_yscale(self) -> str: ...
|
||||
def set_yscale(self, value: str | ScaleBase, **kwargs) -> None: ...
|
||||
def get_yticks(self, *, minor: bool = ...) -> np.ndarray: ...
|
||||
def set_yticks(
|
||||
self,
|
||||
ticks: ArrayLike,
|
||||
labels: Iterable[str] | None = ...,
|
||||
*,
|
||||
minor: bool = ...,
|
||||
**kwargs
|
||||
) -> list[Tick]: ...
|
||||
def get_ymajorticklabels(self) -> list[Text]: ...
|
||||
def get_yminorticklabels(self) -> list[Text]: ...
|
||||
def get_yticklabels(
|
||||
self, minor: bool = ..., which: Literal["major", "minor", "both"] | None = ...
|
||||
) -> list[Text]: ...
|
||||
def set_yticklabels(
|
||||
self,
|
||||
labels: Iterable[str | Text],
|
||||
*,
|
||||
minor: bool = ...,
|
||||
fontdict: dict[str, Any] | None = ...,
|
||||
**kwargs
|
||||
) -> list[Text]: ...
|
||||
def xaxis_date(self, tz: str | datetime.tzinfo | None = ...) -> None: ...
|
||||
def yaxis_date(self, tz: str | datetime.tzinfo | None = ...) -> None: ...
|
||||
|
|
@ -0,0 +1,322 @@
|
|||
import numbers
|
||||
|
||||
import numpy as np
|
||||
|
||||
from matplotlib import _api, _docstring, transforms
|
||||
import matplotlib.ticker as mticker
|
||||
from matplotlib.axes._base import _AxesBase, _TransformedBoundsLocator
|
||||
from matplotlib.axis import Axis
|
||||
from matplotlib.transforms import Transform
|
||||
|
||||
|
||||
class SecondaryAxis(_AxesBase):
|
||||
"""
|
||||
General class to hold a Secondary_X/Yaxis.
|
||||
"""
|
||||
|
||||
def __init__(self, parent, orientation, location, functions, transform=None,
|
||||
**kwargs):
|
||||
"""
|
||||
See `.secondary_xaxis` and `.secondary_yaxis` for the doc string.
|
||||
While there is no need for this to be private, it should really be
|
||||
called by those higher level functions.
|
||||
"""
|
||||
_api.check_in_list(["x", "y"], orientation=orientation)
|
||||
self._functions = functions
|
||||
self._parent = parent
|
||||
self._orientation = orientation
|
||||
self._ticks_set = False
|
||||
|
||||
fig = self._parent.get_figure(root=False)
|
||||
if self._orientation == 'x':
|
||||
super().__init__(fig, [0, 1., 1, 0.0001], **kwargs)
|
||||
self._axis = self.xaxis
|
||||
self._locstrings = ['top', 'bottom']
|
||||
self._otherstrings = ['left', 'right']
|
||||
else: # 'y'
|
||||
super().__init__(fig, [0, 1., 0.0001, 1], **kwargs)
|
||||
self._axis = self.yaxis
|
||||
self._locstrings = ['right', 'left']
|
||||
self._otherstrings = ['top', 'bottom']
|
||||
self._parentscale = None
|
||||
# this gets positioned w/o constrained_layout so exclude:
|
||||
|
||||
self.set_location(location, transform)
|
||||
self.set_functions(functions)
|
||||
|
||||
# styling:
|
||||
otheraxis = self.yaxis if self._orientation == 'x' else self.xaxis
|
||||
otheraxis.set_major_locator(mticker.NullLocator())
|
||||
otheraxis.set_ticks_position('none')
|
||||
|
||||
self.spines[self._otherstrings].set_visible(False)
|
||||
self.spines[self._locstrings].set_visible(True)
|
||||
|
||||
if self._pos < 0.5:
|
||||
# flip the location strings...
|
||||
self._locstrings = self._locstrings[::-1]
|
||||
self.set_alignment(self._locstrings[0])
|
||||
|
||||
def set_alignment(self, align):
|
||||
"""
|
||||
Set if axes spine and labels are drawn at top or bottom (or left/right)
|
||||
of the Axes.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
align : {'top', 'bottom', 'left', 'right'}
|
||||
Either 'top' or 'bottom' for orientation='x' or
|
||||
'left' or 'right' for orientation='y' axis.
|
||||
"""
|
||||
_api.check_in_list(self._locstrings, align=align)
|
||||
if align == self._locstrings[1]: # Need to change the orientation.
|
||||
self._locstrings = self._locstrings[::-1]
|
||||
self.spines[self._locstrings[0]].set_visible(True)
|
||||
self.spines[self._locstrings[1]].set_visible(False)
|
||||
self._axis.set_ticks_position(align)
|
||||
self._axis.set_label_position(align)
|
||||
|
||||
def set_location(self, location, transform=None):
|
||||
"""
|
||||
Set the vertical or horizontal location of the axes in
|
||||
parent-normalized coordinates.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
location : {'top', 'bottom', 'left', 'right'} or float
|
||||
The position to put the secondary axis. Strings can be 'top' or
|
||||
'bottom' for orientation='x' and 'right' or 'left' for
|
||||
orientation='y'. A float indicates the relative position on the
|
||||
parent Axes to put the new Axes, 0.0 being the bottom (or left)
|
||||
and 1.0 being the top (or right).
|
||||
|
||||
transform : `.Transform`, optional
|
||||
Transform for the location to use. Defaults to
|
||||
the parent's ``transAxes``, so locations are normally relative to
|
||||
the parent axes.
|
||||
|
||||
.. versionadded:: 3.9
|
||||
"""
|
||||
|
||||
_api.check_isinstance((transforms.Transform, None), transform=transform)
|
||||
|
||||
# This puts the rectangle into figure-relative coordinates.
|
||||
if isinstance(location, str):
|
||||
_api.check_in_list(self._locstrings, location=location)
|
||||
self._pos = 1. if location in ('top', 'right') else 0.
|
||||
elif isinstance(location, numbers.Real):
|
||||
self._pos = location
|
||||
else:
|
||||
raise ValueError(
|
||||
f"location must be {self._locstrings[0]!r}, "
|
||||
f"{self._locstrings[1]!r}, or a float, not {location!r}")
|
||||
|
||||
self._loc = location
|
||||
|
||||
if self._orientation == 'x':
|
||||
# An x-secondary axes is like an inset axes from x = 0 to x = 1 and
|
||||
# from y = pos to y = pos + eps, in the parent's transAxes coords.
|
||||
bounds = [0, self._pos, 1., 1e-10]
|
||||
|
||||
# If a transformation is provided, use its y component rather than
|
||||
# the parent's transAxes. This can be used to place axes in the data
|
||||
# coords, for instance.
|
||||
if transform is not None:
|
||||
transform = transforms.blended_transform_factory(
|
||||
self._parent.transAxes, transform)
|
||||
else: # 'y'
|
||||
bounds = [self._pos, 0, 1e-10, 1]
|
||||
if transform is not None:
|
||||
transform = transforms.blended_transform_factory(
|
||||
transform, self._parent.transAxes) # Use provided x axis
|
||||
|
||||
# If no transform is provided, use the parent's transAxes
|
||||
if transform is None:
|
||||
transform = self._parent.transAxes
|
||||
|
||||
# this locator lets the axes move in the parent axes coordinates.
|
||||
# so it never needs to know where the parent is explicitly in
|
||||
# figure coordinates.
|
||||
# it gets called in ax.apply_aspect() (of all places)
|
||||
self.set_axes_locator(_TransformedBoundsLocator(bounds, transform))
|
||||
|
||||
def apply_aspect(self, position=None):
|
||||
# docstring inherited.
|
||||
self._set_lims()
|
||||
super().apply_aspect(position)
|
||||
|
||||
@_docstring.copy(Axis.set_ticks)
|
||||
def set_ticks(self, ticks, labels=None, *, minor=False, **kwargs):
|
||||
ret = self._axis.set_ticks(ticks, labels, minor=minor, **kwargs)
|
||||
self.stale = True
|
||||
self._ticks_set = True
|
||||
return ret
|
||||
|
||||
def set_functions(self, functions):
|
||||
"""
|
||||
Set how the secondary axis converts limits from the parent Axes.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
functions : 2-tuple of func, or `Transform` with an inverse.
|
||||
Transform between the parent axis values and the secondary axis
|
||||
values.
|
||||
|
||||
If supplied as a 2-tuple of functions, the first function is
|
||||
the forward transform function and the second is the inverse
|
||||
transform.
|
||||
|
||||
If a transform is supplied, then the transform must have an
|
||||
inverse.
|
||||
"""
|
||||
|
||||
if (isinstance(functions, tuple) and len(functions) == 2 and
|
||||
callable(functions[0]) and callable(functions[1])):
|
||||
# make an arbitrary convert from a two-tuple of functions
|
||||
# forward and inverse.
|
||||
self._functions = functions
|
||||
elif isinstance(functions, Transform):
|
||||
self._functions = (
|
||||
functions.transform,
|
||||
lambda x: functions.inverted().transform(x)
|
||||
)
|
||||
elif functions is None:
|
||||
self._functions = (lambda x: x, lambda x: x)
|
||||
else:
|
||||
raise ValueError('functions argument of secondary Axes '
|
||||
'must be a two-tuple of callable functions '
|
||||
'with the first function being the transform '
|
||||
'and the second being the inverse')
|
||||
self._set_scale()
|
||||
|
||||
def draw(self, renderer):
|
||||
"""
|
||||
Draw the secondary Axes.
|
||||
|
||||
Consults the parent Axes for its limits and converts them
|
||||
using the converter specified by
|
||||
`~.axes._secondary_axes.set_functions` (or *functions*
|
||||
parameter when Axes initialized.)
|
||||
"""
|
||||
self._set_lims()
|
||||
# this sets the scale in case the parent has set its scale.
|
||||
self._set_scale()
|
||||
super().draw(renderer)
|
||||
|
||||
def _set_scale(self):
|
||||
"""
|
||||
Check if parent has set its scale
|
||||
"""
|
||||
|
||||
if self._orientation == 'x':
|
||||
pscale = self._parent.xaxis.get_scale()
|
||||
set_scale = self.set_xscale
|
||||
else: # 'y'
|
||||
pscale = self._parent.yaxis.get_scale()
|
||||
set_scale = self.set_yscale
|
||||
if pscale == self._parentscale:
|
||||
return
|
||||
|
||||
if self._ticks_set:
|
||||
ticks = self._axis.get_ticklocs()
|
||||
|
||||
# need to invert the roles here for the ticks to line up.
|
||||
set_scale('functionlog' if pscale == 'log' else 'function',
|
||||
functions=self._functions[::-1])
|
||||
|
||||
# OK, set_scale sets the locators, but if we've called
|
||||
# axsecond.set_ticks, we want to keep those.
|
||||
if self._ticks_set:
|
||||
self._axis.set_major_locator(mticker.FixedLocator(ticks))
|
||||
|
||||
# If the parent scale doesn't change, we can skip this next time.
|
||||
self._parentscale = pscale
|
||||
|
||||
def _set_lims(self):
|
||||
"""
|
||||
Set the limits based on parent limits and the convert method
|
||||
between the parent and this secondary Axes.
|
||||
"""
|
||||
if self._orientation == 'x':
|
||||
lims = self._parent.get_xlim()
|
||||
set_lim = self.set_xlim
|
||||
else: # 'y'
|
||||
lims = self._parent.get_ylim()
|
||||
set_lim = self.set_ylim
|
||||
order = lims[0] < lims[1]
|
||||
lims = self._functions[0](np.array(lims))
|
||||
neworder = lims[0] < lims[1]
|
||||
if neworder != order:
|
||||
# Flip because the transform will take care of the flipping.
|
||||
lims = lims[::-1]
|
||||
set_lim(lims)
|
||||
|
||||
def set_aspect(self, *args, **kwargs):
|
||||
"""
|
||||
Secondary Axes cannot set the aspect ratio, so calling this just
|
||||
sets a warning.
|
||||
"""
|
||||
_api.warn_external("Secondary Axes can't set the aspect ratio")
|
||||
|
||||
def set_color(self, color):
|
||||
"""
|
||||
Change the color of the secondary Axes and all decorators.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
color : :mpltype:`color`
|
||||
"""
|
||||
axis = self._axis_map[self._orientation]
|
||||
axis.set_tick_params(colors=color)
|
||||
for spine in self.spines.values():
|
||||
if spine.axis is axis:
|
||||
spine.set_color(color)
|
||||
axis.label.set_color(color)
|
||||
|
||||
|
||||
_secax_docstring = '''
|
||||
Warnings
|
||||
--------
|
||||
This method is experimental as of 3.1, and the API may change.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
location : {'top', 'bottom', 'left', 'right'} or float
|
||||
The position to put the secondary axis. Strings can be 'top' or
|
||||
'bottom' for orientation='x' and 'right' or 'left' for
|
||||
orientation='y'. A float indicates the relative position on the
|
||||
parent Axes to put the new Axes, 0.0 being the bottom (or left)
|
||||
and 1.0 being the top (or right).
|
||||
|
||||
functions : 2-tuple of func, or Transform with an inverse
|
||||
|
||||
If a 2-tuple of functions, the user specifies the transform
|
||||
function and its inverse. i.e.
|
||||
``functions=(lambda x: 2 / x, lambda x: 2 / x)`` would be an
|
||||
reciprocal transform with a factor of 2. Both functions must accept
|
||||
numpy arrays as input.
|
||||
|
||||
The user can also directly supply a subclass of
|
||||
`.transforms.Transform` so long as it has an inverse.
|
||||
|
||||
See :doc:`/gallery/subplots_axes_and_figures/secondary_axis`
|
||||
for examples of making these conversions.
|
||||
|
||||
transform : `.Transform`, optional
|
||||
If specified, *location* will be
|
||||
placed relative to this transform (in the direction of the axis)
|
||||
rather than the parent's axis. i.e. a secondary x-axis will
|
||||
use the provided y transform and the x transform of the parent.
|
||||
|
||||
.. versionadded:: 3.9
|
||||
|
||||
Returns
|
||||
-------
|
||||
ax : axes._secondary_axes.SecondaryAxis
|
||||
|
||||
Other Parameters
|
||||
----------------
|
||||
**kwargs : `~matplotlib.axes.Axes` properties.
|
||||
Other miscellaneous Axes parameters.
|
||||
'''
|
||||
_docstring.interpd.register(_secax_docstring=_secax_docstring)
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
from matplotlib.axes._base import _AxesBase
|
||||
from matplotlib.axis import Tick
|
||||
|
||||
from matplotlib.transforms import Transform
|
||||
|
||||
from collections.abc import Callable, Iterable
|
||||
from typing import Literal
|
||||
from numpy.typing import ArrayLike
|
||||
from matplotlib.typing import ColorType
|
||||
|
||||
class SecondaryAxis(_AxesBase):
|
||||
def __init__(
|
||||
self,
|
||||
parent: _AxesBase,
|
||||
orientation: Literal["x", "y"],
|
||||
location: Literal["top", "bottom", "right", "left"] | float,
|
||||
functions: tuple[
|
||||
Callable[[ArrayLike], ArrayLike], Callable[[ArrayLike], ArrayLike]
|
||||
]
|
||||
| Transform,
|
||||
transform: Transform | None = ...,
|
||||
**kwargs
|
||||
) -> None: ...
|
||||
def set_alignment(
|
||||
self, align: Literal["top", "bottom", "right", "left"]
|
||||
) -> None: ...
|
||||
def set_location(
|
||||
self,
|
||||
location: Literal["top", "bottom", "right", "left"] | float,
|
||||
transform: Transform | None = ...
|
||||
) -> None: ...
|
||||
def set_ticks(
|
||||
self,
|
||||
ticks: ArrayLike,
|
||||
labels: Iterable[str] | None = ...,
|
||||
*,
|
||||
minor: bool = ...,
|
||||
**kwargs
|
||||
) -> list[Tick]: ...
|
||||
def set_functions(
|
||||
self,
|
||||
functions: tuple[Callable[[ArrayLike], ArrayLike], Callable[[ArrayLike], ArrayLike]] | Transform,
|
||||
) -> None: ...
|
||||
def set_aspect(self, *args, **kwargs) -> None: ...
|
||||
def set_color(self, color: ColorType) -> None: ...
|
||||
Loading…
Add table
Add a link
Reference in a new issue