@@ -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,9 @@ 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: [ (`~matplotlib.path.Path`,
568
+ `~matplotlib.transforms.Transform`) |
569
+ `~matplotlib.patches.Patch` | None ]
564
570
"""
565
571
super ().set_clip_path (path , transform )
566
572
self ._update_clip_properties ()
@@ -689,7 +695,7 @@ def _get_wrapped_text(self):
689
695
@artist .allow_rasterization
690
696
def draw (self , renderer ):
691
697
"""
692
- Draws the :class:` Text` object to the given *renderer*.
698
+ Draws the `. Text` object to the given *renderer*.
693
699
"""
694
700
if renderer is not None :
695
701
self ._renderer = renderer
@@ -761,35 +767,77 @@ def get_color(self):
761
767
return self ._color
762
768
763
769
def get_fontproperties (self ):
764
- "Return the :class:`~ font_manager.FontProperties` object"
770
+ "Return the `. font_manager.FontProperties` object"
765
771
return self ._fontproperties
766
772
767
773
def get_fontfamily (self ):
768
- "Return the list of font families used for font lookup"
774
+ """
775
+ Return the list of font families used for font lookup
776
+
777
+ See Also
778
+ --------
779
+ .font_manager.FontProperties.get_family
780
+ """
769
781
return self ._fontproperties .get_family ()
770
782
771
783
def get_fontname (self ):
772
- "Return the font name as string"
784
+ """
785
+ Return the font name as string
786
+
787
+ See Also
788
+ --------
789
+ .font_manager.FontProperties.get_name
790
+ """
773
791
return self ._fontproperties .get_name ()
774
792
775
793
def get_fontstyle (self ):
776
- "Return the font style as string"
794
+ """
795
+ Return the font style as string
796
+
797
+ See Also
798
+ --------
799
+ .font_manager.FontProperties.get_style
800
+ """
777
801
return self ._fontproperties .get_style ()
778
802
779
803
def get_fontsize (self ):
780
- "Return the font size as integer"
804
+ """
805
+ Return the font size as integer
806
+
807
+ See Also
808
+ --------
809
+ .font_manager.FontProperties.get_size_in_points
810
+ """
781
811
return self ._fontproperties .get_size_in_points ()
782
812
783
813
def get_fontvariant (self ):
784
- "Return the font variant as a string"
814
+ """
815
+ Return the font variant as a string
816
+
817
+ See Also
818
+ --------
819
+ .font_manager.FontProperties.get_variant
820
+ """
785
821
return self ._fontproperties .get_variant ()
786
822
787
823
def get_fontweight (self ):
788
- "Get the font weight as string or number"
824
+ """
825
+ Get the font weight as string or number
826
+
827
+ See Also
828
+ --------
829
+ .font_manager.FontProperties.get_weight
830
+ """
789
831
return self ._fontproperties .get_weight ()
790
832
791
833
def get_stretch (self ):
792
- 'Get the font stretch as a string or number'
834
+ """
835
+ Get the font stretch as a string or number
836
+
837
+ See Also
838
+ --------
839
+ .font_manager.FontProperties.get_stretch
840
+ """
793
841
return self ._fontproperties .get_stretch ()
794
842
795
843
def get_horizontalalignment (self ):
@@ -844,7 +892,7 @@ def get_verticalalignment(self):
844
892
845
893
def get_window_extent (self , renderer = None , dpi = None ):
846
894
'''
847
- Return a :class: `~matplotlib.transforms.Bbox` object bounding
895
+ Return a `~matplotlib.transforms.Bbox` object bounding
848
896
the text, in display units.
849
897
850
898
In addition to being used internally, this is useful for
@@ -853,9 +901,9 @@ def get_window_extent(self, renderer=None, dpi=None):
853
901
*renderer* defaults to the _renderer attribute of the text
854
902
object. This is not assigned until the first execution of
855
903
: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.
904
+ to call `. get_window_extent` prior to the first `draw`. For
905
+ getting web page regions, it is simpler to call the method after
906
+ saving the figure.
859
907
860
908
*dpi* defaults to self.figure.dpi; the renderer dpi is
861
909
irrelevant. For the web application, if figure.dpi is not
@@ -889,14 +937,13 @@ def set_backgroundcolor(self, color):
889
937
"""
890
938
Set the background color of the text by updating the bbox.
891
939
892
- .. seealso::
893
-
894
- :meth:`set_bbox`
895
- To change the position of the bounding box.
896
-
897
940
Parameters
898
941
----------
899
942
color : color
943
+
944
+ See Also
945
+ --------
946
+ .set_bbox : To change the position of the bounding box
900
947
"""
901
948
if self ._bbox_patch is None :
902
949
self .set_bbox (dict (facecolor = color , edgecolor = color ))
@@ -946,7 +993,7 @@ def set_multialignment(self, align):
946
993
947
994
Parameters
948
995
----------
949
- align: {'left', 'right', 'center'}
996
+ align : {'left', 'right', 'center'}
950
997
"""
951
998
legal = ('center' , 'right' , 'left' )
952
999
if align not in legal :
@@ -978,6 +1025,10 @@ def set_fontfamily(self, fontname):
978
1025
----------
979
1026
fontname : {FONTNAME, 'serif', 'sans-serif', 'cursive', 'fantasy', \
980
1027
'monospace'}
1028
+
1029
+ See Also
1030
+ --------
1031
+ .font_manager.FontProperties.set_family
981
1032
"""
982
1033
self ._fontproperties .set_family (fontname )
983
1034
self .stale = True
@@ -989,6 +1040,10 @@ def set_fontvariant(self, variant):
989
1040
Parameters
990
1041
----------
991
1042
variant : {'normal', 'small-caps'}
1043
+
1044
+ See Also
1045
+ --------
1046
+ .font_manager.FontProperties.set_variant
992
1047
"""
993
1048
self ._fontproperties .set_variant (variant )
994
1049
self .stale = True
@@ -1000,6 +1055,10 @@ def set_fontstyle(self, fontstyle):
1000
1055
Parameters
1001
1056
----------
1002
1057
fontstyle : {'normal', 'italic', 'oblique'}
1058
+
1059
+ See Also
1060
+ --------
1061
+ .font_manager.FontProperties.set_style
1003
1062
"""
1004
1063
self ._fontproperties .set_style (fontstyle )
1005
1064
self .stale = True
@@ -1013,6 +1072,10 @@ def set_fontsize(self, fontsize):
1013
1072
----------
1014
1073
fontsize : {size in points, 'xx-small', 'x-small', 'small', 'medium', \
1015
1074
'large', 'x-large', 'xx-large'}
1075
+
1076
+ See Also
1077
+ --------
1078
+ .font_manager.FontProperties.set_size
1016
1079
"""
1017
1080
self ._fontproperties .set_size (fontsize )
1018
1081
self .stale = True
@@ -1026,6 +1089,10 @@ def set_fontweight(self, weight):
1026
1089
weight : {a numeric value in range 0-1000, 'ultralight', 'light', \
1027
1090
'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', \
1028
1091
'demi', 'bold', 'heavy', 'extra bold', 'black'}
1092
+
1093
+ See Also
1094
+ --------
1095
+ .font_manager.FontProperties.set_weight
1029
1096
"""
1030
1097
self ._fontproperties .set_weight (weight )
1031
1098
self .stale = True
@@ -1039,6 +1106,10 @@ def set_fontstretch(self, stretch):
1039
1106
stretch : {a numeric value in range 0-1000, 'ultra-condensed', \
1040
1107
'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', \
1041
1108
'expanded', 'extra-expanded', 'ultra-expanded'}
1109
+
1110
+ See Also
1111
+ --------
1112
+ .font_manager.FontProperties.set_stretch
1042
1113
"""
1043
1114
self ._fontproperties .set_stretch (stretch )
1044
1115
self .stale = True
@@ -1144,12 +1215,11 @@ def is_math_text(s, usetex=None):
1144
1215
1145
1216
def set_fontproperties (self , fp ):
1146
1217
"""
1147
- Set the font properties that control the text. *fp* must be a
1148
- :class:`matplotlib.font_manager.FontProperties` object.
1218
+ Set the font properties that control the text.
1149
1219
1150
1220
Parameters
1151
1221
----------
1152
- fp : matplotlib .font_manager.FontProperties
1222
+ fp : ` .font_manager.FontProperties`
1153
1223
"""
1154
1224
if isinstance (fp , str ):
1155
1225
fp = FontProperties (fp )
@@ -1184,9 +1254,19 @@ def get_usetex(self):
1184
1254
1185
1255
def set_fontname (self , fontname ):
1186
1256
"""
1187
- alias for set_family
1257
+ alias for `. set_family`
1188
1258
1189
1259
One-way alias only: the getter differs.
1260
+
1261
+ Parameters
1262
+ ----------
1263
+ fontname : {FONTNAME, 'serif', 'sans-serif', 'cursive', 'fantasy', \
1264
+ 'monospace'}
1265
+
1266
+ See Also
1267
+ --------
1268
+ .font_manager.FontProperties.set_family
1269
+
1190
1270
"""
1191
1271
return self .set_family (fontname )
1192
1272
0 commit comments