Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3492e4d

Browse filesBrowse files
committed
Cleanup text.py docstrings.
1 parent cf6c569 commit 3492e4d
Copy full SHA for 3492e4d

File tree

Expand file treeCollapse file tree

1 file changed

+36
-38
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+36
-38
lines changed

‎lib/matplotlib/text.py

Copy file name to clipboardExpand all lines: lib/matplotlib/text.py
+36-38Lines changed: 36 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,9 +1667,10 @@ def set_figure(self, fig):
16671667

16681668

16691669
class OffsetFrom:
1670-
'Callable helper class for working with `Annotation`'
1670+
"""Callable helper class for working with `Annotation`."""
1671+
16711672
def __init__(self, artist, ref_coord, unit="points"):
1672-
'''
1673+
"""
16731674
Parameters
16741675
----------
16751676
artist : `.Artist`, `.BboxBase`, or `.Transform`
@@ -1684,27 +1685,25 @@ def __init__(self, artist, ref_coord, unit="points"):
16841685
transform applied to this value.
16851686
16861687
unit : {'points, 'pixels'}
1687-
The screen units to use (pixels or points) for the offset
1688-
input.
1689-
1690-
'''
1688+
The screen units to use (pixels or points) for the offset input.
1689+
"""
16911690
self._artist = artist
16921691
self._ref_coord = ref_coord
16931692
self.set_unit(unit)
16941693

16951694
def set_unit(self, unit):
1696-
'''
1695+
"""
16971696
The unit for input to the transform used by ``__call__``
16981697
16991698
Parameters
17001699
----------
17011700
unit : {'points', 'pixels'}
1702-
'''
1701+
"""
17031702
cbook._check_in_list(["points", "pixels"], unit=unit)
17041703
self._unit = unit
17051704

17061705
def get_unit(self):
1707-
'The unit for input to the transform used by ``__call__``'
1706+
"""The unit for input to the transform used by ``__call__``."""
17081707
return self._unit
17091708

17101709
def _get_scale(self, renderer):
@@ -1715,7 +1714,7 @@ def _get_scale(self, renderer):
17151714
return renderer.points_to_pixels(1.)
17161715

17171716
def __call__(self, renderer):
1718-
'''
1717+
"""
17191718
Return the offset transform.
17201719
17211720
Parameters
@@ -1728,7 +1727,7 @@ def __call__(self, renderer):
17281727
transform : `Transform`
17291728
Maps (x, y) in pixel or point units to screen units
17301729
relative to the given artist.
1731-
'''
1730+
"""
17321731
if isinstance(self._artist, Artist):
17331732
bbox = self._artist.get_window_extent(renderer)
17341733
l, b, w, h = bbox.bounds
@@ -1890,56 +1889,55 @@ def is_offset(s):
18901889

18911890
def set_annotation_clip(self, b):
18921891
"""
1893-
set *annotation_clip* attribute.
1892+
Set the annotation's clipping behavior.
18941893
1895-
* True: the annotation will only be drawn when self.xy is inside
1896-
the axes.
1897-
* False: the annotation will always be drawn regardless of its
1898-
position.
1899-
* None: the self.xy will be checked only if *xycoords* is "data"
1894+
Parameters
1895+
----------
1896+
b : bool or None
1897+
- True: the annotation will only be drawn when self.xy is inside
1898+
the axes.
1899+
- False: the annotation will always be drawn regardless of its
1900+
position.
1901+
- None: the self.xy will be checked only if *xycoords* is "data".
19001902
"""
19011903
self._annotation_clip = b
19021904

19031905
def get_annotation_clip(self):
19041906
"""
1905-
Return *annotation_clip* attribute.
1906-
See :meth:`set_annotation_clip` for the meaning of return values.
1907+
Return the annotation's clipping behavior.
1908+
1909+
See `set_annotation_clip` for the meaning of return values.
19071910
"""
19081911
return self._annotation_clip
19091912

19101913
def _get_position_xy(self, renderer):
1911-
"Return the pixel position of the annotated point."
1914+
"""Return the pixel position of the annotated point."""
19121915
x, y = self.xy
19131916
return self._get_xy(renderer, x, y, self.xycoords)
19141917

19151918
def _check_xy(self, renderer, xy_pixel):
1916-
"""
1917-
given the xy pixel coordinate, check if the annotation need to
1918-
be drawn.
1919-
"""
1920-
1919+
"""Check whether the annotation at *xy_pixel* should be drawn."""
19211920
b = self.get_annotation_clip()
1922-
19231921
if b or (b is None and self.xycoords == "data"):
19241922
# check if self.xy is inside the axes.
1925-
if not self.axes.contains_point(xy_pixel):
1926-
return False
1927-
1923+
return self.axes.contains_point(xy_pixel)
19281924
return True
19291925

19301926
def draggable(self, state=None, use_blit=False):
19311927
"""
1932-
Set the draggable state -- if state is
1933-
1934-
* None : toggle the current state
1928+
Set whether the annotation is draggable with the mouse.
19351929
1936-
* True : turn draggable on
1937-
1938-
* False : turn draggable off
1930+
Parameters
1931+
----------
1932+
state : bool or None
1933+
- True or False: set the draggability.
1934+
- None: toggle the draggability.
19391935
1940-
If draggable is on, you can drag the annotation on the canvas with
1941-
the mouse. The DraggableAnnotation helper instance is returned if
1942-
draggable is on.
1936+
Returns
1937+
-------
1938+
DraggableAnnotation or None
1939+
If the annotation is draggable, the corresponding
1940+
`.DraggableAnnotation` helper is returned.
19431941
"""
19441942
from matplotlib.offsetbox import DraggableAnnotation
19451943
is_draggable = self._draggable is not None

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.