if fail_on_error: ret[key] = val # try to convert to proper type or raise else: try: ret[key] = val # try to convert to proper type or skip except Exception, msg: warnings.warn('Bad val "%s" on line #%d\n\t"%s"\n\tin file \ "%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')
class MPLConfig(TConfig): """ This is a sample matplotlib configuration file. It should be placed in HOME/.matplotlib (unix/linux like systems) and C:\Documents and Settings\yourname\.matplotlib (win32 systems) By default, the installer will overwrite the existing file in the install path, so if you want to preserve yours, please move it to your HOME dir and set the environment variable if necessary. This file is best viewed in a editor which supports ini or conf mode syntax highlighting. Blank lines, or lines starting with a comment symbol, are ignored, as are trailing comments. Other lines must have the format key = val optional comment val should be valid python syntax, just as you would use when setting properties using rcParams. This should become more obvious by inspecting the default values listed herein. Colors: for the color values below, you can either use - a matplotlib color string, such as r | k | b - an rgb tuple, such as (1.0, 0.5, 0.0) - a hex string, such as #ff00ff or ff00ff - a scalar grayscale intensity such as 0.75 - a legal html color name, eg red | blue | darkslategray Interactivity: see http://matplotlib.sourceforge.net/interactive.html. ### CONFIGURATION BEGINS HERE ### """ interactive = T.Trait(False, mplT.BoolHandler()) toolbar = T.Trait('toolbar2', 'toolbar2', None) timezone = T.Trait('UTC', pytz.all_timezones) datapath = T.Trait(cutils.get_data_path()) units = T.false class backend(TConfig): use = T.Trait('Agg', mplT.BackendHandler()) fallback = T.Trait(True, mplT.BoolHandler()) class cairo(TConfig): format = T.Trait('png', 'png', 'ps', 'pdf', 'svg') class tk(TConfig): """ window_focus : Maintain shell focus for TkAgg pythoninspect: tk sets PYTHONINSPECT """ window_focus = T.false pythoninspect = T.false class ps(TConfig): papersize = T.Trait('letter', 'auto', 'letter', 'legal', 'ledger', 'A0', 'A1', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'A8', 'A9', 'A10', 'B0', 'B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8', 'B9', 'B10') useafm = T.false fonttype = T.Trait(3, 42) class distiller(TConfig): use = T.Trait(None, None, 'ghostscript', 'xpdf', False) resolution = T.Float(6000) class pdf(TConfig): compression = T.Range(0, 9, 6) fonttype = T.Trait(3, 42) inheritcolor = T.false use14corefonts = T.false class svg(TConfig): image_inline = T.true image_noscale = T.false embed_char_paths = T.true class lines(TConfig): linewidth = T.Float(1.0) linestyle = T.Trait('-', '--', '-.', ':', 'steps', '', ' ', None) color = T.Trait('blue', mplT.ColorHandler()) solid_joinstyle = T.Trait('round', 'miter', 'round', 'bevel') solid_capstyle = T.Trait('butt', 'butt', 'round', 'projecting') dash_joinstyle = T.Trait('round', 'miter', 'round', 'bevel') dash_capstyle = T.Trait('butt', 'butt', 'round', 'projecting') marker = T.Trait('None', 'None', 'o', '.', ',', '^', 'v', '<', '>', 's', '+', 'x', 'D', 'd', '1', '2', '3', '4', 'h', 'H', 'p', '|', '_') markeredgewidth = T.Float(0.5) markersize = T.Float(6) antialiased = T.true class path(TConfig): simplify = T.false simplify_threshold = T.float(1.0 / 9.0) class patch(TConfig): linewidth = T.Float(1.0) facecolor = T.Trait('blue', mplT.ColorHandler()) edgecolor = T.Trait('black', mplT.ColorHandler()) antialiased = T.true class font(TConfig): family = T.Trait('sans-serif', 'sans-serif', 'serif', 'cursive', 'fantasy', 'monospace') style = T.Trait('normal', 'normal', 'italic', 'oblique') variant = T.Trait('normal', 'normal', 'small-caps') weight = T.Trait('normal', 'normal', 'bold', 'bolder', 'lighter', 100, 200, 300, 400, 500, 600, 700, 800, 900) stretch = T.Trait('normal', 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded', 'wider', 'narrower') size = T.Float(12.0) serif = T.ListStr([ "Bitstream Vera Serif", "New Century Schoolbook", "Century Schoolbook L", "Utopia", "ITC Bookman", "Bookman", "Nimbus Roman No9 L", "Times New Roman", "Times", "Palatino", "Charter", "serif" ]) sans_serif = T.ListStr([ "Bitstream Vera Sans", "Lucida Grande", "Verdana", "Geneva", "Lucid", "Arial", "Helvetica", "Avant Garde", "sans-serif" ]) cursive = T.ListStr( ["Apple Chancery", "Textile", "Zapf Chancery", "Sand", "cursive"]) fantasy = T.ListStr([ "Comic Sans MS", "Chicago", "Charcoal", "Impact", "Western", "fantasy" ]) monospace = T.ListStr([ "Bitstream Vera Sans Mono", "Andale Mono", "Nimbus Mono L", "Courier New", "Courier", "Fixed", "Terminal", "monospace" ]) class text(TConfig): color = T.Trait('black', mplT.ColorHandler()) usetex = T.false hinting = T.true class latex(TConfig): unicode = T.false preamble = T.ListStr([]) dvipnghack = T.false class mathtext(TConfig): cal = T.Trait('cursive', mplT.FontconfigPatternHandler()) rm = T.Trait('serif', mplT.FontconfigPatternHandler()) tt = T.Trait('monospace', mplT.FontconfigPatternHandler()) it = T.Trait('serif:oblique', mplT.FontconfigPatternHandler()) bf = T.Trait('serif:bold', mplT.FontconfigPatternHandler()) sf = T.Trait('sans', mplT.FontconfigPatternHandler()) fontset = T.Trait('cm', 'cm', 'stix', 'stixsans', 'custom') default = T.Trait(*( "rm cal it tt sf bf default bb frak circled scr regular".split())) fallback_to_cm = T.true class axes(TConfig): hold = T.Trait(True, mplT.BoolHandler()) facecolor = T.Trait('white', mplT.ColorHandler()) edgecolor = T.Trait('black', mplT.ColorHandler()) linewidth = T.Float(1.0) grid = T.Trait(False, mplT.BoolHandler()) polargrid = T.Trait(True, mplT.BoolHandler()) titlesize = T.Trait('large', 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', T.Float) labelsize = T.Trait('medium', 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', T.Float) labelcolor = T.Trait('black', mplT.ColorHandler()) axisbelow = T.false class formatter(TConfig): limits = T.List(T.Float, [-7, 7], minlen=2, maxlen=2) class xticks(TConfig): color = T.Trait('black', mplT.ColorHandler()) labelsize = T.Trait('small', 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', T.Float) direction = T.Trait('in', 'out') class major(TConfig): size = T.Float(4) pad = T.Float(4) class minor(TConfig): size = T.Float(2) pad = T.Float(4) class yticks(TConfig): color = T.Trait('black', mplT.ColorHandler()) labelsize = T.Trait('small', 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', T.Float) direction = T.Trait('in', 'out') class major(TConfig): size = T.Float(4) pad = T.Float(4) class minor(TConfig): size = T.Float(2) pad = T.Float(4) class grid(TConfig): color = T.Trait('black', mplT.ColorHandler()) linestyle = T.Trait(':', '-', '--', '-.', ':', 'steps', '', ' ') linewidth = T.Float(0.5) class legend(TConfig): loc = T.Trait('upper right', 'best', 'upper right', 'upper left', 'lower left', 'lower right', 'right', 'center left', 'center right', 'lower center', 'upper center', 'center') isaxes = T.true numpoints = T.Int(3) fontsize = T.Trait('medium', 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', T.Float) pad = T.Float(0.2) markerscale = T.Float(1.0) labelsep = T.Float(0.01) handlelen = T.Float(0.05) handletextsep = T.Float(0.02) axespad = T.Float(0.02) shadow = T.false class figure(TConfig): figsize = T.List(T.Float, [8, 6], maxlen=2, minlen=2) dpi = T.Float(80) facecolor = T.Trait('0.75', mplT.ColorHandler()) edgecolor = T.Trait('white', mplT.ColorHandler()) class subplot(TConfig): """The figure subplot parameters. All dimensions are fraction of the figure width or height""" left = T.Float(0.125) right = T.Float(0.9) bottom = T.Float(0.1) top = T.Float(0.9) wspace = T.Float(0.2) hspace = T.Float(0.2) class image(TConfig): aspect = T.Trait('equal', 'equal', 'auto', T.Float) interpolation = T.Trait('bilinear', 'bilinear', 'nearest', 'bicubic', 'spline16', 'spline36', 'hanning', 'hamming', 'hermite', 'kaiser', 'quadric', 'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc', 'lanczos', 'blackman') cmap = T.Trait('jet', *mplT.colormaps) lut = T.Int(256) origin = T.Trait('upper', 'upper', 'lower') class contour(TConfig): negative_linestyle = T.Trait('dashed', 'dashed', 'solid') class savefig(TConfig): dpi = T.Float(100) facecolor = T.Trait('white', mplT.ColorHandler()) edgecolor = T.Trait('white', mplT.ColorHandler()) orientation = T.Trait('portrait', 'portrait', 'landscape') class verbose(TConfig): level = T.Trait('silent', 'silent', 'helpful', 'debug', 'debug-annoying') fileo = T.Trait('sys.stdout', 'sys.stdout', T.File)
try: ret[key] = val # try to convert to proper type or skip except Exception, msg: warnings.warn( 'Bad val "%s" on line #%d\n\t"%s"\n\tin file \ "%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 # 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'])