spines.pyi 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. from collections.abc import Callable, Iterator, MutableMapping
  2. from typing import Any, Literal, TypeVar, overload
  3. import matplotlib.patches as mpatches
  4. from matplotlib.axes import Axes
  5. from matplotlib.axis import Axis
  6. from matplotlib.path import Path
  7. from matplotlib.transforms import Transform
  8. from matplotlib.typing import ColorType
  9. class Spine(mpatches.Patch):
  10. axes: Axes
  11. spine_type: str
  12. axis: Axis | None
  13. def __init__(self, axes: Axes, spine_type: str, path: Path, **kwargs) -> None: ...
  14. def set_patch_arc(
  15. self, center: tuple[float, float], radius: float, theta1: float, theta2: float
  16. ) -> None: ...
  17. def set_patch_circle(self, center: tuple[float, float], radius: float) -> None: ...
  18. def set_patch_line(self) -> None: ...
  19. def get_patch_transform(self) -> Transform: ...
  20. def get_path(self) -> Path: ...
  21. def register_axis(self, axis: Axis) -> None: ...
  22. def clear(self) -> None: ...
  23. def set_position(
  24. self,
  25. position: Literal["center", "zero"]
  26. | tuple[Literal["outward", "axes", "data"], float],
  27. ) -> None: ...
  28. def get_position(
  29. self,
  30. ) -> Literal["center", "zero"] | tuple[
  31. Literal["outward", "axes", "data"], float
  32. ]: ...
  33. def get_spine_transform(self) -> Transform: ...
  34. def set_bounds(self, low: float | None = ..., high: float | None = ...) -> None: ...
  35. def get_bounds(self) -> tuple[float, float]: ...
  36. _T = TypeVar("_T", bound=Spine)
  37. @classmethod
  38. def linear_spine(
  39. cls: type[_T],
  40. axes: Axes,
  41. spine_type: Literal["left", "right", "bottom", "top"],
  42. **kwargs
  43. ) -> _T: ...
  44. @classmethod
  45. def arc_spine(
  46. cls: type[_T],
  47. axes: Axes,
  48. spine_type: Literal["left", "right", "bottom", "top"],
  49. center: tuple[float, float],
  50. radius: float,
  51. theta1: float,
  52. theta2: float,
  53. **kwargs
  54. ) -> _T: ...
  55. @classmethod
  56. def circular_spine(
  57. cls: type[_T], axes: Axes, center: tuple[float, float], radius: float, **kwargs
  58. ) -> _T: ...
  59. def set_color(self, c: ColorType | None) -> None: ...
  60. class SpinesProxy:
  61. def __init__(self, spine_dict: dict[str, Spine]) -> None: ...
  62. def __getattr__(self, name: str) -> Callable[..., None]: ...
  63. def __dir__(self) -> list[str]: ...
  64. class Spines(MutableMapping[str, Spine]):
  65. def __init__(self, **kwargs: Spine) -> None: ...
  66. @classmethod
  67. def from_dict(cls, d: dict[str, Spine]) -> Spines: ...
  68. def __getattr__(self, name: str) -> Spine: ...
  69. @overload
  70. def __getitem__(self, key: str) -> Spine: ...
  71. @overload
  72. def __getitem__(self, key: list[str]) -> SpinesProxy: ...
  73. @overload
  74. def __getitem__(self, key: slice) -> SpinesProxy: ...
  75. def __setitem__(self, key: str, value: Spine) -> None: ...
  76. def __delitem__(self, key: str) -> None: ...
  77. def __iter__(self) -> Iterator[str]: ...
  78. def __len__(self) -> int: ...