@@ -143,7 +143,7 @@ def __init__(self,
143
143
** kwargs
144
144
):
145
145
"""
146
- Create a `Text` instance at *x*, *y* with string *text*.
146
+ Create a `. Text` instance at *x*, *y* with string *text*.
147
147
148
148
Valid kwargs are
149
149
%(Text)s
@@ -200,7 +200,9 @@ def contains(self, mouseevent):
200
200
In the case of text, a hit is true anywhere in the
201
201
axis-aligned bounding-box containing the text.
202
202
203
- Returns True or False.
203
+ Returns
204
+ -------
205
+ bool : bool
204
206
"""
205
207
if callable (self ._contains ):
206
208
return self ._contains (self , mouseevent )
@@ -430,17 +432,19 @@ def _get_layout(self, renderer):
430
432
431
433
def set_bbox (self , rectprops ):
432
434
"""
433
- Draw a bounding box around self. rectprops are any settable
434
- properties for a FancyBboxPatch, e.g., facecolor='red', alpha=0.5.
435
-
436
- t.set_bbox(dict(facecolor='red', alpha=0.5))
437
-
438
- The default boxstyle is 'square'. The mutation
439
- scale of the FancyBboxPatch is set to the fontsize.
435
+ Draw a bounding box around self.
440
436
441
437
Parameters
442
438
----------
443
- rectprops : FancyBboxPatch prop dict
439
+ rectprops : dict with properties for `.patches.FancyBboxPatch`
440
+ The default boxstyle is 'square'. The mutation
441
+ scale of the `.patches.FancyBboxPatch` is set to the fontsize.
442
+
443
+ Examples
444
+ --------
445
+ ::
446
+
447
+ t.set_bbox(dict(facecolor='red', alpha=0.5))
444
448
"""
445
449
446
450
if rectprops is not None :
@@ -476,7 +480,8 @@ def set_bbox(self, rectprops):
476
480
477
481
def get_bbox_patch (self ):
478
482
"""
479
- Return the bbox Patch, or None if the FancyBboxPatch is not made.
483
+ Return the bbox Patch, or None if the `.patches.FancyBboxPatch`
484
+ is not made.
480
485
"""
481
486
return self ._bbox_patch
482
487
@@ -510,7 +515,8 @@ def update_bbox_position_size(self, renderer):
510
515
511
516
def _draw_bbox (self , renderer , posx , posy ):
512
517
"""
513
- Update the location and size of the bbox (FancyBboxPatch), and draw.
518
+ Update the location and size of the bbox (`.patches.FancyBboxPatch`),
519
+ and draw.
514
520
"""
515
521
516
522
x_box , y_box , w_box , h_box = _get_textbox (self , renderer )
@@ -532,11 +538,11 @@ def _update_clip_properties(self):
532
538
533
539
def set_clip_box (self , clipbox ):
534
540
"""
535
- Set the artist's clip :class:`~matplotlib .transforms.Bbox`.
541
+ Set the artist's clip `~ .transforms.Bbox`.
536
542
537
543
Parameters
538
544
----------
539
- clipbox : matplotlib.transforms.Bbox
545
+ clipbox : ` matplotlib.transforms.Bbox`
540
546
"""
541
547
super ().set_clip_box (clipbox )
542
548
self ._update_clip_properties ()
@@ -545,10 +551,10 @@ def set_clip_path(self, path, transform=None):
545
551
"""
546
552
Set the artist's clip path, which may be:
547
553
548
- * a :class: `~matplotlib.patches.Patch` (or subclass) instance
554
+ * a `~matplotlib.patches.Patch` (or subclass) instance
549
555
550
- * a :class: `~matplotlib.path.Path` instance, in which case
551
- an optional :class: `~matplotlib.transforms.Transform`
556
+ * a `~matplotlib.path.Path` instance, in which case
557
+ an optional `~matplotlib.transforms.Transform`
552
558
instance may be provided, which will be applied to the
553
559
path before using it for clipping.
554
560
@@ -558,9 +564,8 @@ def set_clip_path(self, path, transform=None):
558
564
rectangle, this method will set the clipping box to the
559
565
corresponding rectangle and set the clipping path to *None*.
560
566
561
- ACCEPTS: [ (:class:`~matplotlib.path.Path`,
562
- :class:`~matplotlib.transforms.Transform`) |
563
- :class:`~matplotlib.patches.Patch` | None ]
567
+ ACCEPTS: { (`.path.Path`, `.transforms.Transform`),
568
+ `.patches.Patch`, None }
564
569
"""
565
570
super ().set_clip_path (path , transform )
566
571
self ._update_clip_properties ()
@@ -689,7 +694,7 @@ def _get_wrapped_text(self):
689
694
@artist .allow_rasterization
690
695
def draw (self , renderer ):
691
696
"""
692
- Draws the :class:` Text` object to the given *renderer*.
697
+ Draws the `. Text` object to the given *renderer*.
693
698
"""
694
699
if renderer is not None :
695
700
self ._renderer = renderer
@@ -761,35 +766,77 @@ def get_color(self):
761
766
return self ._color
762
767
763
768
def get_fontproperties (self ):
764
- "Return the :class:`~ font_manager.FontProperties` object"
769
+ "Return the `. font_manager.FontProperties` object"
765
770
return self ._fontproperties
766
771
767
772
def get_fontfamily (self ):
768
- "Return the list of font families used for font lookup"
773
+ """
774
+ Return the list of font families used for font lookup
775
+
776
+ See Also
777
+ --------
778
+ .font_manager.FontProperties.get_family
779
+ """
769
780
return self ._fontproperties .get_family ()
770
781
771
782
def get_fontname (self ):
772
- "Return the font name as string"
783
+ """
784
+ Return the font name as string
785
+
786
+ See Also
787
+ --------
788
+ .font_manager.FontProperties.get_name
789
+ """
773
790
return self ._fontproperties .get_name ()
774
791
775
792
def get_fontstyle (self ):
776
- "Return the font style as string"
793
+ """
794
+ Return the font style as string
795
+
796
+ See Also
797
+ --------
798
+ .font_manager.FontProperties.get_style
799
+ """
777
800
return self ._fontproperties .get_style ()
778
801
779
802
def get_fontsize (self ):
780
- "Return the font size as integer"
803
+ """
804
+ Return the font size as integer
805
+
806
+ See Also
807
+ --------
808
+ .font_manager.FontProperties.get_size_in_points
809
+ """
781
810
return self ._fontproperties .get_size_in_points ()
782
811
783
812
def get_fontvariant (self ):
784
- "Return the font variant as a string"
813
+ """
814
+ Return the font variant as a string
815
+
816
+ See Also
817
+ --------
818
+ .font_manager.FontProperties.get_variant
819
+ """
785
820
return self ._fontproperties .get_variant ()
786
821
787
822
def get_fontweight (self ):
788
- "Get the font weight as string or number"
823
+ """
824
+ Get the font weight as string or number
825
+
826
+ See Also
827
+ --------
828
+ .font_manager.FontProperties.get_weight
829
+ """
789
830
return self ._fontproperties .get_weight ()
790
831
791
832
def get_stretch (self ):
792
- 'Get the font stretch as a string or number'
833
+ """
834
+ Get the font stretch as a string or number
835
+
836
+ See Also
837
+ --------
838
+ .font_manager.FontProperties.get_stretch
839
+ """
793
840
return self ._fontproperties .get_stretch ()
794
841
795
842
def get_horizontalalignment (self ):
@@ -844,7 +891,7 @@ def get_verticalalignment(self):
844
891
845
892
def get_window_extent (self , renderer = None , dpi = None ):
846
893
'''
847
- Return a :class: `~matplotlib.transforms.Bbox` object bounding
894
+ Return a `~matplotlib.transforms.Bbox` object bounding
848
895
the text, in display units.
849
896
850
897
In addition to being used internally, this is useful for
@@ -853,9 +900,9 @@ def get_window_extent(self, renderer=None, dpi=None):
853
900
*renderer* defaults to the _renderer attribute of the text
854
901
object. This is not assigned until the first execution of
855
902
:meth:`draw`, so you must use this kwarg if you want
856
- to call :meth:` get_window_extent` prior to the first
857
- :meth:`draw`. For getting web page regions, it is
858
- simpler to call the method after saving the figure.
903
+ to call `. get_window_extent` prior to the first `draw`. For
904
+ getting web page regions, it is simpler to call the method after
905
+ saving the figure.
859
906
860
907
*dpi* defaults to self.figure.dpi; the renderer dpi is
861
908
irrelevant. For the web application, if figure.dpi is not
@@ -889,14 +936,13 @@ def set_backgroundcolor(self, color):
889
936
"""
890
937
Set the background color of the text by updating the bbox.
891
938
892
- .. seealso::
893
-
894
- :meth:`set_bbox`
895
- To change the position of the bounding box.
896
-
897
939
Parameters
898
940
----------
899
941
color : color
942
+
943
+ See Also
944
+ --------
945
+ .set_bbox : To change the position of the bounding box
900
946
"""
901
947
if self ._bbox_patch is None :
902
948
self .set_bbox (dict (facecolor = color , edgecolor = color ))
@@ -946,7 +992,7 @@ def set_multialignment(self, align):
946
992
947
993
Parameters
948
994
----------
949
- align: {'left', 'right', 'center'}
995
+ align : {'left', 'right', 'center'}
950
996
"""
951
997
legal = ('center' , 'right' , 'left' )
952
998
if align not in legal :
@@ -978,6 +1024,10 @@ def set_fontfamily(self, fontname):
978
1024
----------
979
1025
fontname : {FONTNAME, 'serif', 'sans-serif', 'cursive', 'fantasy', \
980
1026
'monospace'}
1027
+
1028
+ See Also
1029
+ --------
1030
+ .font_manager.FontProperties.set_family
981
1031
"""
982
1032
self ._fontproperties .set_family (fontname )
983
1033
self .stale = True
@@ -989,6 +1039,10 @@ def set_fontvariant(self, variant):
989
1039
Parameters
990
1040
----------
991
1041
variant : {'normal', 'small-caps'}
1042
+
1043
+ See Also
1044
+ --------
1045
+ .font_manager.FontProperties.set_variant
992
1046
"""
993
1047
self ._fontproperties .set_variant (variant )
994
1048
self .stale = True
@@ -1000,6 +1054,10 @@ def set_fontstyle(self, fontstyle):
1000
1054
Parameters
1001
1055
----------
1002
1056
fontstyle : {'normal', 'italic', 'oblique'}
1057
+
1058
+ See Also
1059
+ --------
1060
+ .font_manager.FontProperties.set_style
1003
1061
"""
1004
1062
self ._fontproperties .set_style (fontstyle )
1005
1063
self .stale = True
@@ -1013,6 +1071,10 @@ def set_fontsize(self, fontsize):
1013
1071
----------
1014
1072
fontsize : {size in points, 'xx-small', 'x-small', 'small', 'medium', \
1015
1073
'large', 'x-large', 'xx-large'}
1074
+
1075
+ See Also
1076
+ --------
1077
+ .font_manager.FontProperties.set_size
1016
1078
"""
1017
1079
self ._fontproperties .set_size (fontsize )
1018
1080
self .stale = True
@@ -1026,6 +1088,10 @@ def set_fontweight(self, weight):
1026
1088
weight : {a numeric value in range 0-1000, 'ultralight', 'light', \
1027
1089
'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', \
1028
1090
'demi', 'bold', 'heavy', 'extra bold', 'black'}
1091
+
1092
+ See Also
1093
+ --------
1094
+ .font_manager.FontProperties.set_weight
1029
1095
"""
1030
1096
self ._fontproperties .set_weight (weight )
1031
1097
self .stale = True
@@ -1039,6 +1105,10 @@ def set_fontstretch(self, stretch):
1039
1105
stretch : {a numeric value in range 0-1000, 'ultra-condensed', \
1040
1106
'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', \
1041
1107
'expanded', 'extra-expanded', 'ultra-expanded'}
1108
+
1109
+ See Also
1110
+ --------
1111
+ .font_manager.FontProperties.set_stretch
1042
1112
"""
1043
1113
self ._fontproperties .set_stretch (stretch )
1044
1114
self .stale = True
@@ -1144,12 +1214,11 @@ def is_math_text(s, usetex=None):
1144
1214
1145
1215
def set_fontproperties (self , fp ):
1146
1216
"""
1147
- Set the font properties that control the text. *fp* must be a
1148
- :class:`matplotlib.font_manager.FontProperties` object.
1217
+ Set the font properties that control the text.
1149
1218
1150
1219
Parameters
1151
1220
----------
1152
- fp : matplotlib .font_manager.FontProperties
1221
+ fp : ` .font_manager.FontProperties`
1153
1222
"""
1154
1223
if isinstance (fp , str ):
1155
1224
fp = FontProperties (fp )
@@ -1184,9 +1253,19 @@ def get_usetex(self):
1184
1253
1185
1254
def set_fontname (self , fontname ):
1186
1255
"""
1187
- alias for set_family
1256
+ alias for `. set_family`
1188
1257
1189
1258
One-way alias only: the getter differs.
1259
+
1260
+ Parameters
1261
+ ----------
1262
+ fontname : {FONTNAME, 'serif', 'sans-serif', 'cursive', 'fantasy', \
1263
+ 'monospace'}
1264
+
1265
+ See Also
1266
+ --------
1267
+ .font_manager.FontProperties.set_family
1268
+
1190
1269
"""
1191
1270
return self .set_family (fontname )
1192
1271
0 commit comments