Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Corrected stubs for mutlivariate and bivariate colormaps
  • Loading branch information
trygvrad committed Jul 26, 2024
commit 40dda085b970a0f5dedc7fc2b466c56063775836
2 changes: 2 additions & 0 deletions lib/matplotlib/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,6 @@ def _preprocess_data(
) -> Callable: ...

from matplotlib.cm import _colormaps as colormaps # noqa: E402
from matplotlib.cm import _multivar_colormaps as multivar_colormaps # noqa: E402
from matplotlib.cm import _bivar_colormaps as bivar_colormaps # noqa: E402
from matplotlib.colors import _color_sequences as color_sequences # noqa: E402
2 changes: 2 additions & 0 deletions lib/matplotlib/cm.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class ColormapRegistry(Mapping[str, colors.Colormap]):
def get_cmap(self, cmap: str | colors.Colormap) -> colors.Colormap: ...

_colormaps: ColormapRegistry = ...
_multivar_colormaps: ColormapRegistry = ...
_bivar_colormaps: ColormapRegistry = ...

def get_cmap(name: str | colors.Colormap | None = ..., lut: int | None = ...) -> colors.Colormap: ...

Expand Down
26 changes: 15 additions & 11 deletions lib/matplotlib/colors.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -141,46 +141,45 @@ class ListedColormap(Colormap):
class MultivarColormap:
name: str
colormaps: list[Colormap]
combination_mode: str
n_variates: int
def __init__(self, name: str, colormaps: list[Colormap], combination_mode: str) -> None: ...
@overload
def __call__(
self, X: Sequence[Sequence[float]] | np.ndarray, alpha: ArrayLike | None = ..., bytes: bool = ...
self, X: Sequence[Sequence[float]] | np.ndarray, alpha: ArrayLike | None = ..., bytes: bool = ..., clip: bool = ...
) -> np.ndarray: ...
@overload
def __call__(
self, X: Sequence[float], alpha: float | None = ..., bytes: bool = ...
self, X: Sequence[float], alpha: float | None = ..., bytes: bool = ..., clip: bool = ...
) -> tuple[float, float, float, float]: ...
@overload
def __call__(
self, X: ArrayLike, alpha: ArrayLike | None = ..., bytes: bool = ...
self, X: ArrayLike, alpha: ArrayLike | None = ..., bytes: bool = ..., clip: bool = ...
) -> tuple[float, float, float, float] | np.ndarray: ...
def copy(self) -> MultivarColormap: ...
def __copy__(self) -> MultivarColormap: ...
def __getitem__(self, item: int) -> Colormap: ...
def __iter__(self) -> Colormap: ...
def __len__(self) -> int: ...
def get_bad(self) -> np.ndarray: ...
def resampled(self, lutsize: Sequence[int | None]) -> MultivarColormap: ...
def resampled(self, lutshape: Sequence[int | None]) -> MultivarColormap: ...
def with_extremes(
self,
*,
bad: ColorType | None = ...,
under: Sequence[ColorType] | None = ...,
over: Sequence[ColorType] | None = ...
) -> MultivarColormap: ...
@property
def combination_mode(self) -> str: ...
def _repr_html_(self) -> str: ...
def _repr_png_(self) -> bytes: ...

class BivarColormap:
name: str
N: int
M: int
shape: str
n_variates: int
origin: tuple[float, float]
def __init__(self, name: str, N: int = ..., M: int | None = ..., shape: str = ..., origin: tuple[float, float] = ...
def __init__(self, name: str, N: int = ..., M: int | None = ..., shape: str = ..., origin: Sequence[float] = ...
) -> None: ...
@overload
def __call__(
Expand All @@ -196,13 +195,17 @@ class BivarColormap:
) -> tuple[float, float, float, float] | np.ndarray: ...
@property
def lut(self) -> np.ndarray: ...
@property
def shape(self) -> str: ...
@property
def origin(self) -> tuple[float, float]: ...
def __copy__(self) -> BivarColormap: ...
def __getitem__(self, item: int) -> Colormap: ...
def __eq__(self, other) -> bool: ...
def get_bad(self) -> np.ndarray: ...
def get_outside(self) -> np.ndarray: ...
def copy(self) -> BivarColormap: ...
def resampled(self, lutsize: Sequence[int | None]) -> BivarColormap: ...
def resampled(self, lutshape: Sequence[int | None], transposed: bool = ...) -> BivarColormap: ...
def transposed(self) -> BivarColormap: ...
def reversed(self, axis_0: bool = True, axis_1: bool = True) -> BivarColormap: ...
def with_extremes(
Expand All @@ -211,17 +214,18 @@ class BivarColormap:
bad: ColorType | None = ...,
outside: ColorType | None = ...,
shape: str | None = ...,
origin: None | Sequence[float] = ...,
) -> MultivarColormap: ...
def _repr_html_(self) -> str: ...
def _repr_png_(self) -> bytes: ...

class SegmentedBivarColormap(BivarColormap):
def __init__(
self, patch: np.ndarray, name: str, N: int = ..., shape: str = ..., origin: tuple[float, float] = ...
self, patch: np.ndarray, name: str, N: int = ..., shape: str = ..., origin: Sequence[float] = ...
) -> None: ...

class BivarColormapFromImage(BivarColormap):
def __init__(self, lut: np.ndarray, name: str = ..., shape: str = ..., origin: tuple[float, float] = ...
def __init__(self, lut: np.ndarray, name: str = ..., shape: str = ..., origin: Sequence[float] = ...
) -> None: ...

class Normalize:
Expand Down