From: <md...@us...> - 2007-10-29 17:47:21
|
Revision: 4057 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4057&view=rev Author: mdboom Date: 2007-10-29 10:47:10 -0700 (Mon, 29 Oct 2007) Log Message: ----------- Improve the code coverage of backend_driver.py Modified Paths: -------------- trunk/matplotlib/examples/arrow_demo.py trunk/matplotlib/examples/backend_driver.py trunk/matplotlib/examples/legend_auto.py trunk/matplotlib/examples/wxcursor_demo.py Added Paths: ----------- trunk/matplotlib/examples/equal_aspect_ratio.py trunk/matplotlib/examples/hline_demo.py Modified: trunk/matplotlib/examples/arrow_demo.py =================================================================== --- trunk/matplotlib/examples/arrow_demo.py 2007-10-29 17:39:06 UTC (rev 4056) +++ trunk/matplotlib/examples/arrow_demo.py 2007-10-29 17:47:10 UTC (rev 4057) @@ -280,6 +280,7 @@ if __name__ == '__main__': from sys import argv + d = None if len(argv) > 1: if argv[1] == 'full': d = all_on_max @@ -293,7 +294,7 @@ elif argv[1] == 'sample': d = sample_data scaled = True - else: + if d is None: d = all_on_max scaled=False if len(argv) > 2: Modified: trunk/matplotlib/examples/backend_driver.py =================================================================== --- trunk/matplotlib/examples/backend_driver.py 2007-10-29 17:39:06 UTC (rev 4056) +++ trunk/matplotlib/examples/backend_driver.py 2007-10-29 17:47:10 UTC (rev 4057) @@ -22,10 +22,16 @@ files = ( 'alignment_test.py', 'arctest.py', + 'arrow_demo.py', 'axes_demo.py', + 'axhspan_demo.py', 'bar_stacked.py', 'barchart_demo.py', + 'boxplot_demo.py', + 'broken_barh.py', + 'barh_demo.py', 'color_demo.py', + 'colorbar_only.py', 'contour_demo.py', 'contourf_demo.py', 'csd_demo.py', @@ -33,6 +39,8 @@ 'customize_rc.py', 'date_demo1.py', 'date_demo2.py', + 'equal_aspect_ratio.py', + 'errorbar_limits.py', 'figimage_demo.py', 'figlegend_demo.py', 'figtext.py', @@ -40,12 +48,14 @@ 'finance_demo.py', 'fonts_demo_kw.py', 'histogram_demo.py', + 'hline_demo.py', 'image_demo.py', 'image_demo2.py', 'image_masked.py', 'image_origin.py', 'invert_axes.py', 'layer_images.py', + 'legend_auto.py', 'legend_demo.py', 'legend_demo2.py', 'line_collection.py', @@ -66,11 +76,18 @@ 'polar_demo.py', 'polar_scatter.py', 'psd_demo.py', + 'quadmesh_demo.py', 'quiver_demo.py', 'scatter_demo.py', 'scatter_demo2.py', + 'scatter_star_poly.py', + 'shared_axis_demo.py', + 'shared_axis_across_figures.py', 'simple_plot.py', 'specgram_demo.py', + 'spy_demos.py', + 'stem_plot.py', + 'step_demo.py', 'stock_demo.py', 'subplot_demo.py', # 'set_and_get.py', @@ -104,7 +121,7 @@ def run(arglist): os.system(' '.join(arglist)) -def drive(backend, python='python', switches = []): +def drive(backend, python=['python'], switches = []): exclude = failbackend.get(backend, []) switchstring = ' '.join(switches) @@ -151,17 +168,20 @@ tmpfile.write('savefig("%s", dpi=150)' % outfile) tmpfile.close() - run([python, tmpfile_name, switchstring]) + run(python + [tmpfile_name, switchstring]) #os.system('%s %s %s' % (python, tmpfile_name, switchstring)) os.remove(tmpfile_name) if __name__ == '__main__': times = {} default_backends = ['Agg', 'PS', 'SVG', 'PDF', 'Template'] - if sys.platform == 'win32': - python = r'c:\Python24\python.exe' + if '--coverage' in sys.argv: + python = ['coverage.py', '-x'] + sys.argv.remove('--coverage') + elif sys.platform == 'win32': + python = [r'c:\Python24\python.exe'] else: - python = 'python' + python = ['python'] all_backends = [b.lower() for b in mplbe.all_backends] all_backends.extend(['cairo.png', 'cairo.ps', 'cairo.pdf', 'cairo.svg']) backends = [] Added: trunk/matplotlib/examples/equal_aspect_ratio.py =================================================================== --- trunk/matplotlib/examples/equal_aspect_ratio.py (rev 0) +++ trunk/matplotlib/examples/equal_aspect_ratio.py 2007-10-29 17:47:10 UTC (rev 4057) @@ -0,0 +1,23 @@ +#!/usr/bin/env python +""" +Example: simple line plot. +Show how to make a plot that has equal aspect ratio +""" +from pylab import * + +t = arange(0.0, 1.0+0.01, 0.01) +s = cos(2*2*pi*t) +plot(t, s, '-', lw=2) + +xlabel('time (s)') +ylabel('voltage (mV)') +title('About as simple as it gets, folks') +grid(True) + +axes().set_aspect('equal', 'datalim') + + +#savefig('simple_plot.png') +savefig('equal_aspect') + +show() Property changes on: trunk/matplotlib/examples/equal_aspect_ratio.py ___________________________________________________________________ Name: svn:executable + * Added: trunk/matplotlib/examples/hline_demo.py =================================================================== --- trunk/matplotlib/examples/hline_demo.py (rev 0) +++ trunk/matplotlib/examples/hline_demo.py 2007-10-29 17:47:10 UTC (rev 4057) @@ -0,0 +1,21 @@ +#!/usr/bin/env python +from matplotlib.pyplot import * +from numpy import sin, exp, absolute, pi, arange +from numpy.random import normal + +def f(t): + s1 = sin(2*pi*t) + e1 = exp(-t) + return absolute((s1*e1))+.05 + + +t = arange(0.0, 5.0, 0.1) +s = f(t) +nse = normal(0.0, 0.3, t.shape) * s + +plot(s+nse, t, 'b^') +hlines(t, [0], s) +xlabel('time (s)') +title('Comparison of model with data') +show() + Property changes on: trunk/matplotlib/examples/hline_demo.py ___________________________________________________________________ Name: svn:executable + * Modified: trunk/matplotlib/examples/legend_auto.py =================================================================== --- trunk/matplotlib/examples/legend_auto.py 2007-10-29 17:39:06 UTC (rev 4056) +++ trunk/matplotlib/examples/legend_auto.py 2007-10-29 17:47:10 UTC (rev 4057) @@ -79,7 +79,12 @@ if __name__ == '__main__': nfigs = 10 - figures = [int(f) for f in sys.argv[1:]] + figures = [] + for f in sys.argv[1:]: + try: + figures.append(int(f)) + except ValueError: + pass if len(figures) == 0: figures = range(1, nfigs+1) Modified: trunk/matplotlib/examples/wxcursor_demo.py =================================================================== --- trunk/matplotlib/examples/wxcursor_demo.py 2007-10-29 17:39:06 UTC (rev 4056) +++ trunk/matplotlib/examples/wxcursor_demo.py 2007-10-29 17:47:10 UTC (rev 4057) @@ -3,6 +3,8 @@ """ import matplotlib +matplotlib.use('WXAgg') + from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas from matplotlib.backends.backend_wx import NavigationToolbar2Wx from matplotlib.figure import Figure @@ -65,6 +67,5 @@ return True if __name__=='__main__': - matplotlib.use('WXAgg') app = App(0) app.MainLoop() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |