table.pyi 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. from .artist import Artist
  2. from .axes import Axes
  3. from .backend_bases import RendererBase
  4. from .patches import Rectangle
  5. from .path import Path
  6. from .text import Text
  7. from .transforms import Bbox
  8. from .typing import ColorType
  9. from collections.abc import Sequence
  10. from typing import Any, Literal, TYPE_CHECKING
  11. from pandas import DataFrame
  12. class Cell(Rectangle):
  13. PAD: float
  14. def __init__(
  15. self,
  16. xy: tuple[float, float],
  17. width: float,
  18. height: float,
  19. *,
  20. edgecolor: ColorType = ...,
  21. facecolor: ColorType = ...,
  22. fill: bool = ...,
  23. text: str = ...,
  24. loc: Literal["left", "center", "right"] = ...,
  25. fontproperties: dict[str, Any] | None = ...,
  26. visible_edges: str | None = ...
  27. ) -> None: ...
  28. def get_text(self) -> Text: ...
  29. def set_fontsize(self, size: float) -> None: ...
  30. def get_fontsize(self) -> float: ...
  31. def auto_set_font_size(self, renderer: RendererBase) -> float: ...
  32. def get_text_bounds(
  33. self, renderer: RendererBase
  34. ) -> tuple[float, float, float, float]: ...
  35. def get_required_width(self, renderer: RendererBase) -> float: ...
  36. def set_text_props(self, **kwargs) -> None: ...
  37. @property
  38. def visible_edges(self) -> str: ...
  39. @visible_edges.setter
  40. def visible_edges(self, value: str | None) -> None: ...
  41. def get_path(self) -> Path: ...
  42. CustomCell = Cell
  43. class Table(Artist):
  44. codes: dict[str, int]
  45. FONTSIZE: float
  46. AXESPAD: float
  47. def __init__(
  48. self, ax: Axes, loc: str | None = ..., bbox: Bbox | None = ..., **kwargs
  49. ) -> None: ...
  50. def add_cell(self, row: int, col: int, *args, **kwargs) -> Cell: ...
  51. def __setitem__(self, position: tuple[int, int], cell: Cell) -> None: ...
  52. def __getitem__(self, position: tuple[int, int]) -> Cell: ...
  53. @property
  54. def edges(self) -> str | None: ...
  55. @edges.setter
  56. def edges(self, value: str | None) -> None: ...
  57. def draw(self, renderer) -> None: ...
  58. def get_children(self) -> list[Artist]: ...
  59. def get_window_extent(self, renderer: RendererBase | None = ...) -> Bbox: ...
  60. def auto_set_column_width(self, col: int | Sequence[int]) -> None: ...
  61. def auto_set_font_size(self, value: bool = ...) -> None: ...
  62. def scale(self, xscale: float, yscale: float) -> None: ...
  63. def set_fontsize(self, size: float) -> None: ...
  64. def get_celld(self) -> dict[tuple[int, int], Cell]: ...
  65. def table(
  66. ax: Axes,
  67. cellText: Sequence[Sequence[str]] | DataFrame | None = ...,
  68. cellColours: Sequence[Sequence[ColorType]] | None = ...,
  69. cellLoc: Literal["left", "center", "right"] = ...,
  70. colWidths: Sequence[float] | None = ...,
  71. rowLabels: Sequence[str] | None = ...,
  72. rowColours: Sequence[ColorType] | None = ...,
  73. rowLoc: Literal["left", "center", "right"] = ...,
  74. colLabels: Sequence[str] | None = ...,
  75. colColours: Sequence[ColorType] | None = ...,
  76. colLoc: Literal["left", "center", "right"] = ...,
  77. loc: str = ...,
  78. bbox: Bbox | None = ...,
  79. edges: str = ...,
  80. **kwargs
  81. ) -> Table: ...