From: <pki...@us...> - 2008-07-26 19:19:37
|
Revision: 5889 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5889&view=rev Author: pkienzle Date: 2008-07-26 19:19:35 +0000 (Sat, 26 Jul 2008) Log Message: ----------- support unicode when printing Text artist with str(artist) Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/text.py Modified: trunk/matplotlib/lib/matplotlib/text.py =================================================================== --- trunk/matplotlib/lib/matplotlib/text.py 2008-07-26 19:17:05 UTC (rev 5888) +++ trunk/matplotlib/lib/matplotlib/text.py 2008-07-26 19:19:35 UTC (rev 5889) @@ -83,7 +83,7 @@ """ zorder = 3 def __str__(self): - return "Text(%g,%g,%s)"%(self._y,self._y,self._text) + return "Text(%g,%g,%s)"%(self._y,self._y,repr(self._text)) def __init__(self, x=0, y=0, text='', @@ -135,7 +135,7 @@ """ if callable(self._contains): return self._contains(self,mouseevent) - if not self.get_visible() or self._renderer is None: + if not self.get_visible() or self._renderer is None: return False,{} l,b,w,h = self.get_window_extent().bounds @@ -703,7 +703,7 @@ __name__ = 'textwithdash' def __str__(self): - return "TextWithDash(%g,%g,%s)"%(self._x,self._y,self._text) + return "TextWithDash(%g,%g,%s)"%(self._x,self._y,repr(self._text)) def __init__(self, x=0, y=0, text='', color=None, # defaults to rc params @@ -986,7 +986,7 @@ :class:`~matplotlib.patches.Rectangle`, etc., easier. """ def __str__(self): - return "Annotation(%g,%g,%s)"%(self.xy[0],self.xy[1],self._text) + return "Annotation(%g,%g,%s)"%(self.xy[0],self.xy[1],repr(self._text)) def __init__(self, s, xy, xytext=None, xycoords='data', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-08-05 17:25:15
|
Revision: 5974 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5974&view=rev Author: mdboom Date: 2008-08-05 17:25:12 +0000 (Tue, 05 Aug 2008) Log Message: ----------- [ 2031308 ] FontProperties and Latex code (FontProperties should be copied into the text instance so they can be re-used without side effects) Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/text.py Modified: trunk/matplotlib/lib/matplotlib/text.py =================================================================== --- trunk/matplotlib/lib/matplotlib/text.py 2008-08-04 18:43:08 UTC (rev 5973) +++ trunk/matplotlib/lib/matplotlib/text.py 2008-08-05 17:25:12 UTC (rev 5974) @@ -647,7 +647,7 @@ """ if is_string_like(fp): fp = FontProperties(fp) - self._fontproperties = fp + self._fontproperties = fp.copy() artist.kwdocd['Text'] = artist.kwdoc(Text) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2008-09-29 07:06:41
|
Revision: 6133 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6133&view=rev Author: efiring Date: 2008-09-29 07:06:28 +0000 (Mon, 29 Sep 2008) Log Message: ----------- Add dpi kwarg and docstring to Text.get_window_extent() Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/text.py Modified: trunk/matplotlib/lib/matplotlib/text.py =================================================================== --- trunk/matplotlib/lib/matplotlib/text.py 2008-09-28 22:05:23 UTC (rev 6132) +++ trunk/matplotlib/lib/matplotlib/text.py 2008-09-29 07:06:28 UTC (rev 6133) @@ -166,7 +166,7 @@ self._rotation = rotation self._fontproperties = fontproperties self._bbox = None - self._bbox_patch = None # a FanceBboxPatch instance + self._bbox_patch = None # a FancyBboxPatch instance self._renderer = None if linespacing is None: linespacing = 1.2 # Maybe use rcParam later. @@ -356,7 +356,7 @@ def get_bbox_patch(self): """ - Retrun the bbox Patch object. Returns None if the the + Return the bbox Patch object. Returns None if the the FancyBboxPatch is not made. """ return self._bbox_patch @@ -519,9 +519,32 @@ "Return the vertical alignment as string" return self._verticalalignment - def get_window_extent(self, renderer=None): + def get_window_extent(self, renderer=None, dpi=None): + ''' + Return a Bbox bounding the text, in display units (dots). + + In addition to being used internally, + this is useful for specifying clickable regions in + a png file on a web page. + + *renderer* defaults to the _renderer attribute of the + text object. This is not assigned until the first execution + of the draw() method, so you must use this kwarg if you + want to call get_window_extent() prior to the first draw(). + For getting web page regions, it is simpler to call the + method after saving the figure. + + *dpi* defaults to self.figure.dpi; the renderer dpi is + irrelevant. For the web application, if figure.dpi is not + the value used when saving the figure, then the value that + was used must be specified as the *dpi* argument. + + ''' #return _unit_box if not self.get_visible(): return Bbox.unit() + if dpi is not None: + dpi_orig = self.figure.dpi + self.figure.dpi = dpi if self._text == '': tx, ty = self._get_xy_display() return Bbox.from_bounds(tx,ty,0,0) @@ -531,11 +554,12 @@ if self._renderer is None: raise RuntimeError('Cannot get window extent w/o renderer') - angle = self.get_rotation() bbox, info = self._get_layout(self._renderer) x, y = self.get_position() x, y = self.get_transform().transform_point((x, y)) bbox = bbox.translated(x, y) + if dpi is not None: + self.figure.dpi = dpi_orig return bbox def set_backgroundcolor(self, color): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2008-11-23 19:18:29
|
Revision: 6436 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6436&view=rev Author: jdh2358 Date: 2008-11-23 19:18:24 +0000 (Sun, 23 Nov 2008) Log Message: ----------- fixed text docstring Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/text.py Modified: trunk/matplotlib/lib/matplotlib/text.py =================================================================== --- trunk/matplotlib/lib/matplotlib/text.py 2008-11-23 19:16:40 UTC (rev 6435) +++ trunk/matplotlib/lib/matplotlib/text.py 2008-11-23 19:18:24 UTC (rev 6436) @@ -375,7 +375,7 @@ if not isinstance(self.arrow_patch, FancyArrowPatch): return - + if self._bbox_patch: trans = self.get_transform() @@ -1295,8 +1295,8 @@ instance is created with the given dictionary and is drawn. Otherwise, a YAArow patch instance is created and drawn. Valid keys for YAArow are - + ========= =========================================================== Key Description ========= =========================================================== @@ -1314,10 +1314,10 @@ Valid keys for FancyArrowPatch are - + =============== ====================================================== - Key Description + Key Description =============== ====================================================== arrowstyle connectionstyle @@ -1383,7 +1383,7 @@ self.arrowprops = arrowprops self.arrow = None - + if arrowprops and arrowprops.has_key("arrowstyle"): self._arrow_relpos = arrowprops.pop("relpos", (0.5, 0.5)) @@ -1392,7 +1392,7 @@ else: self.arrow_patch = None - + __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd def contains(self,event): @@ -1402,7 +1402,7 @@ t = t or a # self.arrow_patch is currently not checked as this can be a line - JJ - + return t,tinfo @@ -1551,7 +1551,7 @@ # Then it will be shrinked by shirnkA and shrinkB # (in points). If patch A is not set, self.bbox_patch # is used. - + self.arrow_patch.set_positions((ox0, oy0), (ox1,oy1)) mutation_scale = d.pop("mutation_scale", self.get_size()) self.arrow_patch.set_mutation_scale(mutation_scale) @@ -1562,7 +1562,7 @@ else: patchA = d.pop("patchA", self._bbox) self.arrow_patch.set_patchA(patchA) - + else: # pick the x,y corner of the text bbox closest to point This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2010-04-28 19:50:45
|
Revision: 8285 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8285&view=rev Author: mdboom Date: 2010-04-28 19:50:39 +0000 (Wed, 28 Apr 2010) Log Message: ----------- Remove extraneous debug print. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/text.py Modified: trunk/matplotlib/lib/matplotlib/text.py =================================================================== --- trunk/matplotlib/lib/matplotlib/text.py 2010-04-28 19:50:11 UTC (rev 8284) +++ trunk/matplotlib/lib/matplotlib/text.py 2010-04-28 19:50:39 UTC (rev 8285) @@ -1942,7 +1942,6 @@ if self._bbox_patch: posx, posy = self._x, self._y - print posx, posy x_box, y_box, w_box, h_box = _get_textbox(self, renderer) self._bbox_patch.set_bounds(0., 0., This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lee...@us...> - 2010-05-18 17:14:53
|
Revision: 8319 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8319&view=rev Author: leejjoon Date: 2010-05-18 17:14:45 +0000 (Tue, 18 May 2010) Log Message: ----------- fix a bug in AnnotationBase._get_ref_xy Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/text.py Modified: trunk/matplotlib/lib/matplotlib/text.py =================================================================== --- trunk/matplotlib/lib/matplotlib/text.py 2010-05-18 17:14:40 UTC (rev 8318) +++ trunk/matplotlib/lib/matplotlib/text.py 2010-05-18 17:14:45 UTC (rev 8319) @@ -1527,7 +1527,8 @@ if isinstance(self.xycoords, tuple): s1, s2 = self.xycoords - if s1.split()[0] == "offset" or s2.split()[0] == "offset": + if (is_string_like(s1) and s1.split()[0] == "offset") \ + or (is_string_like(s2) and s2.split()[0] == "offset"): raise ValueError("xycoords should not be an offset coordinate") x, y = self.xy x1, y1 = self._get_xy(renderer, x, y, s1) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lee...@us...> - 2010-12-29 03:00:42
|
Revision: 8848 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8848&view=rev Author: leejjoon Date: 2010-12-29 03:00:36 +0000 (Wed, 29 Dec 2010) Log Message: ----------- fix Text.get_font_properties Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/text.py Modified: trunk/matplotlib/lib/matplotlib/text.py =================================================================== --- trunk/matplotlib/lib/matplotlib/text.py 2010-12-29 02:54:58 UTC (rev 8847) +++ trunk/matplotlib/lib/matplotlib/text.py 2010-12-29 03:00:36 UTC (rev 8848) @@ -603,7 +603,7 @@ def get_font_properties(self): 'alias for get_fontproperties' - return self.get_fontproperties + return self.get_fontproperties() def get_family(self): "Return the list of font families used for font lookup" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |