-
Notifications
You must be signed in to change notification settings - Fork 235
Improve the display for class attributes of params #4144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
13d48ed
8851885
fe7f662
4d0f4f5
f6de91f
6c537e9
aca5631
58125e8
3109877
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,33 +18,6 @@ class Box(BaseParam): | |
| """ | ||
| Class for specifying the box around GMT embellishments. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| clearance | ||
| Set clearances between the embellishment and the box border. It can be either a | ||
| scalar value or a sequence of two/four values. | ||
|
|
||
| - a scalar value means a uniform clearance in all four directions. | ||
| - a sequence of two values means separate clearances in x- and y-directions. | ||
| - a sequence of four values means separate clearances for left/right/bottom/top. | ||
| fill | ||
| Fill for the box [Default is no fill]. | ||
| inner_gap | ||
| Gap between the outer and inner borders [Default is ``"2p"``]. | ||
| inner_pen | ||
| Pen attributes for the inner border [Default to :gmt-term:`MAP_DEFAULT_PEN`]. | ||
| pen | ||
| Pen attributes for the box outline. | ||
| radius | ||
| Draw a rounded rectangular border instead of sharp. Passing a value with unit | ||
| to control the corner radius [Default is ``"6p"``]. | ||
| shade_offset | ||
| Place an offset background shaded region behind the box. A sequence of two | ||
| values (dx, dy) indicates the shift relative to the foreground frame [Default is | ||
| ``("4p", "-4p")``]. | ||
| shade_fill | ||
| Fill for the shaded region [Default is ``"gray50"``]. | ||
|
|
||
| Examples | ||
| -------- | ||
| >>> import pygmt | ||
|
|
@@ -54,13 +27,32 @@ class Box(BaseParam): | |
| >>> fig.show() | ||
| """ | ||
|
|
||
| #: Set clearances between the embellishment and the box border. It can be either a | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems we should use the xref: https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#doc-comments-and-docstrings
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is pretty cool, it also means we can get a permalink to the attributes like https://pygmt-dev--4144.org.readthedocs.build/en/4144/api/generated/pygmt.params.Box.html#pygmt.params.Box.clearance! |
||
| #: scalar value or a sequence of two/four values. | ||
| #: | ||
| #: - a scalar value means a uniform clearance in all four directions. | ||
| #: - a sequence of two values means separate clearances in x- and y-directions. | ||
| #: - a sequence of four values means separate clearances for left/right/bottom/top. | ||
| clearance: float | str | Sequence[float | str] | None = None | ||
|
|
||
| #: Fill for the box [Default is no fill]. | ||
| fill: str | None = None | ||
|
|
||
| #: Gap between the outer and inner borders [Default is ``"2p"``]. | ||
| inner_gap: float | str | None = None | ||
|
|
||
| #: Pen attributes for the inner border [Default to :gmt-term:`MAP_DEFAULT_PEN`]. | ||
| inner_pen: str | None = None | ||
| #: Pen attributes for the box outline. | ||
| pen: str | None = None | ||
| #: Draw a rounded rectangular border instead of sharp. Passing a value with unit to | ||
| #: control the corner radius [Default is ``"6p"``]. | ||
| radius: str | bool = False | ||
| #: Place an offset background shaded region behind the box. A sequence of two values | ||
| #: (dx, dy) indicates the shift relative to the foreground frame [Default is | ||
| #: ``("4p", "-4p")``]. | ||
| shade_offset: Sequence[float | str] | None = None | ||
| #: Fill for the shaded region [Default is ``"gray50"``]. | ||
| shade_fill: str | None = None | ||
|
|
||
| def _validate(self): | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be
autoattribute, notautopropertyThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was able to get the attributes sorted alphabetically using https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#directive-option-autoclass-member-order by adding these lines at L7-8:
Results in something like the below. Note how
shade_offsetcomes beforeshade_fillHowever, using
:members:here meansFigureand other classes are also affected, so not ideal. Might need to create a custom template separately for these class-based params?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 3109877.