Skip to content

Commit 365df72

Browse files
committed
Corrected stubs for mutlivariate and bivariate colormaps
1 parent d040c28 commit 365df72

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

lib/matplotlib/__init__.pyi

+2
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,6 @@ def _preprocess_data(
112112
) -> Callable: ...
113113

114114
from matplotlib.cm import _colormaps as colormaps
115+
from matplotlib.cm import _multivar_colormaps as multivar_colormaps
116+
from matplotlib.cm import _bivar_colormaps as bivar_colormaps
115117
from matplotlib.colors import _color_sequences as color_sequences

lib/matplotlib/cm.pyi

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ class ColormapRegistry(Mapping[str, colors.Colormap]):
1818
def get_cmap(self, cmap: str | colors.Colormap) -> colors.Colormap: ...
1919

2020
_colormaps: ColormapRegistry = ...
21+
_multivar_colormaps: ColormapRegistry = ...
22+
_bivar_colormaps: ColormapRegistry = ...
2123

2224
class ScalarMappable:
2325
cmap: colors.Colormap | None

lib/matplotlib/colors.pyi

+15-11
Original file line numberDiff line numberDiff line change
@@ -141,46 +141,45 @@ class ListedColormap(Colormap):
141141
class MultivarColormap:
142142
name: str
143143
colormaps: list[Colormap]
144-
combination_mode: str
145144
n_variates: int
146145
def __init__(self, name: str, colormaps: list[Colormap], combination_mode: str) -> None: ...
147146
@overload
148147
def __call__(
149-
self, X: Sequence[Sequence[float]] | np.ndarray, alpha: ArrayLike | None = ..., bytes: bool = ...
148+
self, X: Sequence[Sequence[float]] | np.ndarray, alpha: ArrayLike | None = ..., bytes: bool = ..., clip: bool = ...
150149
) -> np.ndarray: ...
151150
@overload
152151
def __call__(
153-
self, X: Sequence[float], alpha: float | None = ..., bytes: bool = ...
152+
self, X: Sequence[float], alpha: float | None = ..., bytes: bool = ..., clip: bool = ...
154153
) -> tuple[float, float, float, float]: ...
155154
@overload
156155
def __call__(
157-
self, X: ArrayLike, alpha: ArrayLike | None = ..., bytes: bool = ...
156+
self, X: ArrayLike, alpha: ArrayLike | None = ..., bytes: bool = ..., clip: bool = ...
158157
) -> tuple[float, float, float, float] | np.ndarray: ...
159158
def copy(self) -> MultivarColormap: ...
160159
def __copy__(self) -> MultivarColormap: ...
161160
def __getitem__(self, item: int) -> Colormap: ...
162161
def __iter__(self) -> Colormap: ...
163162
def __len__(self) -> int: ...
164163
def get_bad(self) -> np.ndarray: ...
165-
def resampled(self, lutsize: Sequence[int | None]) -> MultivarColormap: ...
164+
def resampled(self, lutshape: Sequence[int | None]) -> MultivarColormap: ...
166165
def with_extremes(
167166
self,
168167
*,
169168
bad: ColorType | None = ...,
170169
under: Sequence[ColorType] | None = ...,
171170
over: Sequence[ColorType] | None = ...
172171
) -> MultivarColormap: ...
172+
@property
173+
def combination_mode(self) -> str: ...
173174
def _repr_html_(self) -> str: ...
174175
def _repr_png_(self) -> bytes: ...
175176

176177
class BivarColormap:
177178
name: str
178179
N: int
179180
M: int
180-
shape: str
181181
n_variates: int
182-
origin: tuple[float, float]
183-
def __init__(self, name: str, N: int = ..., M: int | None = ..., shape: str = ..., origin: tuple[float, float] = ...
182+
def __init__(self, name: str, N: int = ..., M: int | None = ..., shape: str = ..., origin: Sequence[float] = ...
184183
) -> None: ...
185184
@overload
186185
def __call__(
@@ -196,13 +195,17 @@ class BivarColormap:
196195
) -> tuple[float, float, float, float] | np.ndarray: ...
197196
@property
198197
def lut(self) -> np.ndarray: ...
198+
@property
199+
def shape(self) -> str: ...
200+
@property
201+
def origin(self) -> tuple[float, float]: ...
199202
def __copy__(self) -> BivarColormap: ...
200203
def __getitem__(self, item: int) -> Colormap: ...
201204
def __eq__(self, other) -> bool: ...
202205
def get_bad(self) -> np.ndarray: ...
203206
def get_outside(self) -> np.ndarray: ...
204207
def copy(self) -> BivarColormap: ...
205-
def resampled(self, lutsize: Sequence[int | None]) -> BivarColormap: ...
208+
def resampled(self, lutshape: Sequence[int | None], transposed: bool = ...) -> BivarColormap: ...
206209
def transposed(self) -> BivarColormap: ...
207210
def reversed(self, axis_0: bool = True, axis_1: bool = True) -> BivarColormap: ...
208211
def with_extremes(
@@ -211,17 +214,18 @@ class BivarColormap:
211214
bad: ColorType | None = ...,
212215
outside: ColorType | None = ...,
213216
shape: str | None = ...,
217+
origin: None | Sequence[float] = ...,
214218
) -> MultivarColormap: ...
215219
def _repr_html_(self) -> str: ...
216220
def _repr_png_(self) -> bytes: ...
217221

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

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

227231
class Normalize:

0 commit comments

Comments
 (0)