contour.pyi 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. import matplotlib.cm as cm
  2. from matplotlib.artist import Artist
  3. from matplotlib.axes import Axes
  4. from matplotlib.collections import Collection, PathCollection
  5. from matplotlib.colorizer import Colorizer, ColorizingArtist
  6. from matplotlib.colors import Colormap, Normalize
  7. from matplotlib.path import Path
  8. from matplotlib.patches import Patch
  9. from matplotlib.text import Text
  10. from matplotlib.transforms import Transform, TransformedPatchPath, TransformedPath
  11. from matplotlib.ticker import Locator, Formatter
  12. from numpy.typing import ArrayLike
  13. import numpy as np
  14. from collections.abc import Callable, Iterable, Sequence
  15. from typing import Literal
  16. from .typing import ColorType
  17. class ContourLabeler:
  18. labelFmt: str | Formatter | Callable[[float], str] | dict[float, str]
  19. labelManual: bool | Iterable[tuple[float, float]]
  20. rightside_up: bool
  21. labelLevelList: list[float]
  22. labelIndiceList: list[int]
  23. labelMappable: cm.ScalarMappable | ColorizingArtist
  24. labelCValueList: list[ColorType]
  25. labelXYs: list[tuple[float, float]]
  26. def clabel(
  27. self,
  28. levels: ArrayLike | None = ...,
  29. *,
  30. fontsize: str | float | None = ...,
  31. inline: bool = ...,
  32. inline_spacing: float = ...,
  33. fmt: str | Formatter | Callable[[float], str] | dict[float, str] | None = ...,
  34. colors: ColorType | Sequence[ColorType] | None = ...,
  35. use_clabeltext: bool = ...,
  36. manual: bool | Iterable[tuple[float, float]] = ...,
  37. rightside_up: bool = ...,
  38. zorder: float | None = ...
  39. ) -> list[Text]: ...
  40. def print_label(self, linecontour: ArrayLike, labelwidth: float) -> bool: ...
  41. def too_close(self, x: float, y: float, lw: float) -> bool: ...
  42. def get_text(
  43. self,
  44. lev: float,
  45. fmt: str | Formatter | Callable[[float], str] | dict[float, str],
  46. ) -> str: ...
  47. def locate_label(
  48. self, linecontour: ArrayLike, labelwidth: float
  49. ) -> tuple[float, float, float]: ...
  50. def add_label(
  51. self, x: float, y: float, rotation: float, lev: float, cvalue: ColorType
  52. ) -> None: ...
  53. def add_label_near(
  54. self,
  55. x: float,
  56. y: float,
  57. inline: bool = ...,
  58. inline_spacing: int = ...,
  59. transform: Transform | Literal[False] | None = ...,
  60. ) -> None: ...
  61. def pop_label(self, index: int = ...) -> None: ...
  62. def labels(self, inline: bool, inline_spacing: int) -> None: ...
  63. def remove(self) -> None: ...
  64. class ContourSet(ContourLabeler, Collection):
  65. axes: Axes
  66. levels: Iterable[float]
  67. filled: bool
  68. linewidths: float | ArrayLike | None
  69. hatches: Iterable[str | None]
  70. origin: Literal["upper", "lower", "image"] | None
  71. extent: tuple[float, float, float, float] | None
  72. colors: ColorType | Sequence[ColorType]
  73. extend: Literal["neither", "both", "min", "max"]
  74. nchunk: int
  75. locator: Locator | None
  76. logscale: bool
  77. negative_linestyles: None | Literal[
  78. "solid", "dashed", "dashdot", "dotted"
  79. ] | Iterable[Literal["solid", "dashed", "dashdot", "dotted"]]
  80. clip_path: Patch | Path | TransformedPath | TransformedPatchPath | None
  81. labelTexts: list[Text]
  82. labelCValues: list[ColorType]
  83. @property
  84. def allkinds(self) -> list[list[np.ndarray | None]]: ...
  85. @property
  86. def allsegs(self) -> list[list[np.ndarray]]: ...
  87. @property
  88. def alpha(self) -> float | None: ...
  89. @property
  90. def linestyles(self) -> (
  91. None |
  92. Literal["solid", "dashed", "dashdot", "dotted"] |
  93. Iterable[Literal["solid", "dashed", "dashdot", "dotted"]]
  94. ): ...
  95. def __init__(
  96. self,
  97. ax: Axes,
  98. *args,
  99. levels: Iterable[float] | None = ...,
  100. filled: bool = ...,
  101. linewidths: float | ArrayLike | None = ...,
  102. linestyles: Literal["solid", "dashed", "dashdot", "dotted"]
  103. | Iterable[Literal["solid", "dashed", "dashdot", "dotted"]]
  104. | None = ...,
  105. hatches: Iterable[str | None] = ...,
  106. alpha: float | None = ...,
  107. origin: Literal["upper", "lower", "image"] | None = ...,
  108. extent: tuple[float, float, float, float] | None = ...,
  109. cmap: str | Colormap | None = ...,
  110. colors: ColorType | Sequence[ColorType] | None = ...,
  111. norm: str | Normalize | None = ...,
  112. vmin: float | None = ...,
  113. vmax: float | None = ...,
  114. colorizer: Colorizer | None = ...,
  115. extend: Literal["neither", "both", "min", "max"] = ...,
  116. antialiased: bool | None = ...,
  117. nchunk: int = ...,
  118. locator: Locator | None = ...,
  119. transform: Transform | None = ...,
  120. negative_linestyles: Literal["solid", "dashed", "dashdot", "dotted"]
  121. | Iterable[Literal["solid", "dashed", "dashdot", "dotted"]]
  122. | None = ...,
  123. clip_path: Patch | Path | TransformedPath | TransformedPatchPath | None = ...,
  124. **kwargs
  125. ) -> None: ...
  126. def legend_elements(
  127. self, variable_name: str = ..., str_format: Callable[[float], str] = ...
  128. ) -> tuple[list[Artist], list[str]]: ...
  129. def find_nearest_contour(
  130. self, x: float, y: float, indices: Iterable[int] | None = ..., pixel: bool = ...
  131. ) -> tuple[int, int, int, float, float, float]: ...
  132. class QuadContourSet(ContourSet): ...