X Tutup
Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ci/codespell-ignore-words.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
aas
ABD
aother
axises
coo
curvelinear
Expand Down
Empty file.
49 changes: 49 additions & 0 deletions lib/matplotlib/_data_containers/_helpers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
from .description import Desc, desc_like
from .conversion_edge import Graph, TransformEdge


def containerize_draw(draw_func):
def draw(self, renderer, *, graph=None):
if graph is None:
graph = Graph([])

implicit_graph = _get_graph(self.axes)
return draw_func(self, renderer, graph=graph+implicit_graph)

return draw


def _get_graph(ax):
if ax is None:
return Graph([])
desc: Desc = Desc(("N",), coordinates="data")

Check warning on line 19 in lib/matplotlib/_data_containers/_helpers.py

View workflow job for this annotation

GitHub Actions / mypy

[mypy] reported by reviewdog 🐶 By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked] Raw Output: lib/matplotlib/_data_containers/_helpers.py:19: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
xy: dict[str, Desc] = {"x": desc, "y": desc}

Check warning on line 20 in lib/matplotlib/_data_containers/_helpers.py

View workflow job for this annotation

GitHub Actions / mypy

[mypy] reported by reviewdog 🐶 By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked] Raw Output: lib/matplotlib/_data_containers/_helpers.py:20: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
implicit_graph = Graph(
[
TransformEdge(
"data",
xy,
desc_like(xy, coordinates="axes"),
transform=ax.transData - ax.transAxes,
),
TransformEdge(
"axes",
desc_like(xy, coordinates="axes"),
desc_like(xy, coordinates="display"),
transform=ax.transAxes,
),
TransformEdge(
"dpi",
desc_like(xy, coordinates="display_inches"),
desc_like(xy, coordinates="display"),
transform=ax.figure.dpi_scale_trans,
),
],
aliases=(("parent", "axes"),),
)
return implicit_graph


def check_container(artist, container_cls, operation="This operation"):
if not isinstance(artist._container, container_cls):
raise TypeError(f"{operation} is not available with a custom container class")
Loading
Loading
X Tutup