cm.pyi 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. from collections.abc import Iterator, Mapping
  2. from matplotlib import cbook, colors
  3. from matplotlib.colorbar import Colorbar
  4. import numpy as np
  5. from numpy.typing import ArrayLike
  6. class ColormapRegistry(Mapping[str, colors.Colormap]):
  7. def __init__(self, cmaps: Mapping[str, colors.Colormap]) -> None: ...
  8. def __getitem__(self, item: str) -> colors.Colormap: ...
  9. def __iter__(self) -> Iterator[str]: ...
  10. def __len__(self) -> int: ...
  11. def __call__(self) -> list[str]: ...
  12. def register(
  13. self, cmap: colors.Colormap, *, name: str | None = ..., force: bool = ...
  14. ) -> None: ...
  15. def unregister(self, name: str) -> None: ...
  16. def get_cmap(self, cmap: str | colors.Colormap) -> colors.Colormap: ...
  17. _colormaps: ColormapRegistry = ...
  18. def get_cmap(name: str | colors.Colormap | None = ..., lut: int | None = ...) -> colors.Colormap: ...
  19. class ScalarMappable:
  20. cmap: colors.Colormap | None
  21. colorbar: Colorbar | None
  22. callbacks: cbook.CallbackRegistry
  23. def __init__(
  24. self,
  25. norm: colors.Normalize | None = ...,
  26. cmap: str | colors.Colormap | None = ...,
  27. ) -> None: ...
  28. def to_rgba(
  29. self,
  30. x: np.ndarray,
  31. alpha: float | ArrayLike | None = ...,
  32. bytes: bool = ...,
  33. norm: bool = ...,
  34. ) -> np.ndarray: ...
  35. def set_array(self, A: ArrayLike | None) -> None: ...
  36. def get_array(self) -> np.ndarray | None: ...
  37. def get_cmap(self) -> colors.Colormap: ...
  38. def get_clim(self) -> tuple[float, float]: ...
  39. def set_clim(self, vmin: float | tuple[float, float] | None = ..., vmax: float | None = ...) -> None: ...
  40. def get_alpha(self) -> float | None: ...
  41. def set_cmap(self, cmap: str | colors.Colormap) -> None: ...
  42. @property
  43. def norm(self) -> colors.Normalize: ...
  44. @norm.setter
  45. def norm(self, norm: colors.Normalize | str | None) -> None: ...
  46. def set_norm(self, norm: colors.Normalize | str | None) -> None: ...
  47. def autoscale(self) -> None: ...
  48. def autoscale_None(self) -> None: ...
  49. def changed(self) -> None: ...