ticker.pyi 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. from collections.abc import Callable, Sequence
  2. from typing import Any, Literal
  3. from matplotlib.axis import Axis
  4. from matplotlib.transforms import Transform
  5. from matplotlib.projections.polar import _AxisWrapper
  6. import numpy as np
  7. class _DummyAxis:
  8. __name__: str
  9. def __init__(self, minpos: float = ...) -> None: ...
  10. def get_view_interval(self) -> tuple[float, float]: ...
  11. def set_view_interval(self, vmin: float, vmax: float) -> None: ...
  12. def get_minpos(self) -> float: ...
  13. def get_data_interval(self) -> tuple[float, float]: ...
  14. def set_data_interval(self, vmin: float, vmax: float) -> None: ...
  15. def get_tick_space(self) -> int: ...
  16. class TickHelper:
  17. axis: None | Axis | _DummyAxis | _AxisWrapper
  18. def set_axis(self, axis: Axis | _DummyAxis | _AxisWrapper | None) -> None: ...
  19. def create_dummy_axis(self, **kwargs) -> None: ...
  20. class Formatter(TickHelper):
  21. locs: list[float]
  22. def __call__(self, x: float, pos: int | None = ...) -> str: ...
  23. def format_ticks(self, values: list[float]) -> list[str]: ...
  24. def format_data(self, value: float) -> str: ...
  25. def format_data_short(self, value: float) -> str: ...
  26. def get_offset(self) -> str: ...
  27. def set_locs(self, locs: list[float]) -> None: ...
  28. @staticmethod
  29. def fix_minus(s: str) -> str: ...
  30. class NullFormatter(Formatter): ...
  31. class FixedFormatter(Formatter):
  32. seq: Sequence[str]
  33. offset_string: str
  34. def __init__(self, seq: Sequence[str]) -> None: ...
  35. def set_offset_string(self, ofs: str) -> None: ...
  36. class FuncFormatter(Formatter):
  37. func: Callable[[float, int | None], str]
  38. offset_string: str
  39. # Callable[[float, int | None], str] | Callable[[float], str]
  40. def __init__(self, func: Callable[..., str]) -> None: ...
  41. def set_offset_string(self, ofs: str) -> None: ...
  42. class FormatStrFormatter(Formatter):
  43. fmt: str
  44. def __init__(self, fmt: str) -> None: ...
  45. class StrMethodFormatter(Formatter):
  46. fmt: str
  47. def __init__(self, fmt: str) -> None: ...
  48. class ScalarFormatter(Formatter):
  49. orderOfMagnitude: int
  50. format: str
  51. def __init__(
  52. self,
  53. useOffset: bool | float | None = ...,
  54. useMathText: bool | None = ...,
  55. useLocale: bool | None = ...,
  56. ) -> None: ...
  57. offset: float
  58. def get_useOffset(self) -> bool: ...
  59. def set_useOffset(self, val: bool | float) -> None: ...
  60. @property
  61. def useOffset(self) -> bool: ...
  62. @useOffset.setter
  63. def useOffset(self, val: bool | float) -> None: ...
  64. def get_useLocale(self) -> bool: ...
  65. def set_useLocale(self, val: bool | None) -> None: ...
  66. @property
  67. def useLocale(self) -> bool: ...
  68. @useLocale.setter
  69. def useLocale(self, val: bool | None) -> None: ...
  70. def get_useMathText(self) -> bool: ...
  71. def set_useMathText(self, val: bool | None) -> None: ...
  72. @property
  73. def useMathText(self) -> bool: ...
  74. @useMathText.setter
  75. def useMathText(self, val: bool | None) -> None: ...
  76. def set_scientific(self, b: bool) -> None: ...
  77. def set_powerlimits(self, lims: tuple[int, int]) -> None: ...
  78. def format_data_short(self, value: float | np.ma.MaskedArray) -> str: ...
  79. def format_data(self, value: float) -> str: ...
  80. class LogFormatter(Formatter):
  81. minor_thresholds: tuple[float, float]
  82. def __init__(
  83. self,
  84. base: float = ...,
  85. labelOnlyBase: bool = ...,
  86. minor_thresholds: tuple[float, float] | None = ...,
  87. linthresh: float | None = ...,
  88. ) -> None: ...
  89. def set_base(self, base: float) -> None: ...
  90. labelOnlyBase: bool
  91. def set_label_minor(self, labelOnlyBase: bool) -> None: ...
  92. def set_locs(self, locs: Any | None = ...) -> None: ...
  93. def format_data(self, value: float) -> str: ...
  94. def format_data_short(self, value: float) -> str: ...
  95. class LogFormatterExponent(LogFormatter): ...
  96. class LogFormatterMathtext(LogFormatter): ...
  97. class LogFormatterSciNotation(LogFormatterMathtext): ...
  98. class LogitFormatter(Formatter):
  99. def __init__(
  100. self,
  101. *,
  102. use_overline: bool = ...,
  103. one_half: str = ...,
  104. minor: bool = ...,
  105. minor_threshold: int = ...,
  106. minor_number: int = ...
  107. ) -> None: ...
  108. def use_overline(self, use_overline: bool) -> None: ...
  109. def set_one_half(self, one_half: str) -> None: ...
  110. def set_minor_threshold(self, minor_threshold: int) -> None: ...
  111. def set_minor_number(self, minor_number: int) -> None: ...
  112. def format_data_short(self, value: float) -> str: ...
  113. class EngFormatter(Formatter):
  114. ENG_PREFIXES: dict[int, str]
  115. unit: str
  116. places: int | None
  117. sep: str
  118. def __init__(
  119. self,
  120. unit: str = ...,
  121. places: int | None = ...,
  122. sep: str = ...,
  123. *,
  124. usetex: bool | None = ...,
  125. useMathText: bool | None = ...
  126. ) -> None: ...
  127. def get_usetex(self) -> bool: ...
  128. def set_usetex(self, val: bool | None) -> None: ...
  129. @property
  130. def usetex(self) -> bool: ...
  131. @usetex.setter
  132. def usetex(self, val: bool | None) -> None: ...
  133. def get_useMathText(self) -> bool: ...
  134. def set_useMathText(self, val: bool | None) -> None: ...
  135. @property
  136. def useMathText(self) -> bool: ...
  137. @useMathText.setter
  138. def useMathText(self, val: bool | None) -> None: ...
  139. def format_eng(self, num: float) -> str: ...
  140. class PercentFormatter(Formatter):
  141. xmax: float
  142. decimals: int | None
  143. def __init__(
  144. self,
  145. xmax: float = ...,
  146. decimals: int | None = ...,
  147. symbol: str | None = ...,
  148. is_latex: bool = ...,
  149. ) -> None: ...
  150. def format_pct(self, x: float, display_range: float) -> str: ...
  151. def convert_to_pct(self, x: float) -> float: ...
  152. @property
  153. def symbol(self) -> str: ...
  154. @symbol.setter
  155. def symbol(self, symbol: str) -> None: ...
  156. class Locator(TickHelper):
  157. MAXTICKS: int
  158. def tick_values(self, vmin: float, vmax: float) -> Sequence[float]: ...
  159. # Implementation accepts **kwargs, but is a no-op other than a warning
  160. # Typing as **kwargs would require each subclass to accept **kwargs for mypy
  161. def set_params(self) -> None: ...
  162. def __call__(self) -> Sequence[float]: ...
  163. def raise_if_exceeds(self, locs: Sequence[float]) -> Sequence[float]: ...
  164. def nonsingular(self, v0: float, v1: float) -> tuple[float, float]: ...
  165. def view_limits(self, vmin: float, vmax: float) -> tuple[float, float]: ...
  166. class IndexLocator(Locator):
  167. offset: float
  168. def __init__(self, base: float, offset: float) -> None: ...
  169. def set_params(
  170. self, base: float | None = ..., offset: float | None = ...
  171. ) -> None: ...
  172. class FixedLocator(Locator):
  173. nbins: int | None
  174. def __init__(self, locs: Sequence[float], nbins: int | None = ...) -> None: ...
  175. def set_params(self, nbins: int | None = ...) -> None: ...
  176. class NullLocator(Locator): ...
  177. class LinearLocator(Locator):
  178. presets: dict[tuple[float, float], Sequence[float]]
  179. def __init__(
  180. self,
  181. numticks: int | None = ...,
  182. presets: dict[tuple[float, float], Sequence[float]] | None = ...,
  183. ) -> None: ...
  184. @property
  185. def numticks(self) -> int: ...
  186. @numticks.setter
  187. def numticks(self, numticks: int | None) -> None: ...
  188. def set_params(
  189. self,
  190. numticks: int | None = ...,
  191. presets: dict[tuple[float, float], Sequence[float]] | None = ...,
  192. ) -> None: ...
  193. class MultipleLocator(Locator):
  194. def __init__(self, base: float = ..., offset: float = ...) -> None: ...
  195. def set_params(self, base: float | None = ..., offset: float | None = ...) -> None: ...
  196. def view_limits(self, dmin: float, dmax: float) -> tuple[float, float]: ...
  197. class _Edge_integer:
  198. step: float
  199. def __init__(self, step: float, offset: float) -> None: ...
  200. def closeto(self, ms: float, edge: float) -> bool: ...
  201. def le(self, x: float) -> float: ...
  202. def ge(self, x: float) -> float: ...
  203. class MaxNLocator(Locator):
  204. default_params: dict[str, Any]
  205. def __init__(self, nbins: int | Literal["auto"] | None = ..., **kwargs) -> None: ...
  206. def set_params(self, **kwargs) -> None: ...
  207. def view_limits(self, dmin: float, dmax: float) -> tuple[float, float]: ...
  208. class LogLocator(Locator):
  209. numdecs: float
  210. numticks: int | None
  211. def __init__(
  212. self,
  213. base: float = ...,
  214. subs: None | Literal["auto", "all"] | Sequence[float] = ...,
  215. numdecs: float = ...,
  216. numticks: int | None = ...,
  217. ) -> None: ...
  218. def set_params(
  219. self,
  220. base: float | None = ...,
  221. subs: Literal["auto", "all"] | Sequence[float] | None = ...,
  222. numdecs: float | None = ...,
  223. numticks: int | None = ...,
  224. ) -> None: ...
  225. class SymmetricalLogLocator(Locator):
  226. numticks: int
  227. def __init__(
  228. self,
  229. transform: Transform | None = ...,
  230. subs: Sequence[float] | None = ...,
  231. linthresh: float | None = ...,
  232. base: float | None = ...,
  233. ) -> None: ...
  234. def set_params(
  235. self, subs: Sequence[float] | None = ..., numticks: int | None = ...
  236. ) -> None: ...
  237. class AsinhLocator(Locator):
  238. linear_width: float
  239. numticks: int
  240. symthresh: float
  241. base: int
  242. subs: Sequence[float] | None
  243. def __init__(
  244. self,
  245. linear_width: float,
  246. numticks: int = ...,
  247. symthresh: float = ...,
  248. base: int = ...,
  249. subs: Sequence[float] | None = ...,
  250. ) -> None: ...
  251. def set_params(
  252. self,
  253. numticks: int | None = ...,
  254. symthresh: float | None = ...,
  255. base: int | None = ...,
  256. subs: Sequence[float] | None = ...,
  257. ) -> None: ...
  258. class LogitLocator(MaxNLocator):
  259. def __init__(
  260. self, minor: bool = ..., *, nbins: Literal["auto"] | int = ...
  261. ) -> None: ...
  262. def set_params(self, minor: bool | None = ..., **kwargs) -> None: ...
  263. @property
  264. def minor(self) -> bool: ...
  265. @minor.setter
  266. def minor(self, value: bool) -> None: ...
  267. class AutoLocator(MaxNLocator):
  268. def __init__(self) -> None: ...
  269. class AutoMinorLocator(Locator):
  270. ndivs: int
  271. def __init__(self, n: int | None = ...) -> None: ...