contour.pyi 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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.colors import Colormap, Normalize
  6. from matplotlib.font_manager import FontProperties
  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 ClabelText(Text): ...
  18. class ContourLabeler:
  19. labelFmt: str | Formatter | Callable[[float], str] | dict[float, str]
  20. labelManual: bool | Iterable[tuple[float, float]]
  21. rightside_up: bool
  22. labelLevelList: list[float]
  23. labelIndiceList: list[int]
  24. labelMappable: cm.ScalarMappable
  25. labelCValueList: list[ColorType]
  26. labelXYs: list[tuple[float, float]]
  27. def clabel(
  28. self,
  29. levels: ArrayLike | None = ...,
  30. *,
  31. fontsize: str | float | None = ...,
  32. inline: bool = ...,
  33. inline_spacing: float = ...,
  34. fmt: str | Formatter | Callable[[float], str] | dict[float, str] | None = ...,
  35. colors: ColorType | Sequence[ColorType] | None = ...,
  36. use_clabeltext: bool = ...,
  37. manual: bool | Iterable[tuple[float, float]] = ...,
  38. rightside_up: bool = ...,
  39. zorder: float | None = ...
  40. ) -> list[Text]: ...
  41. @property
  42. def labelFontProps(self) -> FontProperties: ...
  43. @property
  44. def labelFontSizeList(self) -> list[float]: ...
  45. @property
  46. def labelTextsList(self) -> list[Text]: ...
  47. def print_label(self, linecontour: ArrayLike, labelwidth: float) -> bool: ...
  48. def too_close(self, x: float, y: float, lw: float) -> bool: ...
  49. def set_label_props(self, label: Text, text: str, color: ColorType) -> None: ...
  50. def get_text(
  51. self,
  52. lev: float,
  53. fmt: str | Formatter | Callable[[float], str] | dict[float, str],
  54. ) -> str: ...
  55. def locate_label(
  56. self, linecontour: ArrayLike, labelwidth: float
  57. ) -> tuple[float, float, float]: ...
  58. def calc_label_rot_and_inline(
  59. self,
  60. slc: ArrayLike,
  61. ind: int,
  62. lw: float,
  63. lc: ArrayLike | None = ...,
  64. spacing: int = ...,
  65. ) -> tuple[float, list[ArrayLike]]: ...
  66. def add_label(
  67. self, x: float, y: float, rotation: float, lev: float, cvalue: ColorType
  68. ) -> None: ...
  69. def add_label_clabeltext(
  70. self, x: float, y: float, rotation: float, lev: float, cvalue: ColorType
  71. ) -> None: ...
  72. def add_label_near(
  73. self,
  74. x: float,
  75. y: float,
  76. inline: bool = ...,
  77. inline_spacing: int = ...,
  78. transform: Transform | Literal[False] | None = ...,
  79. ) -> None: ...
  80. def pop_label(self, index: int = ...) -> None: ...
  81. def labels(self, inline: bool, inline_spacing: int) -> None: ...
  82. def remove(self) -> None: ...
  83. class ContourSet(ContourLabeler, Collection):
  84. axes: Axes
  85. levels: Iterable[float]
  86. filled: bool
  87. linewidths: float | ArrayLike | None
  88. hatches: Iterable[str | None]
  89. origin: Literal["upper", "lower", "image"] | None
  90. extent: tuple[float, float, float, float] | None
  91. colors: ColorType | Sequence[ColorType]
  92. extend: Literal["neither", "both", "min", "max"]
  93. nchunk: int
  94. locator: Locator | None
  95. logscale: bool
  96. negative_linestyles: None | Literal[
  97. "solid", "dashed", "dashdot", "dotted"
  98. ] | Iterable[Literal["solid", "dashed", "dashdot", "dotted"]]
  99. clip_path: Patch | Path | TransformedPath | TransformedPatchPath | None
  100. labelTexts: list[Text]
  101. labelCValues: list[ColorType]
  102. @property
  103. def tcolors(self) -> list[tuple[tuple[float, float, float, float]]]: ...
  104. # only for not filled
  105. @property
  106. def tlinewidths(self) -> list[tuple[float]]: ...
  107. @property
  108. def allkinds(self) -> list[list[np.ndarray | None]]: ...
  109. @property
  110. def allsegs(self) -> list[list[np.ndarray]]: ...
  111. @property
  112. def alpha(self) -> float | None: ...
  113. @property
  114. def antialiased(self) -> bool: ...
  115. @antialiased.setter
  116. def antialiased(self, aa: bool | Sequence[bool]) -> None: ...
  117. @property
  118. def collections(self) -> list[PathCollection]: ...
  119. @property
  120. def linestyles(self) -> (
  121. None |
  122. Literal["solid", "dashed", "dashdot", "dotted"] |
  123. Iterable[Literal["solid", "dashed", "dashdot", "dotted"]]
  124. ): ...
  125. def __init__(
  126. self,
  127. ax: Axes,
  128. *args,
  129. levels: Iterable[float] | None = ...,
  130. filled: bool = ...,
  131. linewidths: float | ArrayLike | None = ...,
  132. linestyles: Literal["solid", "dashed", "dashdot", "dotted"]
  133. | Iterable[Literal["solid", "dashed", "dashdot", "dotted"]]
  134. | None = ...,
  135. hatches: Iterable[str | None] = ...,
  136. alpha: float | None = ...,
  137. origin: Literal["upper", "lower", "image"] | None = ...,
  138. extent: tuple[float, float, float, float] | None = ...,
  139. cmap: str | Colormap | None = ...,
  140. colors: ColorType | Sequence[ColorType] | None = ...,
  141. norm: str | Normalize | None = ...,
  142. vmin: float | None = ...,
  143. vmax: float | None = ...,
  144. extend: Literal["neither", "both", "min", "max"] = ...,
  145. antialiased: bool | None = ...,
  146. nchunk: int = ...,
  147. locator: Locator | None = ...,
  148. transform: Transform | None = ...,
  149. negative_linestyles: Literal["solid", "dashed", "dashdot", "dotted"]
  150. | Iterable[Literal["solid", "dashed", "dashdot", "dotted"]]
  151. | None = ...,
  152. clip_path: Patch | Path | TransformedPath | TransformedPatchPath | None = ...,
  153. **kwargs
  154. ) -> None: ...
  155. def legend_elements(
  156. self, variable_name: str = ..., str_format: Callable[[float], str] = ...
  157. ) -> tuple[list[Artist], list[str]]: ...
  158. def find_nearest_contour(
  159. self, x: float, y: float, indices: Iterable[int] | None = ..., pixel: bool = ...
  160. ) -> tuple[int, int, int, float, float, float]: ...
  161. class QuadContourSet(ContourSet): ...