script for redoing a large number of plots?

Hi,

for my thesis I have a laaaaarge number of plots generated
by--again--a laaaaaaarge number of Python scripts.

Now I need a moderate font size for all of them for the thesis while
for a presentation and poster it needs to be much bigger.

In order to keep track of all the plots and files I use a script which
just calls them and copies the relevant files to a folder:

import pylab, shutil, subprocess

cwd = os.getcwd()
dest = './pyplots/'

p20 = '../20_Glasses+Liquids/'
p21 = '../21_LensDesign/'
p22 = '../22_comsol/'
p23 = '../23_OSLO/'
p23_glc = '../23_OSLO/OSLO_glc/'

def main():
  runP20()

def runP20():
  os.chdir(p20)
  subprocess.call([sys.executable, 'Generic_OpticalLiquids.py'])
  os.chdir(cwd)
  shutil.copy(p20+'Generic_OpticalLiquids_n-V.pdf', dest)

This might be a very clumsy approach but I find it very helpful. The
problem is that changing any rcParam has no effect on the created
files, opposed to using execfile instead of subprocess.call().

What can I do to change plot settings globally for that task?

Thanks in advance,
Daniel

Hi,

for my thesis I have a laaaaarge number of plots generated
by--again--a laaaaaaarge number of Python scripts.

Now I need a moderate font size for all of them for the thesis while
for a presentation and poster it needs to be much bigger.

In order to keep track of all the plots and files I use a script which
just calls them and copies the relevant files to a folder:

import pylab, shutil, subprocess

cwd = os.getcwd()
dest = './pyplots/'

p20 = '../20_Glasses+Liquids/'
p21 = '../21_LensDesign/'
p22 = '../22_comsol/'
p23 = '../23_OSLO/'
p23_glc = '../23_OSLO/OSLO_glc/'

def main():
   runP20()

def runP20():
   os.chdir(p20)
   subprocess.call([sys.executable, 'Generic_OpticalLiquids.py'])
   os.chdir(cwd)
   shutil.copy(p20+'Generic_OpticalLiquids_n-V.pdf', dest)

This might be a very clumsy approach but I find it very helpful. The
problem is that changing any rcParam has no effect on the created
files, opposed to using execfile instead of subprocess.call().

What can I do to change plot settings globally for that task?

If I understand correctly what you are trying to do, you need to set your rcParams in a matplotlibrc file that will be the one found for a given run through all your scripts; or modify your scripts so that they take rcParams on the command line, and modify your master run-all script so that it feeds those rcParams to each script as it is called.

For the first approach, you can either have your master script copy a given matplotlibrc file into each subdirectory before doing your chdir() to that subdirectory, or you can simply set that matplotlibrc file at the beginning of the run, using a single location on the search path for matplotlibrc. That search path includes a path that you may set using the environment variable MATPLOTLIBRC, and, relative to your home directory, ".matplotlib/". For either type of path, note that it is a directory that is specified; the file is always named "matplotlibrc".

Eric

···

On 01/15/2011 09:35 AM, Daniel Mader wrote:

Thanks in advance,
Daniel

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options