Skip to content

Commit 9260bc8

Browse files
committed
Refactor figure.py: streamline attribute documentation and enhance parameter descriptions for subplot specification
1 parent 2875285 commit 9260bc8

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

anyplotlib/figure.py

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,6 @@ class Figure(anywidget.AnyWidget):
6161
Link pan/zoom across all panels on the respective axis.
6262
Default False (independent pan/zoom per panel).
6363
64-
Attributes
65-
----------
66-
fig_width : int
67-
Current figure width in pixels (synced with JS).
68-
fig_height : int
69-
Current figure height in pixels (synced with JS).
70-
layout_json : str
71-
JSON serialization of the grid layout (synced with JS).
72-
event_json : str
73-
JSON serialization of interaction events from JS.
7464
7565
See Also
7666
--------
@@ -80,8 +70,7 @@ class Figure(anywidget.AnyWidget):
8070
layout_json = traitlets.Unicode("{}").tag(sync=True)
8171
fig_width = traitlets.Int(640).tag(sync=True)
8272
fig_height = traitlets.Int(480).tag(sync=True)
83-
# Bidirectional js. Events have an object id and some
84-
# data that
73+
# Bidirectional JS event bus: JS writes interaction events here, Python reads them.
8574
event_json = traitlets.Unicode("{}").tag(sync=True)
8675
_esm = _ESM_SOURCE
8776

@@ -108,12 +97,12 @@ def add_subplot(self, spec) -> Axes:
10897
10998
Parameters
11099
----------
111-
spec : SubplotSpec or int or (row, col) tuple
112-
Specifies which grid cell(s) to occupy:
113-
- ``SubplotSpec``: used directly (e.g. from ``GridSpec[r, c]``).
114-
- ``int``: converted to ``(row, col)`` via ``divmod(spec, ncols)``,
115-
matching ``matplotlib.Figure.add_subplot(num)`` numbering.
116-
- ``(row, col)`` tuple: selects a single cell.
100+
spec : SubplotSpec or int or tuple of (row, col)
101+
Which grid cell(s) to occupy. A :class:`SubplotSpec` is used
102+
directly (e.g. from ``GridSpec[r, c]``). An :class:`int` is
103+
converted via ``divmod(spec, ncols)``, matching
104+
``matplotlib.Figure.add_subplot`` numbering. A ``(row, col)``
105+
tuple selects a single cell.
117106
118107
Returns
119108
-------

0 commit comments

Comments
 (0)