Skip to content
Merged
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
15 changes: 15 additions & 0 deletions doc/sphinxext/custom_roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,23 @@ def rcparam_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
return node_list, messages


def mpltype_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
mpltype = text
type_to_link_target = {
'color': 'colors_def',
}
if mpltype not in type_to_link_target:
raise ValueError(f"Unknown mpltype: {mpltype!r}")

ref_nodes, messages = inliner.interpreted(
mpltype, f'{mpltype} <{type_to_link_target[mpltype]}>', 'ref', lineno)
node_list = [ref_nodes]
return node_list, messages


def setup(app):
app.add_role("rc", rcparam_role)
app.add_role("mpltype", mpltype_role)
app.add_node(
QueryReference,
html=(visit_query_reference_node, depart_query_reference_node),
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def __init__(self, ax, label, image=None,
image : array-like or PIL Image
The image to place in the button, if not *None*. The parameter is
directly forwarded to `~.axes.Axes.imshow`.
color : color
color : :mpltype:`color`
The color of the button when not activated.
hovercolor : color
The color of the button when the mouse is over it.
Expand Down