|
From: <jd...@us...> - 2008-01-31 17:47:04
|
Revision: 4913
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4913&view=rev
Author: jdh2358
Date: 2008-01-31 09:46:56 -0800 (Thu, 31 Jan 2008)
Log Message:
-----------
fixed a bug where annotations w/ arrows were not getting the figure instance set properly
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/lines.py
trunk/matplotlib/lib/matplotlib/mlab.py
trunk/matplotlib/lib/matplotlib/rcsetup.py
trunk/matplotlib/lib/matplotlib/text.py
Modified: trunk/matplotlib/lib/matplotlib/lines.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/lines.py 2008-01-31 15:28:29 UTC (rev 4912)
+++ trunk/matplotlib/lib/matplotlib/lines.py 2008-01-31 17:46:56 UTC (rev 4913)
@@ -169,12 +169,14 @@
def __str__(self):
if self._label != "":
return "Line2D(%s)"%(self._label)
- elif len(self._x) > 3:
+ elif hasattr(self, '_x') and len(self._x) > 3:
return "Line2D((%g,%g),(%g,%g),...,(%g,%g))"\
%(self._x[0],self._y[0],self._x[0],self._y[0],self._x[-1],self._y[-1])
- else:
+ elif hasattr(self, '_x'):
return "Line2D(%s)"\
%(",".join(["(%g,%g)"%(x,y) for x,y in zip(self._x,self._y)]))
+ else:
+ return "Line2D()"
def __init__(self, xdata, ydata,
linewidth = None, # all Nones default to rc
Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mlab.py 2008-01-31 15:28:29 UTC (rev 4912)
+++ trunk/matplotlib/lib/matplotlib/mlab.py 2008-01-31 17:46:56 UTC (rev 4913)
@@ -84,7 +84,7 @@
"""
from __future__ import division
-import csv, warnings
+import csv, warnings, copy
import numpy as npy
@@ -2186,7 +2186,12 @@
# Get header and remove invalid characters
needheader = names is None
if needheader:
- headers = reader.next()
+ for row in reader:
+ if len(row) and row[0].startswith(comments):
+ continue
+ headers = row
+ break
+
# remove these chars
delete = set("""~!@#$%^&*()-=+~\|]}[{';: /?.>,<""")
delete.add('"')
Modified: trunk/matplotlib/lib/matplotlib/rcsetup.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/rcsetup.py 2008-01-31 15:28:29 UTC (rev 4912)
+++ trunk/matplotlib/lib/matplotlib/rcsetup.py 2008-01-31 17:46:56 UTC (rev 4913)
@@ -425,12 +425,12 @@
'figure.facecolor' : [ '0.75', validate_color], # facecolor; scalar gray
'figure.edgecolor' : [ 'w', validate_color], # edgecolor; white
- 'figure.subplot.left' : [0.125, ValidateInterval(0, 1, closedmin=False, closedmax=False)],
- 'figure.subplot.right' : [0.9, ValidateInterval(0, 1, closedmin=False, closedmax=False)],
- 'figure.subplot.bottom' : [0.1, ValidateInterval(0, 1, closedmin=False, closedmax=False)],
- 'figure.subplot.top' : [0.9, ValidateInterval(0, 1, closedmin=False, closedmax=False)],
- 'figure.subplot.wspace' : [0.2, ValidateInterval(0, 1, closedmin=False, closedmax=True)],
- 'figure.subplot.hspace' : [0.2, ValidateInterval(0, 1, closedmin=False, closedmax=True)],
+ 'figure.subplot.left' : [0.125, ValidateInterval(0, 1, closedmin=True, closedmax=True)],
+ 'figure.subplot.right' : [0.9, ValidateInterval(0, 1, closedmin=True, closedmax=True)],
+ 'figure.subplot.bottom' : [0.1, ValidateInterval(0, 1, closedmin=True, closedmax=True)],
+ 'figure.subplot.top' : [0.9, ValidateInterval(0, 1, closedmin=True, closedmax=True)],
+ 'figure.subplot.wspace' : [0.2, ValidateInterval(0, 1, closedmin=True, closedmax=False)],
+ 'figure.subplot.hspace' : [0.2, ValidateInterval(0, 1, closedmin=True, closedmax=False)],
'figure.autolayout' : [False, validate_bool],
Modified: trunk/matplotlib/lib/matplotlib/text.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/text.py 2008-01-31 15:28:29 UTC (rev 4912)
+++ trunk/matplotlib/lib/matplotlib/text.py 2008-01-31 17:46:56 UTC (rev 4913)
@@ -1052,6 +1052,12 @@
return t,tinfo
+ def set_figure(self, fig):
+
+ if self.arrow is not None:
+ self.arrow.set_figure(fig)
+ Artist.set_figure(self, fig)
+
def set_clip_box(self, clipbox):
"""
Set the artist's clip Bbox
@@ -1204,6 +1210,8 @@
self.update_positions(renderer)
if self.arrow is not None:
+ if self.arrow.figure is None and self.figure is not None:
+ self.arrow.figure = self.figure
self.arrow.draw(renderer)
Text.draw(self, renderer)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|