From: <jd...@us...> - 2008-05-16 22:47:05
|
Revision: 5165 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5165&view=rev Author: jdh2358 Date: 2008-05-16 15:47:00 -0700 (Fri, 16 May 2008) Log Message: ----------- backend driver fix Modified Paths: -------------- trunk/matplotlib/Makefile trunk/matplotlib/examples/pylab/agg_buffer_to_array.py trunk/matplotlib/examples/pylab/annotation_demo.py trunk/matplotlib/examples/pylab/clippedline.py trunk/matplotlib/examples/pylab/colours.py trunk/matplotlib/examples/pylab/contourf_log.py trunk/matplotlib/examples/pylab/custom_projection_example.py trunk/matplotlib/examples/pylab/custom_scale_example.py trunk/matplotlib/examples/pylab/data_browser.py trunk/matplotlib/examples/pylab/fill_between.py trunk/matplotlib/examples/pylab/geo_demo.py trunk/matplotlib/examples/pylab/lineprops_dialog_gtk.py trunk/matplotlib/examples/pylab/mathtext_demo.py trunk/matplotlib/examples/pylab/pcolor_nonuniform.py trunk/matplotlib/examples/pylab/polar_bar.py trunk/matplotlib/examples/pylab/polar_demo.py trunk/matplotlib/examples/pylab/polar_legend.py trunk/matplotlib/examples/pylab/quadmesh_demo.py trunk/matplotlib/examples/pylab/step_demo.py trunk/matplotlib/examples/pylab/strip_chart_demo.py trunk/matplotlib/examples/pylab/symlog_demo.py trunk/matplotlib/examples/pylab/webapp_demo.py trunk/matplotlib/examples/tests/backend_driver.py Modified: trunk/matplotlib/Makefile =================================================================== --- trunk/matplotlib/Makefile 2008-05-16 22:26:15 UTC (rev 5164) +++ trunk/matplotlib/Makefile 2008-05-16 22:47:00 UTC (rev 5165) @@ -15,7 +15,6 @@ rm -f *.png *.ps *.eps *.svg *.jpg *.pdf find . -name "_tmp*.py" | xargs rm -f;\ find . \( -name "*~" -o -name "*.pyc" \) | xargs rm -f;\ - find examples \( -name "*.svg" C-o -name "*.png" -o -name "*.pdf" -o -name "*.ps" -o -name "*.eps" -o -name "*.tar" -o -name "*.gz" -o -name "*.log" -o -name "*.aux" -o -name "*.tex" \) | xargs rm -f find unit \( -name "*.png" -o -name "*.ps" -o -name "*.pdf" -o -name "*.eps" \) | xargs rm -f find . \( -name "#*" -o -name ".#*" -o -name ".*~" -o -name "*~" \) | xargs rm -f Modified: trunk/matplotlib/examples/pylab/agg_buffer_to_array.py =================================================================== --- trunk/matplotlib/examples/pylab/agg_buffer_to_array.py 2008-05-16 22:26:15 UTC (rev 5164) +++ trunk/matplotlib/examples/pylab/agg_buffer_to_array.py 2008-05-16 22:47:00 UTC (rev 5165) @@ -1,7 +1,7 @@ import matplotlib matplotlib.use('Agg') from pylab import figure, show -import numpy as npy +import numpy as np # make an agg figure fig = figure() @@ -13,7 +13,7 @@ # grab rhe pixel buffer and dumpy it into a numpy array buf = fig.canvas.buffer_rgba(0,0) l, b, w, h = fig.bbox.bounds -X = npy.fromstring(buf, npy.uint8) +X = np.fromstring(buf, np.uint8) X.shape = h,w,4 # now display the array X as an Axes in a new figure Modified: trunk/matplotlib/examples/pylab/annotation_demo.py =================================================================== --- trunk/matplotlib/examples/pylab/annotation_demo.py 2008-05-16 22:26:15 UTC (rev 5164) +++ trunk/matplotlib/examples/pylab/annotation_demo.py 2008-05-16 22:47:00 UTC (rev 5165) @@ -35,7 +35,7 @@ from matplotlib.pyplot import figure, show from matplotlib.patches import Ellipse -import numpy as npy +import numpy as np if 1: @@ -44,8 +44,8 @@ fig = figure() ax = fig.add_subplot(111, autoscale_on=False, xlim=(-1,5), ylim=(-3,5)) - t = npy.arange(0.0, 5.0, 0.01) - s = npy.cos(2*npy.pi*t) + t = np.arange(0.0, 5.0, 0.01) + s = np.cos(2*np.pi*t) line, = ax.plot(t, s, lw=3, color='purple') ax.annotate('axes center', xy=(.5, .5), xycoords='axes fraction', @@ -94,8 +94,8 @@ # respected fig = figure() ax = fig.add_subplot(111, polar=True) - r = npy.arange(0,1,0.001) - theta = 2*2*npy.pi*r + r = np.arange(0,1,0.001) + theta = 2*2*np.pi*r line, = ax.plot(theta, r, color='#ee8d18', lw=3) ind = 800 @@ -124,8 +124,8 @@ ax.add_artist(el) el.set_clip_box(ax.bbox) ax.annotate('the top', - xy=(npy.pi/2., 10.), # theta, radius - xytext=(npy.pi/3, 20.), # theta, radius + xy=(np.pi/2., 10.), # theta, radius + xytext=(np.pi/3, 20.), # theta, radius xycoords='polar', textcoords='polar', arrowprops=dict(facecolor='black', shrink=0.05), Modified: trunk/matplotlib/examples/pylab/clippedline.py =================================================================== --- trunk/matplotlib/examples/pylab/clippedline.py 2008-05-16 22:26:15 UTC (rev 5164) +++ trunk/matplotlib/examples/pylab/clippedline.py 2008-05-16 22:47:00 UTC (rev 5165) @@ -4,7 +4,7 @@ """ from matplotlib.lines import Line2D -import numpy as npy +import numpy as np from pylab import figure, show class ClippedLine(Line2D): @@ -19,13 +19,13 @@ def set_data(self, *args, **kwargs): Line2D.set_data(self, *args, **kwargs) - self.xorig = npy.array(self._x) - self.yorig = npy.array(self._y) + self.xorig = np.array(self._x) + self.yorig = np.array(self._y) def draw(self, renderer): xlim = self.ax.get_xlim() - ind0, ind1 = npy.searchsorted(self.xorig, xlim) + ind0, ind1 = np.searchsorted(self.xorig, xlim) self._x = self.xorig[ind0:ind1] self._y = self.yorig[ind0:ind1] N = len(self._x) @@ -43,8 +43,8 @@ fig = figure() ax = fig.add_subplot(111, autoscale_on=False) -t = npy.arange(0.0, 100.0, 0.01) -s = npy.sin(2*npy.pi*t) +t = np.arange(0.0, 100.0, 0.01) +s = np.sin(2*np.pi*t) line = ClippedLine(ax, t, s, color='g', ls='-', lw=2) ax.add_line(line) ax.set_xlim(10,30) Modified: trunk/matplotlib/examples/pylab/colours.py =================================================================== --- trunk/matplotlib/examples/pylab/colours.py 2008-05-16 22:26:15 UTC (rev 5164) +++ trunk/matplotlib/examples/pylab/colours.py 2008-05-16 22:47:00 UTC (rev 5165) @@ -2,12 +2,12 @@ """ Some simple functions to generate colours. """ -import numpy as npy +import numpy as np from matplotlib.colors import colorConverter def pastel(colour, weight=2.4): """ Convert colour into a nice pastel shade""" - rgb = npy.asarray(colorConverter.to_rgb(colour)) + rgb = np.asarray(colorConverter.to_rgb(colour)) # scale colour maxc = max(rgb) if maxc < 1.0 and maxc > 0: @@ -31,7 +31,7 @@ def get_colours(n): """ Return n pastel colours. """ - base = npy.asarray([[1,0,0], [0,1,0], [0,0,1]]) + base = np.asarray([[1,0,0], [0,1,0], [0,0,1]]) if n <= 3: return base[0:n] @@ -42,7 +42,7 @@ colours = [] for start in (0, 1): - for x in npy.linspace(0, 1, needed[start]+2): + for x in np.linspace(0, 1, needed[start]+2): colours.append((base[start] * (1.0 - x)) + (base[start+1] * x)) Modified: trunk/matplotlib/examples/pylab/contourf_log.py =================================================================== --- trunk/matplotlib/examples/pylab/contourf_log.py 2008-05-16 22:26:15 UTC (rev 5164) +++ trunk/matplotlib/examples/pylab/contourf_log.py 2008-05-16 22:47:00 UTC (rev 5165) @@ -3,16 +3,16 @@ ''' from matplotlib import pyplot as P -import numpy as npy +import numpy as np from numpy import ma from matplotlib import colors, ticker from matplotlib.mlab import bivariate_normal N = 100 -x = npy.linspace(-3.0, 3.0, N) -y = npy.linspace(-2.0, 2.0, N) +x = np.linspace(-3.0, 3.0, N) +y = np.linspace(-2.0, 2.0, N) -X, Y = npy.meshgrid(x, y) +X, Y = np.meshgrid(x, y) # A low hump with a spike coming out of the top right. # Needs to have z/colour axis on a log scale so we see both hump and spike. @@ -34,9 +34,9 @@ # Alternatively, you can manually set the levels # and the norm: -#lev_exp = npy.arange(npy.floor(npy.log10(z.min())-1), -# npy.ceil(npy.log10(z.max())+1)) -#levs = npy.power(10, lev_exp) +#lev_exp = np.arange(np.floor(np.log10(z.min())-1), +# np.ceil(np.log10(z.max())+1)) +#levs = np.power(10, lev_exp) #cs = P.contourf(X, Y, z, levs, norm=colors.LogNorm()) #The 'extend' kwarg does not work yet with a log scale. Modified: trunk/matplotlib/examples/pylab/custom_projection_example.py =================================================================== --- trunk/matplotlib/examples/pylab/custom_projection_example.py 2008-05-16 22:26:15 UTC (rev 5164) +++ trunk/matplotlib/examples/pylab/custom_projection_example.py 2008-05-16 22:47:00 UTC (rev 5165) @@ -7,7 +7,7 @@ BboxTransformTo, IdentityTransform, Transform, TransformWrapper from matplotlib.projections import register_projection -import numpy as npy +import numpy as np # This example projection class is rather long, but it is designed to # illustrate many features, not all of which will be used every time. @@ -60,8 +60,8 @@ # be changed by the user. This makes the math in the # transformation itself easier, and since this is a toy # example, the easier, the better. - Axes.set_xlim(self, -npy.pi, npy.pi) - Axes.set_ylim(self, -npy.pi / 2.0, npy.pi / 2.0) + Axes.set_xlim(self, -np.pi, np.pi) + Axes.set_ylim(self, -np.pi / 2.0, np.pi / 2.0) def cla(self): """ @@ -79,8 +79,8 @@ # self.grid(rcParams['axes.grid']) - Axes.set_xlim(self, -npy.pi, npy.pi) - Axes.set_ylim(self, -npy.pi / 2.0, npy.pi / 2.0) + Axes.set_xlim(self, -np.pi, np.pi) + Axes.set_ylim(self, -np.pi / 2.0, np.pi / 2.0) def _set_lim_and_transforms(self): """ @@ -117,8 +117,8 @@ # within the axes. The peculiar calculations of xscale and # yscale are specific to a Aitoff-Hammer projection, so don't # worry about them too much. - xscale = 2.0 * npy.sqrt(2.0) * npy.sin(0.5 * npy.pi) - yscale = npy.sqrt(2.0) * npy.sin(0.5 * npy.pi) + xscale = 2.0 * np.sqrt(2.0) * np.sin(0.5 * np.pi) + yscale = np.sqrt(2.0) * np.sin(0.5 * np.pi) self.transAffine = Affine2D() \ .scale(0.5 / xscale, 0.5 / yscale) \ .translate(0.5, 0.5) @@ -148,8 +148,8 @@ # pixels from the equator. self._xaxis_pretransform = \ Affine2D() \ - .scale(1.0, npy.pi) \ - .translate(0.0, -npy.pi) + .scale(1.0, np.pi) \ + .translate(0.0, -np.pi) self._xaxis_transform = \ self._xaxis_pretransform + \ self.transData @@ -168,7 +168,7 @@ # (1, ymax). The goal of these transforms is to go from that # space to display space. The tick labels will be offset 4 # pixels from the edge of the axes ellipse. - yaxis_stretch = Affine2D().scale(npy.pi * 2.0, 1.0).translate(-npy.pi, 0.0) + yaxis_stretch = Affine2D().scale(np.pi * 2.0, 1.0).translate(-np.pi, 0.0) yaxis_space = Affine2D().scale(1.0, 1.1) self._yaxis_transform = \ yaxis_stretch + \ @@ -265,8 +265,8 @@ # set_xlim and set_ylim to ignore any input. This also applies to # interactive panning and zooming in the GUI interfaces. def set_xlim(self, *args, **kwargs): - Axes.set_xlim(self, -npy.pi, npy.pi) - Axes.set_ylim(self, -npy.pi / 2.0, npy.pi / 2.0) + Axes.set_xlim(self, -np.pi, np.pi) + Axes.set_ylim(self, -np.pi / 2.0, np.pi / 2.0) set_ylim = set_xlim def format_coord(self, long, lat): @@ -276,8 +276,8 @@ In this case, we want them to be displayed in degrees N/S/E/W. """ - long = long * (180.0 / npy.pi) - lat = lat * (180.0 / npy.pi) + long = long * (180.0 / np.pi) + lat = lat * (180.0 / np.pi) if lat >= 0.0: ns = 'N' else: @@ -298,7 +298,7 @@ self._round_to = round_to def __call__(self, x, pos=None): - degrees = (x / npy.pi) * 180.0 + degrees = (x / np.pi) * 180.0 degrees = round(degrees / self._round_to) * self._round_to # \u00b0 : degree symbol return u"%d\u00b0" % degrees @@ -316,7 +316,7 @@ number = (360.0 / degrees) + 1 self.xaxis.set_major_locator( FixedLocator( - npy.linspace(-npy.pi, npy.pi, number, True)[1:-1])) + np.linspace(-np.pi, np.pi, number, True)[1:-1])) # Set the formatter to display the tick labels in degrees, # rather than radians. self.xaxis.set_major_formatter(self.DegreeFormatter(degrees)) @@ -334,7 +334,7 @@ number = (180.0 / degrees) + 1 self.yaxis.set_major_locator( FixedLocator( - npy.linspace(-npy.pi / 2.0, npy.pi / 2.0, number, True)[1:-1])) + np.linspace(-np.pi / 2.0, np.pi / 2.0, number, True)[1:-1])) # Set the formatter to display the tick labels in degrees, # rather than radians. self.yaxis.set_major_formatter(self.DegreeFormatter(degrees)) @@ -351,7 +351,7 @@ class -- it provides an interface to something that has no analogy in the base Axes class. """ - longitude_cap = degrees * (npy.pi / 180.0) + longitude_cap = degrees * (np.pi / 180.0) # Change the xaxis gridlines transform so that it draws from # -degrees to degrees, rather than -pi to pi. self._xaxis_pretransform \ @@ -412,13 +412,13 @@ # Pre-compute some values half_long = longitude / 2.0 - cos_latitude = npy.cos(latitude) - sqrt2 = npy.sqrt(2.0) + cos_latitude = np.cos(latitude) + sqrt2 = np.sqrt(2.0) - alpha = 1.0 + cos_latitude * npy.cos(half_long) - x = (2.0 * sqrt2) * (cos_latitude * npy.sin(half_long)) / alpha - y = (sqrt2 * npy.sin(latitude)) / alpha - return npy.concatenate((x, y), 1) + alpha = 1.0 + cos_latitude * np.cos(half_long) + x = (2.0 * sqrt2) * (cos_latitude * np.sin(half_long)) / alpha + y = (sqrt2 * np.sin(latitude)) / alpha + return np.concatenate((x, y), 1) # This is where things get interesting. With this projection, # straight lines in data space become curves in display space. @@ -451,10 +451,10 @@ quarter_x = 0.25 * x half_y = 0.5 * y - z = npy.sqrt(1.0 - quarter_x*quarter_x - half_y*half_y) - longitude = 2 * npy.arctan((z*x) / (2.0 * (2.0*z*z - 1.0))) - latitude = npy.arcsin(y*z) - return npy.concatenate((longitude, latitude), 1) + z = np.sqrt(1.0 - quarter_x*quarter_x - half_y*half_y) + longitude = 2 * np.arctan((z*x) / (2.0 * (2.0*z*z - 1.0))) + latitude = np.arcsin(y*z) + return np.concatenate((longitude, latitude), 1) transform.__doc__ = Transform.transform.__doc__ def inverted(self): Modified: trunk/matplotlib/examples/pylab/custom_scale_example.py =================================================================== --- trunk/matplotlib/examples/pylab/custom_scale_example.py 2008-05-16 22:26:15 UTC (rev 5164) +++ trunk/matplotlib/examples/pylab/custom_scale_example.py 2008-05-16 22:47:00 UTC (rev 5165) @@ -36,8 +36,8 @@ thresh: The degree above which to crop the data. """ mscale.ScaleBase.__init__(self) - thresh = kwargs.pop("thresh", (85 / 180.0) * npy.pi) - if thresh >= npy.pi / 2.0: + thresh = kwargs.pop("thresh", (85 / 180.0) * np.pi) + if thresh >= np.pi / 2.0: raise ValueError("thresh must be less than pi/2") self.thresh = thresh @@ -67,11 +67,11 @@ class DegreeFormatter(Formatter): def __call__(self, x, pos=None): # \u00b0 : degree symbol - return u"%d\u00b0" % ((x / npy.pi) * 180.0) + return u"%d\u00b0" % ((x / np.pi) * 180.0) - deg2rad = npy.pi / 180.0 + deg2rad = np.pi / 180.0 axis.set_major_locator(FixedLocator( - npy.arange(-90, 90, 10) * deg2rad)) + np.arange(-90, 90, 10) * deg2rad)) axis.set_major_formatter(DegreeFormatter()) axis.set_minor_formatter(DegreeFormatter()) @@ -118,9 +118,9 @@ """ masked = ma.masked_where((a < -self.thresh) | (a > self.thresh), a) if masked.mask.any(): - return ma.log(npy.abs(ma.tan(masked) + 1.0 / ma.cos(masked))) + return ma.log(np.abs(ma.tan(masked) + 1.0 / ma.cos(masked))) else: - return npy.log(npy.abs(npy.tan(a) + 1.0 / npy.cos(a))) + return np.log(np.abs(np.tan(a) + 1.0 / np.cos(a))) def inverted(self): """ @@ -139,7 +139,7 @@ self.thresh = thresh def transform(self, a): - return npy.arctan(npy.sinh(a)) + return np.arctan(np.sinh(a)) def inverted(self): return MercatorLatitudeScale.MercatorLatitudeTransform(self.thresh) @@ -149,10 +149,10 @@ mscale.register_scale(MercatorLatitudeScale) from pylab import * -import numpy as npy +import numpy as np t = arange(-180.0, 180.0, 0.1) -s = t / 360.0 * npy.pi +s = t / 360.0 * np.pi plot(t, s, '-', lw=2) gca().set_yscale('mercator') Modified: trunk/matplotlib/examples/pylab/data_browser.py =================================================================== --- trunk/matplotlib/examples/pylab/data_browser.py 2008-05-16 22:26:15 UTC (rev 5164) +++ trunk/matplotlib/examples/pylab/data_browser.py 2008-05-16 22:47:00 UTC (rev 5165) @@ -1,10 +1,10 @@ -import numpy as npy +import numpy as np from pylab import figure, show -X = npy.random.rand(100, 200) -xs = npy.mean(X, axis=1) -ys = npy.std(X, axis=1) +X = np.random.rand(100, 200) +xs = np.mean(X, axis=1) +ys = np.std(X, axis=1) fig = figure() ax = fig.add_subplot(211) @@ -25,18 +25,18 @@ transform=ax.transAxes, va='top') self.selected, = ax.plot([xs[0]], [ys[0]], 'o', ms=12, alpha=0.4, color='yellow', visible=False) - + def onpress(self, event): if self.lastind is None: return if event.key not in ('n', 'p'): return if event.key=='n': inc = 1 else: inc = -1 - + self.lastind += inc - self.lastind = npy.clip(self.lastind, 0, len(xs)-1) + self.lastind = np.clip(self.lastind, 0, len(xs)-1) self.update() - + def onpick(self, event): if event.artist!=line: return True @@ -49,7 +49,7 @@ y = event.mouseevent.ydata - distances = npy.hypot(x-xs[event.ind], y-ys[event.ind]) + distances = np.hypot(x-xs[event.ind], y-ys[event.ind]) indmin = distances.argmin() dataind = event.ind[indmin] Modified: trunk/matplotlib/examples/pylab/fill_between.py =================================================================== --- trunk/matplotlib/examples/pylab/fill_between.py 2008-05-16 22:26:15 UTC (rev 5164) +++ trunk/matplotlib/examples/pylab/fill_between.py 2008-05-16 22:47:00 UTC (rev 5165) @@ -1,11 +1,11 @@ #!/usr/bin/env python import matplotlib.mlab as mlab from pylab import figure, show -import numpy as npy +import numpy as np -x = npy.arange(0, 2, 0.01) -y1 = npy.sin(2*npy.pi*x) -y2 = npy.sin(4*npy.pi*x) + 2 +x = np.arange(0, 2, 0.01) +y1 = np.sin(2*np.pi*x) +y2 = np.sin(4*np.pi*x) + 2 fig = figure() ax = fig.add_subplot(311) Modified: trunk/matplotlib/examples/pylab/geo_demo.py =================================================================== --- trunk/matplotlib/examples/pylab/geo_demo.py 2008-05-16 22:26:15 UTC (rev 5164) +++ trunk/matplotlib/examples/pylab/geo_demo.py 2008-05-16 22:47:00 UTC (rev 5165) @@ -1,5 +1,5 @@ -import numpy as npy -npy.seterr("raise") +import numpy as np +np.seterr("raise") from pylab import * Modified: trunk/matplotlib/examples/pylab/lineprops_dialog_gtk.py =================================================================== --- trunk/matplotlib/examples/pylab/lineprops_dialog_gtk.py 2008-05-16 22:26:15 UTC (rev 5164) +++ trunk/matplotlib/examples/pylab/lineprops_dialog_gtk.py 2008-05-16 22:47:00 UTC (rev 5165) @@ -2,17 +2,17 @@ matplotlib.use('GTKAgg') from matplotlib.backends.backend_gtk import DialogLineprops -import numpy as npy +import numpy as np from pylab import figure, show def f(t): - s1 = npy.cos(2*npy.pi*t) - e1 = npy.exp(-t) - return npy.multiply(s1,e1) + s1 = np.cos(2*np.pi*t) + e1 = np.exp(-t) + return np.multiply(s1,e1) -t1 = npy.arange(0.0, 5.0, 0.1) -t2 = npy.arange(0.0, 5.0, 0.02) -t3 = npy.arange(0.0, 2.0, 0.01) +t1 = np.arange(0.0, 5.0, 0.1) +t2 = np.arange(0.0, 5.0, 0.02) +t3 = np.arange(0.0, 2.0, 0.01) fig = figure() ax = fig.add_subplot(111) Modified: trunk/matplotlib/examples/pylab/mathtext_demo.py =================================================================== --- trunk/matplotlib/examples/pylab/mathtext_demo.py 2008-05-16 22:26:15 UTC (rev 5164) +++ trunk/matplotlib/examples/pylab/mathtext_demo.py 2008-05-16 22:47:00 UTC (rev 5165) @@ -3,7 +3,7 @@ Use matplotlib's internal LaTex parser and layout engine. For true latex rendering, see the text.usetex option """ -import numpy as npy +import numpy as np from matplotlib.pyplot import figure, show fig = figure() @@ -11,7 +11,7 @@ ax = fig.add_subplot(111, axisbg='y') ax.plot([1,2,3], 'r') -x = npy.arange(0.0, 3.0, 0.1) +x = np.arange(0.0, 3.0, 0.1) ax.grid(True) ax.set_xlabel(r'$\Delta_i^j$', fontsize=20) Modified: trunk/matplotlib/examples/pylab/pcolor_nonuniform.py =================================================================== --- trunk/matplotlib/examples/pylab/pcolor_nonuniform.py 2008-05-16 22:26:15 UTC (rev 5164) +++ trunk/matplotlib/examples/pylab/pcolor_nonuniform.py 2008-05-16 22:47:00 UTC (rev 5165) @@ -1,11 +1,11 @@ from matplotlib.pyplot import figure, show -import numpy as npy +import numpy as np from matplotlib.image import NonUniformImage -x = npy.arange(-4, 4, 0.005) -y = npy.arange(-4, 4, 0.005) +x = np.arange(-4, 4, 0.005) +y = np.arange(-4, 4, 0.005) print 'Size %d points' % (len(x) * len(y)) -z = npy.sqrt(x[npy.newaxis,:]**2 + y[:,npy.newaxis]**2) +z = np.sqrt(x[np.newaxis,:]**2 + y[:,np.newaxis]**2) fig = figure() ax = fig.add_subplot(111) Modified: trunk/matplotlib/examples/pylab/polar_bar.py =================================================================== --- trunk/matplotlib/examples/pylab/polar_bar.py 2008-05-16 22:26:15 UTC (rev 5164) +++ trunk/matplotlib/examples/pylab/polar_bar.py 2008-05-16 22:47:00 UTC (rev 5165) @@ -1,6 +1,6 @@ #!/usr/bin/env python -import numpy as npy +import numpy as np import matplotlib.cm as cm from matplotlib.pyplot import figure, show, rc @@ -10,9 +10,9 @@ ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True) N = 20 -theta = npy.arange(0.0, 2*npy.pi, 2*npy.pi/N) -radii = 10*npy.random.rand(N) -width = npy.pi/4*npy.random.rand(N) +theta = np.arange(0.0, 2*np.pi, 2*np.pi/N) +radii = 10*np.random.rand(N) +width = np.pi/4*np.random.rand(N) bars = ax.bar(theta, radii, width=width, bottom=0.0) for r,bar in zip(radii, bars): bar.set_facecolor( cm.jet(r/10.)) Modified: trunk/matplotlib/examples/pylab/polar_demo.py =================================================================== --- trunk/matplotlib/examples/pylab/polar_demo.py 2008-05-16 22:26:15 UTC (rev 5164) +++ trunk/matplotlib/examples/pylab/polar_demo.py 2008-05-16 22:47:00 UTC (rev 5165) @@ -39,7 +39,7 @@ # See the pylab rgrids and thetagrids functions for # information on how to customize the grid locations and labels -import numpy as npy +import numpy as np from matplotlib.pyplot import figure, show, rc, grid # radar green, solid grid lines @@ -51,8 +51,8 @@ fig = figure(figsize=(8,8)) ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True, axisbg='#d5de9c') -r = npy.arange(0, 3.0, 0.01) -theta = 2*npy.pi*r +r = np.arange(0, 3.0, 0.01) +theta = 2*np.pi*r ax.plot(theta, r, color='#ee8d18', lw=3) ax.set_rmax(2.0) grid(True) Modified: trunk/matplotlib/examples/pylab/polar_legend.py =================================================================== --- trunk/matplotlib/examples/pylab/polar_legend.py 2008-05-16 22:26:15 UTC (rev 5164) +++ trunk/matplotlib/examples/pylab/polar_legend.py 2008-05-16 22:47:00 UTC (rev 5165) @@ -1,6 +1,6 @@ #!/usr/bin/env python -import numpy as npy +import numpy as np from matplotlib.pyplot import figure, show, rc # radar green, solid grid lines @@ -12,8 +12,8 @@ fig = figure(figsize=(8,8)) ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True, axisbg='#d5de9c') -r = npy.arange(0, 3.0, 0.01) -theta = 2*npy.pi*r +r = np.arange(0, 3.0, 0.01) +theta = 2*np.pi*r ax.plot(theta, r, color='#ee8d18', lw=3, label='a line') ax.plot(0.5*theta, r, color='blue', ls='--', lw=3, label='another line') ax.legend() Modified: trunk/matplotlib/examples/pylab/quadmesh_demo.py =================================================================== --- trunk/matplotlib/examples/pylab/quadmesh_demo.py 2008-05-16 22:26:15 UTC (rev 5164) +++ trunk/matplotlib/examples/pylab/quadmesh_demo.py 2008-05-16 22:47:00 UTC (rev 5165) @@ -6,23 +6,23 @@ This demo illustrates a bug in quadmesh with masked data. """ -import numpy as npy +import numpy as np from matplotlib.pyplot import figure, show, savefig from matplotlib import cm, colors from numpy import ma n = 56 -x = npy.linspace(-1.5,1.5,n) -y = npy.linspace(-1.5,1.5,n*2) -X,Y = npy.meshgrid(x,y); -Qx = npy.cos(Y) - npy.cos(X) -Qz = npy.sin(Y) + npy.sin(X) +x = np.linspace(-1.5,1.5,n) +y = np.linspace(-1.5,1.5,n*2) +X,Y = np.meshgrid(x,y); +Qx = np.cos(Y) - np.cos(X) +Qz = np.sin(Y) + np.sin(X) Qx = (Qx + 1.1) -Z = npy.sqrt(X**2 + Y**2)/5; +Z = np.sqrt(X**2 + Y**2)/5; Z = (Z - Z.min()) / (Z.max() - Z.min()) # The color array can include masked values: -Zm = ma.masked_where(npy.fabs(Qz) < 0.5*npy.amax(Qz), Z) +Zm = ma.masked_where(np.fabs(Qz) < 0.5*np.amax(Qz), Z) fig = figure() Modified: trunk/matplotlib/examples/pylab/step_demo.py =================================================================== --- trunk/matplotlib/examples/pylab/step_demo.py 2008-05-16 22:26:15 UTC (rev 5164) +++ trunk/matplotlib/examples/pylab/step_demo.py 2008-05-16 22:47:00 UTC (rev 5165) @@ -1,9 +1,9 @@ -import numpy as npy +import numpy as np from numpy import ma from matplotlib.pyplot import step, legend, xlim, ylim, show -x = npy.arange(1, 7, 0.4) -y0 = npy.sin(x) +x = np.arange(1, 7, 0.4) +y0 = np.sin(x) y = y0.copy() + 2.5 step(x, y, label='pre (default)') Modified: trunk/matplotlib/examples/pylab/strip_chart_demo.py =================================================================== --- trunk/matplotlib/examples/pylab/strip_chart_demo.py 2008-05-16 22:26:15 UTC (rev 5164) +++ trunk/matplotlib/examples/pylab/strip_chart_demo.py 2008-05-16 22:47:00 UTC (rev 5165) @@ -12,7 +12,7 @@ import gobject, gtk import matplotlib matplotlib.use('GTKAgg') -import numpy as npy +import numpy as np from matplotlib.lines import Line2D @@ -36,9 +36,9 @@ def emitter(self, p=0.01): 'return a random value with probability p, else 0' - v = npy.random.rand(1) + v = np.random.rand(1) if v>p: return 0. - else: return npy.random.rand(1) + else: return np.random.rand(1) def update(self, *args): if self.background is None: return True Modified: trunk/matplotlib/examples/pylab/symlog_demo.py =================================================================== --- trunk/matplotlib/examples/pylab/symlog_demo.py 2008-05-16 22:26:15 UTC (rev 5164) +++ trunk/matplotlib/examples/pylab/symlog_demo.py 2008-05-16 22:47:00 UTC (rev 5165) @@ -19,7 +19,7 @@ subplot(313) -plot(x, npy.sin(x / 3.0)) +plot(x, np.sin(x / 3.0)) xscale('symlog') yscale('symlog') grid(True) Modified: trunk/matplotlib/examples/pylab/webapp_demo.py =================================================================== --- trunk/matplotlib/examples/pylab/webapp_demo.py 2008-05-16 22:26:15 UTC (rev 5164) +++ trunk/matplotlib/examples/pylab/webapp_demo.py 2008-05-16 22:47:00 UTC (rev 5165) @@ -21,7 +21,7 @@ from matplotlib.backends.backend_agg import FigureCanvasAgg from matplotlib.figure import Figure from matplotlib.cbook import iterable -import numpy as npy +import numpy as np def make_fig(): """ @@ -40,9 +40,9 @@ line, = ax.plot([1,2,3], 'ro--', markersize=12, markerfacecolor='g') # make a translucent scatter collection - x = npy.random.rand(100) - y = npy.random.rand(100) - area = npy.pi*(10 * npy.random.rand(100))**2 # 0 to 10 point radiuses + x = np.random.rand(100) + y = np.random.rand(100) + area = np.pi*(10 * np.random.rand(100))**2 # 0 to 10 point radiuses c = ax.scatter(x,y,area) c.set_alpha(0.5) Modified: trunk/matplotlib/examples/tests/backend_driver.py =================================================================== --- trunk/matplotlib/examples/tests/backend_driver.py 2008-05-16 22:26:15 UTC (rev 5164) +++ trunk/matplotlib/examples/tests/backend_driver.py 2008-05-16 22:47:00 UTC (rev 5165) @@ -181,7 +181,7 @@ line_lstrip = line.lstrip() if (line_lstrip.startswith('from __future__ import division') or line_lstrip.startswith('matplotlib.use') or - line_lstrip.find('savefig')>=0 or + line_lstrip.startswith('savefig') or line_lstrip.startswith('show')): continue tmpfile.write(line) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |