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 9f81e40

Browse filesBrowse files
authored
Numpydocify axes_artist.py (#14495)
Numpydocify axes_artist.py
2 parents ef3a17a + 5978d6e commit 9f81e40
Copy full SHA for 9f81e40

File tree

Expand file treeCollapse file tree

1 file changed

+46
-48
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+46
-48
lines changed

‎lib/mpl_toolkits/axisartist/axis_artist.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/axisartist/axis_artist.py
+46-48Lines changed: 46 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -230,27 +230,19 @@ def get_markeredgewidth(self):
230230
return self.get_attribute_from_ref_artist("markeredgewidth", .5)
231231

232232
def set_tick_out(self, b):
233-
"""
234-
set True if tick need to be rotated by 180 degree.
235-
"""
233+
"""Set whether ticks are drawn inside or outside the axes."""
236234
self._tick_out = b
237235

238236
def get_tick_out(self):
239-
"""
240-
Return True if the tick will be rotated by 180 degree.
241-
"""
237+
"""Return whether ticks are drawn inside or outside the axes."""
242238
return self._tick_out
243239

244240
def set_ticksize(self, ticksize):
245-
"""
246-
set length of the ticks in points.
247-
"""
241+
"""Set length of the ticks in points."""
248242
self._ticksize = ticksize
249243

250244
def get_ticksize(self):
251-
"""
252-
Return length of the ticks in points.
253-
"""
245+
"""Return length of the ticks in points."""
254246
return self._ticksize
255247

256248
def set_locs_angles(self, locs_angles):
@@ -422,30 +414,27 @@ def __init__(self, *args, axis_direction="bottom", axis=None, **kwargs):
422414

423415
def set_pad(self, pad):
424416
"""
425-
Set the pad in points. Note that the actual pad will be the
426-
sum of the internal pad and the external pad (that are set
427-
automatically by the AxisArtist), and it only set the internal
428-
pad
417+
Set the internal pad in points.
418+
419+
The actual pad will be the sum of the internal pad and the
420+
external pad (the latter is set automatically by the AxisArtist).
429421
"""
430422
self._pad = pad
431423

432424
def get_pad(self):
433425
"""
434-
return pad in points. See set_pad for more details.
426+
Return the internal pad in points.
427+
428+
See `.set_pad` for more details.
435429
"""
436430
return self._pad
437431

438432
def _set_external_pad(self, p):
439-
"""
440-
Set external pad IN PIXELS. This is intended to be set by the
441-
AxisArtist, bot by user..
442-
"""
433+
"""Set external pad in pixels."""
443434
self._extra_pad = p
444435

445436
def _get_external_pad(self):
446-
"""
447-
Get external pad.
448-
"""
437+
"""Return external pad in pixels."""
449438
return self._extra_pad
450439

451440
def get_ref_artist(self):
@@ -578,7 +567,7 @@ def invert_axis_direction(self):
578567

579568
def _get_ticklabels_offsets(self, renderer, label_direction):
580569
"""
581-
Calculates the ticklabel offsets from the tick and their total heights.
570+
Calculate the ticklabel offsets from the tick and their total heights.
582571
583572
The offset only takes account the offset due to the vertical alignment
584573
of the ticklabels: if axis direction is bottom and va is 'top', it will
@@ -699,13 +688,15 @@ def get_window_extents(self, renderer):
699688

700689
def get_texts_widths_heights_descents(self, renderer):
701690
"""
702-
return a list of width, height, descent for ticklabels.
691+
Return a list of ``(width, height, descent)`` tuples for ticklabels.
692+
693+
Empty labels are left out.
703694
"""
704695
whd_list = []
705-
for (x, y), a, l in self._locs_angles_labels:
706-
if not l.strip():
696+
for _loc, _angle, label in self._locs_angles_labels:
697+
if not label.strip():
707698
continue
708-
clean_line, ismath = self._preprocess_math(l)
699+
clean_line, ismath = self._preprocess_math(label)
709700
whd = renderer.get_text_width_height_descent(
710701
clean_line, self._fontproperties, ismath=ismath)
711702
whd_list.append(whd)
@@ -715,8 +706,10 @@ def get_texts_widths_heights_descents(self, renderer):
715706
class GridlinesCollection(LineCollection):
716707
def __init__(self, *args, which="major", axis="both", **kwargs):
717708
"""
718-
*which* : "major" or "minor"
719-
*axis* : "both", "x" or "y"
709+
Parameters
710+
----------
711+
which : {"major", "minor"}
712+
axis : {"both", "x", "y"}
720713
"""
721714
self._which = which
722715
self._axis = axis
@@ -765,8 +758,10 @@ def __init__(self, axes,
765758
axis_direction="bottom",
766759
**kwargs):
767760
"""
768-
*axes* : axes
769-
*helper* : an AxisArtistHelper instance.
761+
Parameters
762+
----------
763+
axes : `mpl_toolkits.axisartist.axislines.Axes`
764+
helper : `~mpl_toolkits.axisartist.axislines.AxisArtistHelper`
770765
"""
771766
#axes is also used to follow the axis attribute (tick color, etc).
772767

@@ -899,19 +894,24 @@ def set_axisline_style(self, axisline_style=None, **kwargs):
899894
"""
900895
Set the axisline style.
901896
902-
*axisline_style* can be a string with axisline style name with optional
903-
comma-separated attributes. Alternatively, the attrs can
904-
be provided as keywords.
897+
The new style is completely defined by the passed attributes. Existing
898+
style attributes are forgotten.
905899
906-
set_axisline_style("->,size=1.5")
907-
set_axisline_style("->", size=1.5)
908-
909-
Old attrs simply are forgotten.
910-
911-
Without argument (or with arrowstyle=None), return
912-
available styles as a list of strings.
900+
Parameters
901+
----------
902+
axisline_style : str or None
903+
The line style, e.g. '->', optionally followed by a comma-separated
904+
list of attributes. Alternatively, the attributes can be provided
905+
as keywords.
906+
907+
If *None* this returns a string containing the available styles.
908+
909+
Examples
910+
--------
911+
The following two commands are equal:
912+
>>> set_axisline_style("->,size=1.5")
913+
>>> set_axisline_style("->", size=1.5)
913914
"""
914-
915915
if axisline_style is None:
916916
return AxislineStyle.pprint_styles()
917917

@@ -923,9 +923,7 @@ def set_axisline_style(self, axisline_style=None, **kwargs):
923923
self._init_line()
924924

925925
def get_axisline_style(self):
926-
"""
927-
return the current axisline style.
928-
"""
926+
"""Return the current axisline style."""
929927
return self._axisline_style
930928

931929
def _init_line(self):
@@ -1249,7 +1247,7 @@ def get_tightbbox(self, renderer):
12491247

12501248
@martist.allow_rasterization
12511249
def draw(self, renderer):
1252-
'Draw the axis lines, tick lines and labels'
1250+
"""Draw the axis lines, tick lines and labels."""
12531251

12541252
if not self.get_visible():
12551253
return

0 commit comments

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