44from __future__ import division
55import re
66from matplotlib import verbose
7+ from matplotlib import cbook
78import matplotlib
89import math
910from artist import Artist
@@ -89,29 +90,10 @@ def get_rotation(rotation):
8990
9091_unit_box = lbwh_to_bbox (0 ,0 ,1 ,1 )
9192
92-
93- class Text (Artist ):
94- """
95- Handle storing and drawing of text in window or data coordinates
96-
97- """
98- # special case superscripting to speedup logplots
99- _rgxsuper = re .compile ('\$([\-+0-9]+)\^\{(-?[0-9]+)\}\$' )
100-
101- zorder = 3
102- def __init__ (self ,
103- x = 0 , y = 0 , text = '' ,
104- color = None , # defaults to rc params
105- verticalalignment = 'bottom' ,
106- horizontalalignment = 'left' ,
107- multialignment = None ,
108- fontproperties = None , # defaults to FontProperties()
109- rotation = None ,
110- ** kwargs
111- ):
112- """
113- Create a Text instance at x,y with string text. Valid kwargs are
114-
93+ # these are not available for the object inspector until after the
94+ # class is build so we define an initial set here for the init
95+ # function and they will be overridden after object defn
96+ artist .kwdocd ['Text' ] = """\
11597 alpha: float
11698 animated: [True | False]
11799 backgroundcolor: any matplotlib color
@@ -140,6 +122,30 @@ def __init__(self,
140122 x: float
141123 y: float
142124 zorder: any number
125+ """
126+
127+ class Text (Artist ):
128+ """
129+ Handle storing and drawing of text in window or data coordinates
130+
131+ """
132+ # special case superscripting to speedup logplots
133+ _rgxsuper = re .compile ('\$([\-+0-9]+)\^\{(-?[0-9]+)\}\$' )
134+
135+ zorder = 3
136+ def __init__ (self ,
137+ x = 0 , y = 0 , text = '' ,
138+ color = None , # defaults to rc params
139+ verticalalignment = 'bottom' ,
140+ horizontalalignment = 'left' ,
141+ multialignment = None ,
142+ fontproperties = None , # defaults to FontProperties()
143+ rotation = None ,
144+ ** kwargs
145+ ):
146+ """
147+ Create a Text instance at x,y with string text. Valid kwargs are
148+ %(Text)s
143149 """
144150
145151 Artist .__init__ (self )
@@ -160,6 +166,7 @@ def __init__(self,
160166 self ._renderer = None
161167 self .update (kwargs )
162168 #self.set_bbox(dict(pad=0))
169+ __init__ .__doc__ = cbook .dedent (__init__ .__doc__ ) % artist .kwdocd
163170
164171
165172 def pick (self , mouseevent ):
@@ -1595,7 +1602,7 @@ def __init__(self, s, xy,
15951602 annotated. If d is the distance between the text and
15961603 annotated point, shrink will shorten the arrow so the tip
15971604 and base are shink percent of the distance d away from the
1598- endpoints. ie, shrink=0.05 is 5%
1605+ endpoints. ie, shrink=0.05 is 5%%
15991606 - any key for matplotlib.patches.polygon
16001607
16011608 xycoords and textcoords are a string that indicates the
@@ -1621,6 +1628,9 @@ def __init__(self, s, xy,
16211628 # 5 points below the top border
16221629 xy=(10,-5), xycoords='axes points'
16231630
1631+ Additional kwargs are Text properties:
1632+
1633+ %(Text)s
16241634
16251635 """
16261636 if xytext is None :
@@ -1635,6 +1645,7 @@ def __init__(self, s, xy,
16351645 self .arrow = None
16361646 self .xycoords = xycoords
16371647 self .textcoords = textcoords
1648+ __init__ .__doc__ = cbook .dedent (__init__ .__doc__ ) % artist .kwdocd
16381649
16391650 def _get_xy (self , x , y , s ):
16401651 if s == 'data' :
0 commit comments