10000 Improve Axes text/annotate related docstrings. · matplotlib/matplotlib@40a86e5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 40a86e5

Browse files
committed
Improve Axes text/annotate related docstrings.
1 parent 2599236 commit 40a86e5

File tree

1 file changed

+29
-28
lines changed

1 file changed

+29
-28
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -561,16 +561,17 @@ def text(self, x, y, s, fontdict=None, withdash=False, **kwargs):
561561
"""
562562
Add text to the axes.
563563
564-
Add text in string `s` to axis at location `x`, `y`, data
565-
coordinates.
564+
Add the text *s* to the axes at location *x*, *y* in data coordinates.
566565
567566
Parameters
568567
----------
569568
x, y : scalars
570-
data coordinates
569+
The position to place the text. By default, this is in data
570+
coordinates. The coordinate system can be changed using the
571+
*transform* parameter.
571572
572-
s : string
573-
text
573+
s : str
574+
The text.
574575
575576
fontdict : dictionary, optional, default: None
576577
A dictionary to override the default text properties. If fontdict
@@ -580,6 +581,11 @@ def text(self, x, y, s, fontdict=None, withdash=False, **kwargs):
580581
Creates a `~matplotlib.text.TextWithDash` instance instead of a
581582
`~matplotlib.text.Text` instance.
582583
584+
Returns
585+
-------
586+
text : `.Text`
587+
The created `.Text` instance.
588+
583589
Other Parameters
584590
----------------
585591
**kwargs : `~matplotlib.text.Text` properties.
@@ -597,9 +603,8 @@ def text(self, x, y, s, fontdict=None, withdash=False, **kwargs):
597603
lower-left and 1,1 is upper-right). The example below places
598604
text in the center of the axes::
599605
600-
>>> text(0.5, 0.5,'matplotlib', horizontalalignment='center',
601-
... verticalalignment='center',
602-
... transform=ax.transAxes)
606+
>>> text(0.5, 0.5, 'matplotlib', horizontalalignment='center',
607+
... verticalalignment='center', transform=ax.transAxes)
603608
604609
You can put a rectangular box around the text instance (e.g., to
605610
set a background color) by using the keyword `bbox`. `bbox` is
@@ -4781,41 +4786,37 @@ def arrow(self, x, y, dx, dy, **kwargs):
47814786
"""
47824787
Add an arrow to the axes.
47834788
4784-
Draws arrow on specified axis from (`x`, `y`) to (`x` + `dx`,
4785-
`y` + `dy`). Uses FancyArrow patch to construct the arrow.
4789+
This draws an arrow from (`x`, `y`) to (`x+dx`, `y+dy`).
47864790
47874791
Parameters
47884792
----------
4789-
x : float
4790-
X-coordinate of the arrow base
4791-
y : float
4792-
Y-coordinate of the arrow base
4793-
dx : float
4794-
Length of arrow along x-coordinate
4795-
dy : float
4796-
Length of arrow along y-coordinate
4793+
x, y : float
4794+
The x/y-coordinate of the arrow base.
4795+
dx, dy : float
4796+
The length of the arrow along x/y-direction.
47974797
47984798
Returns
47994799
-------
4800-
a : FancyArrow
4801-
patches.FancyArrow object
4800+
arrow : `.FancyArrow`
4801+
The created `.FancyArrow` object.
48024802
48034803
Other Parameters
4804-
-----------------
4805-
Optional kwargs (inherited from FancyArrow patch) control the arrow
4806-
construction and properties:
4804+
----------------
4805+
**kwargs
4806+
Optional kwargs (inherited from `.FancyArrow` patch) control the
4807+
arrow construction and properties:
48074808
4808-
%(FancyArrow)s
4809+
%(FancyArrow)s
48094810
48104811
Notes
48114812
-----
48124813
The resulting arrow is affected by the axes aspect ratio and limits.
48134814
This may produce an arrow whose head is not square with its stem. To
48144815
create an arrow whose head is square with its stem, use
4815-
:meth:`annotate` for example::
4816+
:meth:`annotate` for example:
48164817
4817-
ax.annotate("", xy=(0.5, 0.5), xytext=(0, 0),
4818-
arrowprops=dict(arrowstyle="->"))
4818+
>>> ax.annotate("", xy=(0.5, 0.5), xytext=(0, 0),
4819+
... arrowprops=dict(arrowstyle="->"))
48194820
"""
48204821
# Strip away units for the underlying patch since units
48214822
# do not make sense to most patch-like code
@@ -6181,7 +6182,7 @@ def table(self, **kwargs):
61816182
cellLoc='right', colWidths=None,
61826183
rowLabels=None, rowColours=None, rowLoc='left',
61836184
colLabels=None, colColours=None, colLoc='center',
6184-
loc='bottom', bbox=None):
6185+
loc='bottom', bbox=None)
61856186
61866187
Returns a :class:`matplotlib.table.Table` instance. Either `cellText`
61876188
or `cellColours` must be provided. For finer grained control over

0 commit comments

Comments
 (0)
0