|
From: <jd...@us...> - 2008-10-19 19:52:50
|
Revision: 6278
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6278&view=rev
Author: jdh2358
Date: 2008-10-19 19:52:38 +0000 (Sun, 19 Oct 2008)
Log Message:
-----------
fixed np clip bug and some other cleanup
Modified Paths:
--------------
trunk/matplotlib/doc/sphinxext/plot_directive.py
trunk/matplotlib/examples/animation/simple_anim_tkagg.py
trunk/matplotlib/examples/pylab_examples/masked_demo.py
trunk/matplotlib/lib/matplotlib/colors.py
Modified: trunk/matplotlib/doc/sphinxext/plot_directive.py
===================================================================
--- trunk/matplotlib/doc/sphinxext/plot_directive.py 2008-10-19 09:35:03 UTC (rev 6277)
+++ trunk/matplotlib/doc/sphinxext/plot_directive.py 2008-10-19 19:52:38 UTC (rev 6278)
@@ -24,7 +24,7 @@
align = Image.align
import matplotlib
-
+import matplotlib.cbook as cbook
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib import _pylab_helpers
@@ -148,7 +148,8 @@
try:
runfile(fullpath)
except:
- warnings.warn("Exception running plot %s" % fullpath)
+ s = cbook.exception_to_str("Exception running plot %s" % fullpath)
+ warnings.warn(s)
return 0
fig_managers = _pylab_helpers.Gcf.get_all_fig_managers()
@@ -162,7 +163,8 @@
try:
figman.canvas.figure.savefig(outpath, dpi=dpi)
except:
- warnings.warn("Exception running plot %s" % fullpath)
+ s = cbook.exception_to_str("Exception running plot %s" % fullpath)
+ warnings.warn(s)
return 0
return len(fig_managers)
@@ -171,7 +173,7 @@
reference = directives.uri(arguments[0])
basedir, fname = os.path.split(reference)
basename, ext = os.path.splitext(fname)
-
+ #print 'plotdir', reference, basename, ext
destdir = ('../' * reference.count('/')) + 'pyplots'
num_figs = makefig(reference, 'pyplots')
Modified: trunk/matplotlib/examples/animation/simple_anim_tkagg.py
===================================================================
--- trunk/matplotlib/examples/animation/simple_anim_tkagg.py 2008-10-19 09:35:03 UTC (rev 6277)
+++ trunk/matplotlib/examples/animation/simple_anim_tkagg.py 2008-10-19 19:52:38 UTC (rev 6278)
@@ -2,6 +2,8 @@
"""
A simple example of an animated plot in tkagg
"""
+import time
+import numpy as np
import matplotlib
matplotlib.use('TkAgg') # do this before importing pylab
Modified: trunk/matplotlib/examples/pylab_examples/masked_demo.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/masked_demo.py 2008-10-19 09:35:03 UTC (rev 6277)
+++ trunk/matplotlib/examples/pylab_examples/masked_demo.py 2008-10-19 19:52:38 UTC (rev 6278)
@@ -1,4 +1,4 @@
-#!/bin/env python
+#!/usr/bin/env python
'''
Plot lines with points masked out.
Modified: trunk/matplotlib/lib/matplotlib/colors.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/colors.py 2008-10-19 09:35:03 UTC (rev 6277)
+++ trunk/matplotlib/lib/matplotlib/colors.py 2008-10-19 19:52:38 UTC (rev 6278)
@@ -38,6 +38,11 @@
from numpy import ma
import matplotlib.cbook as cbook
+parts = np.__version__.split('.')
+NP_MAJOR, NP_MINOR = map(int, parts[:2])
+# true if clip supports the out kwarg
+NP_CLIP_OUT = NP_MAJOR>=1 and NP_MINOR>=2
+
cnames = {
'aliceblue' : '#F0F8FF',
'antiquewhite' : '#FAEBD7',
@@ -457,7 +462,11 @@
np.putmask(xa, xa==1.0, 0.9999999) #Treat 1.0 as slightly less than 1.
# The following clip is fast, and prevents possible
# conversion of large positive values to negative integers.
- np.clip(xa * self.N, -1, self.N, out=xa)
+
+ if NP_CLIP_OUT:
+ np.clip(xa * self.N, -1, self.N, out=xa)
+ else:
+ xa = np.clip(xa * self.N, -1, self.N)
xa = xa.astype(int)
# Set the over-range indices before the under-range;
# otherwise the under-range values get converted to over-range.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|