@@ -230,27 +230,19 @@ def get_markeredgewidth(self):
230
230
return self .get_attribute_from_ref_artist ("markeredgewidth" , .5 )
231
231
232
232
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."""
236
234
self ._tick_out = b
237
235
238
236
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."""
242
238
return self ._tick_out
243
239
244
240
def set_ticksize (self , ticksize ):
245
- """
246
- set length of the ticks in points.
247
- """
241
+ """Set length of the ticks in points."""
248
242
self ._ticksize = ticksize
249
243
250
244
def get_ticksize (self ):
251
- """
252
- Return length of the ticks in points.
253
- """
245
+ """Return length of the ticks in points."""
254
246
return self ._ticksize
255
247
256
248
def set_locs_angles (self , locs_angles ):
@@ -422,30 +414,27 @@ def __init__(self, *args, axis_direction="bottom", axis=None, **kwargs):
422
414
423
415
def set_pad (self , pad ):
424
416
"""
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).
429
421
"""
430
422
self ._pad = pad
431
423
432
424
def get_pad (self ):
433
425
"""
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.
435
429
"""
436
430
return self ._pad
437
431
438
432
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."""
443
434
self ._extra_pad = p
444
435
445
436
def _get_external_pad (self ):
446
- """
447
- Get external pad.
448
- """
437
+ """Return external pad in pixels."""
449
438
return self ._extra_pad
450
439
451
440
def get_ref_artist (self ):
@@ -578,7 +567,7 @@ def invert_axis_direction(self):
578
567
579
568
def _get_ticklabels_offsets (self , renderer , label_direction ):
580
569
"""
581
- Calculates the ticklabel offsets from the tick and their total heights.
570
+ Calculate the ticklabel offsets from the tick and their total heights.
582
571
583
572
The offset only takes account the offset due to the vertical alignment
584
573
of the ticklabels: if axis direction is bottom and va is 'top', it will
@@ -699,13 +688,15 @@ def get_window_extents(self, renderer):
699
688
700
689
def get_texts_widths_heights_descents (self , renderer ):
701
690
"""
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.
703
694
"""
704
695
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 ():
707
698
continue
708
- clean_line , ismath = self ._preprocess_math (l )
699
+ clean_line , ismath = self ._preprocess_math (label )
709
700
whd = renderer .get_text_width_height_descent (
710
701
clean_line , self ._fontproperties , ismath = ismath )
711
702
whd_list .append (whd )
@@ -715,8 +706,10 @@ def get_texts_widths_heights_descents(self, renderer):
715
706
class GridlinesCollection (LineCollection ):
716
707
def __init__ (self , * args , which = "major" , axis = "both" , ** kwargs ):
717
708
"""
718
- *which* : "major" or "minor"
719
- *axis* : "both", "x" or "y"
709
+ Parameters
710
+ ----------
711
+ which : {"major", "minor"}
712
+ axis : {"both", "x", "y"}
720
713
"""
721
714
self ._which = which
722
715
self ._axis = axis
@@ -765,8 +758,10 @@ def __init__(self, axes,
765
758
axis_direction = "bottom" ,
766
759
** kwargs ):
767
760
"""
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`
770
765
"""
771
766
#axes is also used to follow the axis attribute (tick color, etc).
772
767
@@ -899,19 +894,24 @@ def set_axisline_style(self, axisline_style=None, **kwargs):
899
894
"""
900
895
Set the axisline style.
901
896
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.
905
899
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)
913
914
"""
914
-
915
915
if axisline_style is None :
916
916
return AxislineStyle .pprint_styles ()
917
917
@@ -923,9 +923,7 @@ def set_axisline_style(self, axisline_style=None, **kwargs):
923
923
self ._init_line ()
924
924
925
925
def get_axisline_style (self ):
926
- """
927
- return the current axisline style.
928
- """
926
+ """Return the current axisline style."""
929
927
return self ._axisline_style
930
928
931
929
def _init_line (self ):
@@ -1249,7 +1247,7 @@ def get_tightbbox(self, renderer):
1249
1247
1250
1248
@martist .allow_rasterization
1251
1249
def draw (self , renderer ):
1252
- ' Draw the axis lines, tick lines and labels'
1250
+ """ Draw the axis lines, tick lines and labels."""
1253
1251
1254
1252
if not self .get_visible ():
1255
1253
return
0 commit comments