|
From: Paul T. <pau...@gm...> - 2012-09-08 05:52:28
|
in your jmkfile.py you should have from pylab import * Paul On 9/8/12 12:45 AM, Jody Klymak wrote: > Hi All, > > Sorry to ask a dumb python newbie question, but the problem arose while reading the matplotlib documentation, and an hour or so on the internet didnt' help, so I felt it was fair-ish game to post here. > > In http://matplotlib.sourceforge.net/examples/pylab_examples/customize_rc.html it says: > """ > If you like to work interactively, and need to create different sets > of defaults for figures (eg one set of defaults for publication, one > set for interactive exploration), you may want to define some > functions in a custom module that set the defaults, eg > > def set_pub(): > rc('font', weight='bold') # bold fonts are easier to see > > Then as you are working interactively, you just need to do > >>>> set_pub() > """ > > Which I thought was great, because I'd like to have some presets for different journals. However, saving the def into a file (jmkfigure.py) and calling > > from jmkfigure import * > > set_pub() > > yields the error: "NameError: global name 'rc' is not defined" > > I tried importing matplotlib and rc into jmkfigure.py, but to no avail. > > I appreciate this is a scoping issue with python, but I can't figure out how to set rc from within an external module. > > Thanks for any help, > > Cheers, Jody > > > > > > |