From: Elden C. <el...@tu...> - 2014-04-17 21:25:14
|
matplotlib is impressive in its capabilities, I didn't realize how much so until I download from the git, and made a little script to run all of the examples. I'm way too much of a newbie here to check anything in, but I thought someone may find this trinket useful. As written, it should be in the 'matplotlib/examples' directory named 'runAll.py', if someone is so inclined to check it in. Feel free to edit or eviscerate it or whatever. -------------------------------------------------- #!/usr/bin/python ############################################################################### ## ## REVISION HISTORY ## Date Name SCR# Description ## -------- ------------ ------ -------------------------------------------- ## 2014-04-17 Elden Crom N#A Initial Release ############################################################################### import subprocess, os ###To make the demos work that needed sample data I had to ### 'cp /etc/matplotlibrc ~/.matplotlib/' and edit the examples.directory ### entry to not have the extra tick marks ie ### """examples.directory : /usr/share/matplotlib/sampledata""" ### but I think this was because of a version issue.... dirs = [root for root, dir, files in os.walk(".")] #dirs = ['./showcase', './widgets'] #to only run a directory or two excluded = ['./runAll.py','./tests/backend_driver.py'] def myfilter(d,f): fpth = os.path.join(d,f) return (os.path.isfile(fpth) and f.endswith('.py') and not fpth in excluded) pyfiles =[] for d in dirs: pyfiles.extend([ (d,f) for f in os.listdir(d) if myfilter(d,f) ]) #there are over 400 examples in the git repository #[git clone git://github.com/matplotlib/matplotlib.git]/matplotlib/examples #so you might not want to see them all in one setting! #pyfiles=pyfiles[100+100:] for i,(d,f) in enumerate(pyfiles): print "--------------------Executing 'python %s'------------------(%d of %d)--"%(os.path.join(d,f),i,len(pyfiles)) subprocess.Popen(["python", f],cwd=d).wait() |