Skip to content

Commit 2817e2e

Browse files
Figure.legend: Fix incorrect docstrings (#4753)
Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
1 parent 9b65558 commit 2817e2e

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

examples/tutorials/advanced/legends.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@
2121
# :meth:`pygmt.Figure.vlines` as well as :meth:`pygmt.Figure.histogram`. Therefore the
2222
# ``label`` parameter has to be specified to state the desired text for the legend entry
2323
# (white spaces are supported). Here, we use :meth:`pygmt.Figure.plot`, exemplary. By
24-
# default, the legend is placed in the Upper Right corner with an offset of 0.1
25-
# centimeters in both x- and y-directions, and surrounded by a box with a white fill and
26-
# a 1-point thick, black, solid outline. The order of the legend entries (top to bottom)
27-
# is determine by the plotting order. Optionally, to adjust the legend, append different
28-
# modifiers to the string passed to ``label``. For a list of available modifiers see
29-
# :gmt-docs:`gmt.html#l-full`. To create a :doc:`multiple-column legend
24+
# default, the legend is placed in the Upper Right corner and surrounded by a box with a
25+
# white fill and a 1-point thick, black, solid outline. The order of the legend entries
26+
# (top to bottom) is determined by the plotting order. Optionally, to adjust the legend,
27+
# append different modifiers to the string passed to ``label``. For a list of available
28+
# modifiers see :gmt-docs:`gmt.html#l-full`. To create a :doc:`multiple-column legend
3029
# </gallery/embellishments/legend>` **+N** is used with the desired number of columns.
3130

3231
fig = pygmt.Figure()

pygmt/src/legend.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,11 @@ def legend(
9393
width. If height is given as percentage then height is recomputed as that
9494
fraction of the legend width (not plot height).
9595
96-
**Note:** Currently, the automatic height calculation only works when legend
96+
**Note:** Currently, the automatic width calculation only works when legend
9797
codes **D**, **H**, **L**, **S**, or **V** are used and that the number of
98-
symbol columns (**N**) is 1.
98+
symbol columns (**N**) is 1. If height is zero or not given, GMT estimates it
99+
based on the expected vertical extent of the items to be placed. A legend
100+
containing paragraph text may require an explicit height.
99101
line_spacing
100102
The line-spacing factor between legend entries in units of the current font size
101103
[Default is 1.1].

0 commit comments

Comments
 (0)