8000 Merge pull request #17808 from timhoffm/doc-colorbar-set-label · matplotlib/matplotlib@0c35ebf · GitHub
[go: up one dir, main page]

Skip to content

Commit 0c35ebf

Browse files
authored
Merge pull request #17808 from timhoffm/doc-colorbar-set-label
DOC: Improve docstring of ColorbarBase.set_label()
2 parents 26ed5ee + a65125e commit 0c35ebf

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

lib/matplotlib/colorbar.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,26 @@ def _set_label(self):
737737
self.stale = True
738738

739739
def set_label(self, label, *, loc=None, **kwargs):
740-
"""Add a label to the long axis of the colorbar."""
740+
"""
741+
Add a label to the long axis of the colorbar.
742+
743+
Parameters
744+
----------
745+
label : str
746+
The label text.
747+
loc : str, optional
748+
The location of the label.
749+
750+
- For horizontal orientation one of {'left', 'center', 'right'}
751+
- For vertical orientation one of {'bottom', 'center', 'top'}
752+
753+
Defaults to :rc:`xaxis.labellocation` or :rc:`yaxis.labellocation`
754+
depending on the orientation.
755+
**kwargs
756+
Keyword arguments are passed to `~.Axes.set_xlabel` /
757+
`~.Axes.set_ylabel`.
758+
Supported keywords are *labelpad* and `.Text` properties.
759+
"""
741760
_pos_xy = 'y' if self.orientation == 'vertical' else 'x'
742761
_protected_kw = [_pos_xy, 'horizontalalignment', 'ha']
743762
if any([k in kwargs for k in _protected_kw]):

0 commit comments

Comments
 (0)
0