← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2551: 1. Do not enable draggable legent if not supported by matplotlib (thansk, buildbot)

 

------------------------------------------------------------
revno: 2551
committer: Václav Šmilauer <eu@xxxxxxxx>
branch nick: trunk
timestamp: Mon 2010-11-15 17:49:59 +0100
message:
  1. Do not enable draggable legent if not supported by matplotlib (thansk, buildbot)
modified:
  py/plot.py


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription
=== modified file 'py/plot.py'
--- py/plot.py	2010-11-15 16:31:43 +0000
+++ py/plot.py	2010-11-15 16:49:59 +0000
@@ -182,7 +182,7 @@
 			currLineRefs.append(LineRef(line,scatter,data[pStrip],data[d[0]]))
 		# create the legend
 		l=pylab.legend([xlateLabel(_p[0]) for _p in plots_p_y1],loc=('upper left' if len(plots_p_y2)>0 else 'best'))
-		l.draggable(True)
+		if hasattr(l,'draggable'): l.draggable(True)
 		pylab.ylabel((', '.join([xlateLabel(_p[0]) for _p in plots_p_y1])) if p not in xylabels or not xylabels[p][1] else xylabels[p][1])
 		pylab.xlabel(xlateLabel(pStrip) if (p not in xylabels or not xylabels[p][0]) else xylabels[p][0])
 		if scientific: pylab.ticklabel_format(style='sci',scilimits=(0,0),axis='both')
@@ -202,7 +202,7 @@
 				currLineRefs.append(LineRef(line,scatter,data[pStrip],data[d[0]]))
 			# legend
 			l=pylab.legend([xlateLabel(_p[0]) for _p in plots_p_y2],loc='upper right')
-			l.draggable(True)
+			if hasattr(l,'draggable'): l.draggable(True)
 			pylab.rcParams['lines.color']=origLinesColor
 			pylab.ylabel((', '.join([xlateLabel(_p[0]) for _p in plots_p_y2])) if p not in xylabels or len(xylabels[p])<3 or not xylabels[p][2] else xylabels[p][2])
 			## should be repeated for y2 axis, but in that case the 10^.. label goes to y1 axis (bug in matplotlib, it seems)