Add comments to code positioning Matplotlib subplots

pull/464/head
nyanpasu64 2024-02-03 23:09:20 -08:00
rodzic aa34f3af5b
commit 3098261df0
1 zmienionych plików z 4 dodań i 1 usunięć

Wyświetl plik

@ -626,12 +626,15 @@ class AbstractMatplotlibRenderer(_RendererBackend, ABC):
def _axes_factory(self, r: RegionSpec, label: str = "") -> "Axes":
cfg = self.cfg
# Calculate plot positions (relative to bottom-left) as fractions of the screen.
width = 1 / r.ncol
left = r.col / r.ncol
assert 0 <= left < 1
height = 1 / r.nrow
bottom = (r.nrow - r.row - 1) / r.nrow
# We index rows from top down, but matplotlib positions plots from bottom up.
# The final row (row = nrow-1) is located at the bottom of the graph, at y=0.
bottom = (r.nrow - (r.row + 1)) / r.nrow
assert 0 <= bottom < 1
# Disabling xticks/yticks is unnecessary, since we hide Axises.