if os.path.exists(old_config_file) and not os.path.exists(config_file): CONVERT = True else: config_file = cutils.get_config_file(tconfig=True) CONVERT = False if DEBUG: print 'loading', config_file configManager = TConfigManager(MPLConfig, config_file, filePriority=True) mplConfig = configManager.tconf mplConfigDefault = MPLConfig() # TODO: move into traits validation mplConfig.backend.ps.distiller.use = \ checkdep.ps_distiller(mplConfig.backend.ps.distiller.use) mplConfig.text.usetex = checkdep.usetex(mplConfig.text.usetex) def save_config(): """Save mplConfig customizations to current matplotlib.conf """ configManager.write() rcParams = RcParamsWrapper(mplConfig) rcParamsDefault = RcParamsWrapper(mplConfigDefault) # convert old matplotlibrc to new matplotlib.conf if CONVERT: from rcparams import rcParams as old_rcParams
if ret['datapath'] is None: ret['datapath'] = get_data_path() verbose.report('loaded rc file %s' % fname) return ret # this is the instance used by the matplotlib classes rcParams = rc_params() rcParamsDefault = RcParams([ (key, default) for key, (default, converter) in \ defaultParams.iteritems() ]) rcParams['ps.usedistiller'] = checkdep.ps_distiller( rcParams['ps.usedistiller']) rcParams['text.usetex'] = checkdep.usetex(rcParams['text.usetex']) def rc(group, **kwargs): """ Set the current rc params. Group is the grouping for the rc, eg for lines.linewidth the group is 'lines', for axes.facecolor, the group is 'axes', and so on. Group may also be a list or tuple of group names, eg ('xtick','ytick'). kwargs is a list of attribute name/value pairs, eg rc('lines', linewidth=2, color='r') sets the current rc params and is equivalent to
"%s"\n\t%s' % (val, cnt, line, fname, msg)) else: print >> sys.stderr, """ Bad key "%s" on line %d in %s. You probably need to get an updated matplotlibrc file from http://matplotlib.sf.net/matplotlibrc or from the matplotlib source distribution""" % (key, cnt, fname) if ret['datapath'] is None: ret['datapath'] = get_data_path() verbose.report('loaded rc file %s'%fname) return ret rcParams = rc_params() rcParamsDefault = RcParams([ (key, default) for key, (default, converter) in \ defaultParams.iteritems() ]) rcParams['ps.usedistiller'] = checkdep.ps_distiller(rcParams['ps.usedistiller']) rcParams['text.usetex'] = checkdep.usetex(rcParams['text.usetex']) def rc(group, **kwargs): """ Set the current rc params. Group is the grouping for the rc, eg for lines.linewidth the group is 'lines', for axes.facecolor, the group is 'axes', and so on. Group may also be a list or tuple of group names, eg ('xtick','ytick'). kwargs is a list of attribute name/value pairs, eg rc('lines', linewidth=2, color='r') sets the current rc params and is equivalent to rcParams['lines.linewidth'] = 2 rcParams['lines.color'] = 'r' The following aliases are available to save typing for interactive users 'lw' : 'linewidth'
CONVERT = True else: config_file = cutils.get_config_file(tconfig=True) CONVERT = False if DEBUG: print 'loading', config_file configManager = TConfigManager(MPLConfig, config_file, filePriority=True) mplConfig = configManager.tconf mplConfigDefault = MPLConfig() # TODO: move into traits validation mplConfig.backend.ps.distiller.use = \ checkdep.ps_distiller(mplConfig.backend.ps.distiller.use) mplConfig.text.usetex = checkdep.usetex(mplConfig.text.usetex) def save_config(): """Save mplConfig customizations to current matplotlib.conf """ configManager.write() rcParams = RcParamsWrapper(mplConfig) rcParamsDefault = RcParamsWrapper(mplConfigDefault) # convert old matplotlibrc to new matplotlib.conf if CONVERT: from rcparams import rcParams as old_rcParams for key, val in old_rcParams.iteritems(): rcParams[key] = val