From: <ds...@us...> - 2007-11-10 23:08:40
|
Revision: 4214 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4214&view=rev Author: dsdale Date: 2007-11-10 15:08:19 -0800 (Sat, 10 Nov 2007) Log Message: ----------- added flags in setup.cfg to disable providing external packages like pytz and datetime Modified Paths: -------------- trunk/matplotlib/setup.cfg trunk/matplotlib/setup.py trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setup.cfg =================================================================== --- trunk/matplotlib/setup.cfg 2007-11-10 22:41:51 UTC (rev 4213) +++ trunk/matplotlib/setup.cfg 2007-11-10 23:08:19 UTC (rev 4214) @@ -4,4 +4,18 @@ [status] # To suppress display of the dependencies and their versions # at the top of the build log, uncomment the following line: -# suppress = 1 \ No newline at end of file +# +#suppress = True + +[provide packages] +# by default, matplotlib checks for a few dependencies and +# installs them if missing. This feature can be turned off +# by uncommenting the following lines: +# +## date/timezone support: +#pytz = False +#dateutil = False +# +## experimental config package support: +#enthought.traits = False +#configobj = False Modified: trunk/matplotlib/setup.py =================================================================== --- trunk/matplotlib/setup.py 2007-11-10 22:41:51 UTC (rev 4213) +++ trunk/matplotlib/setup.py 2007-11-10 23:08:19 UTC (rev 4214) @@ -13,10 +13,8 @@ rc = {'backend':'PS', 'numerix':'numpy'} -# build the image support module - requires agg and Numeric or -# numarray. You can build the image module with either Numeric or -# numarray or both. By default, matplotlib will build support for -# whatever array packages you have installed. +# build the image support module - requires agg. By default, matplotlib will +# build support for whatever array packages you have installed. BUILD_IMAGE = 1 # Build the antigrain geometry toolkit. Agg makes heavy use of @@ -82,9 +80,10 @@ build_subprocess, build_ttconv, print_line, print_status, print_message, \ print_raw, check_for_freetype, check_for_libpng, check_for_gtk, \ check_for_tk, check_for_wx, check_for_numpy, check_for_qt, check_for_qt4, \ - check_for_cairo, check_for_traits, check_for_pytz, check_for_dateutil, \ - check_for_configobj, check_for_dvipng, check_for_ghostscript, \ - check_for_latex, check_for_pdftops, check_for_datetime + check_for_cairo, check_provide_traits, check_provide_pytz, \ + check_provide_dateutil, check_provide_configobj, check_for_dvipng, \ + check_for_ghostscript, check_for_latex, check_for_pdftops, \ + check_for_datetime #import distutils.sysconfig # jdh @@ -240,8 +239,8 @@ print_raw("OPTIONAL DATE/TIMEZONE DEPENDENCIES") hasdatetime = check_for_datetime() -hasdateutil = check_for_dateutil(hasdatetime) -haspytz = check_for_pytz(hasdatetime) +provide_dateutil = check_provide_dateutil(hasdatetime) +provide_pytz = check_provide_pytz(hasdatetime) if hasdatetime: # dates require python23 datetime # only install pytz and dateutil if the user hasn't got them @@ -272,8 +271,8 @@ add_dateutil() else: # only add them if we need them - if not haspytz: add_pytz() - if not hasdateutil: add_dateutil() + if provide_pytz: add_pytz() + if provide_dateutil: add_dateutil() print_raw("") print_raw("OPTIONAL USETEX DEPENDENCIES") @@ -285,8 +284,10 @@ # TODO: comment out for mpl release: print_raw("") print_raw("EXPERIMENTAL CONFIG PACKAGE DEPENDENCIES") -if not check_for_configobj(): py_modules.append('configobj') -if not check_for_traits(): build_traits(ext_modules, packages) +if check_provide_configobj(): + py_modules.append('configobj') +if check_provide_traits(): + build_traits(ext_modules, packages) print_raw("") print_raw("[Edit setup.cfg to suppress the above messages]") Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2007-11-10 22:41:51 UTC (rev 4213) +++ trunk/matplotlib/setupext.py 2007-11-10 23:08:19 UTC (rev 4214) @@ -98,16 +98,35 @@ numpy_inc_dirs = [] # Based on the contents of setup.cfg, determine if the status block -# should be displayed +# should be displayed, if missing external packages should be provided display_status = True +provide_pytz = True +provide_dateutil = True +provide_configobj = True +provide_traits = True if os.path.exists("setup.cfg"): config = ConfigParser.SafeConfigParser() config.read("setup.cfg") try: - if config.get("status", "suppress"): - display_status = False + display_status = not config.getboolean("status", "suppress") except: pass + try: + provide_pytz = config.getboolean("provide packages", "pytz") + except: + pass + try: + provide_dateutil = config.getboolean("provide packages", "dateutil") + except: + pass + try: + provide_configobj = config.getboolean("provide packages", "configobj") + except: + pass + try: + provide_traits = config.getboolean("provide packages", "enthought.traits") + except: + pass if display_status: def print_line(char='='): @@ -336,57 +355,73 @@ print_status("datetime", "present, version unknown") return True -def check_for_pytz(hasdatetime=True): +def check_provide_pytz(hasdatetime=True): try: import pytz except ImportError: - if hasdatetime: print_status("pytz", "mpl-provided") - else: print_status("pytz", "no") - return False + if hasdatetime and provide_pytz: + print_status("pytz", "mpl-provided") + return True + else: + print_status("pytz", "no") + return False else: print_status("pytz", pytz.__version__) - return True + return False -def check_for_dateutil(hasdatetime=True): +def check_provide_dateutil(hasdatetime=True): try: import dateutil except ImportError: - if hasdatetime: print_status("dateutil", "mpl-provided") - else: print_status("dateutil", "no") - return False + if hasdatetime and provide_dateutil: + print_status("dateutil", "mpl-provided") + return True + else: + print_status("dateutil", "no") + return False else: try: print_status("dateutil", dateutil.__version__) except AttributeError: print_status("dateutil", "present, version unknown") - return True + return False -def check_for_configobj(): +def check_provide_configobj(): try: import configobj except ImportError: - print_status("configobj", "mpl-provided") - return False + if provide_configobj: + print_status("configobj", "mpl-provided") + return True + else: + print_status("configobj", "no") + return False else: print_status("configobj", configobj.__version__) - return True + return False -def check_for_traits(): - gotit = False +def check_provide_traits(): try: from enthought import traits - gotit = True try: from enthought.traits import version except: print_status("enthought.traits", "unknown and incompatible version: < 2.0") - return gotit + return False else: - if version.version.endswith('mpl'): gotit = False - print_status("enthought.traits", version.version) + if version.version.endswith('mpl'): + print_status("enthought.traits", "mpl-provided") + return True + else: + print_status("enthought.traits", version.version) + return False except ImportError: - print_status("enthought.traits", "no") - return gotit + if provide_traits: + print_status("enthought.traits", "mpl-provided") + return True + else: + print_status("enthought.traits", "no") + return False def check_for_dvipng(): try: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ds...@us...> - 2007-11-10 23:20:55
|
Revision: 4216 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4216&view=rev Author: dsdale Date: 2007-11-10 15:20:44 -0800 (Sat, 10 Nov 2007) Log Message: ----------- dont use spaces in setup.cfg section names Modified Paths: -------------- trunk/matplotlib/setup.cfg trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setup.cfg =================================================================== --- trunk/matplotlib/setup.cfg 2007-11-10 23:10:15 UTC (rev 4215) +++ trunk/matplotlib/setup.cfg 2007-11-10 23:20:44 UTC (rev 4216) @@ -10,7 +10,7 @@ # #suppress = True -[provide packages] +[provide_packages] # by default, matplotlib checks for a few dependencies and # installs them if missing. This feature can be turned off # by uncommenting the following lines: Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2007-11-10 23:10:15 UTC (rev 4215) +++ trunk/matplotlib/setupext.py 2007-11-10 23:20:44 UTC (rev 4216) @@ -112,19 +112,19 @@ except: pass try: - provide_pytz = config.getboolean("provide packages", "pytz") + provide_pytz = config.getboolean("provide_packages", "pytz") except: pass try: - provide_dateutil = config.getboolean("provide packages", "dateutil") + provide_dateutil = config.getboolean("provide_packages", "dateutil") except: pass try: - provide_configobj = config.getboolean("provide packages", "configobj") + provide_configobj = config.getboolean("provide_packages", "configobj") except: pass try: - provide_traits = config.getboolean("provide packages", "enthought.traits") + provide_traits = config.getboolean("provide_packages", "enthought.traits") except: pass This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ds...@us...> - 2007-11-10 23:21:48
|
Revision: 4217 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4217&view=rev Author: dsdale Date: 2007-11-10 15:21:38 -0800 (Sat, 10 Nov 2007) Log Message: ----------- moved setup.cfg to setup.cfg.template, so local modifications can be made without affecting the trunk Added Paths: ----------- trunk/matplotlib/setup.cfg.template Removed Paths: ------------- trunk/matplotlib/setup.cfg Deleted: trunk/matplotlib/setup.cfg =================================================================== --- trunk/matplotlib/setup.cfg 2007-11-10 23:20:44 UTC (rev 4216) +++ trunk/matplotlib/setup.cfg 2007-11-10 23:21:38 UTC (rev 4217) @@ -1,24 +0,0 @@ -# Rename this file to setup.cfg to modify matplotlib's -# build options. - -[egg_info] -tag_svn_revision = 1 - -[status] -# To suppress display of the dependencies and their versions -# at the top of the build log, uncomment the following line: -# -#suppress = True - -[provide_packages] -# by default, matplotlib checks for a few dependencies and -# installs them if missing. This feature can be turned off -# by uncommenting the following lines: -# -## date/timezone support: -#pytz = False -#dateutil = False -# -## experimental config package support: -#enthought.traits = False -#configobj = False Copied: trunk/matplotlib/setup.cfg.template (from rev 4216, trunk/matplotlib/setup.cfg) =================================================================== --- trunk/matplotlib/setup.cfg.template (rev 0) +++ trunk/matplotlib/setup.cfg.template 2007-11-10 23:21:38 UTC (rev 4217) @@ -0,0 +1,24 @@ +# Rename this file to setup.cfg to modify matplotlib's +# build options. + +[egg_info] +tag_svn_revision = 1 + +[status] +# To suppress display of the dependencies and their versions +# at the top of the build log, uncomment the following line: +# +#suppress = True + +[provide_packages] +# by default, matplotlib checks for a few dependencies and +# installs them if missing. This feature can be turned off +# by uncommenting the following lines: +# +## date/timezone support: +#pytz = False +#dateutil = False +# +## experimental config package support: +#enthought.traits = False +#configobj = False This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ds...@us...> - 2007-11-12 15:25:06
|
Revision: 4221 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4221&view=rev Author: dsdale Date: 2007-11-12 07:23:23 -0800 (Mon, 12 Nov 2007) Log Message: ----------- option to disable building backend extension modules moved from setup.py to setup.cfg Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/setup.cfg.template trunk/matplotlib/setup.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2007-11-12 13:53:38 UTC (rev 4220) +++ trunk/matplotlib/CHANGELOG 2007-11-12 15:23:23 UTC (rev 4221) @@ -1,3 +1,6 @@ +2007-11-12 Options to disable building backend extension modules moved + from setup.py to setup.cfg - DSD + 2007-11-09 Applied Martin Teichmann's patch 1828813: a QPainter is used in paintEvent, which has to be destroyed using the method end(). If matplotlib raises an exception before the call to end - and it Modified: trunk/matplotlib/setup.cfg.template =================================================================== --- trunk/matplotlib/setup.cfg.template 2007-11-12 13:53:38 UTC (rev 4220) +++ trunk/matplotlib/setup.cfg.template 2007-11-12 15:23:23 UTC (rev 4221) @@ -11,14 +11,37 @@ #suppress = True [provide_packages] -# by default, matplotlib checks for a few dependencies and +# By default, matplotlib checks for a few dependencies and # installs them if missing. This feature can be turned off # by uncommenting the following lines: # -## date/timezone support: +## Date/timezone support: #pytz = False #dateutil = False # -## experimental config package support: +## Experimental config package support: #enthought.traits = False #configobj = False + +[gui_support] +# Matplotlib supports multiple GUI toolkits, including Cocoa, +# GTK, Fltk, Qt, Qt4, Tk, and WX. Support for many of these +# toolkits requires AGG, the Anti-Grain Geometry library, which +# is provided by matplotlib and built by default. +# +# Some backends are written in pure Python, and others require +# extension code to be compiled. By default, matplotlib checks +# for these GUI toolkits during installation and, if present, +# compiles the required extensions to support the toolkit. GTK +# support requires the GTK runtime environment and PyGTK. Wx +# support requires wxWidgets and wxPython. Tk support requires +# Tk and Tkinter. The other GUI toolkits do not require any +# extension code, and can be used as long as the libraries are +# installed on your system. +# +# You can uncomment any the following lines if you know you do +# not want to use the GUI toolkit. +#gtk = False +#gtkagg = False +#tkagg = False +#wxagg = False Modified: trunk/matplotlib/setup.py =================================================================== --- trunk/matplotlib/setup.py 2007-11-12 13:53:38 UTC (rev 4220) +++ trunk/matplotlib/setup.py 2007-11-12 15:23:23 UTC (rev 4221) @@ -17,6 +17,21 @@ # build support for whatever array packages you have installed. BUILD_IMAGE = 1 + +# build a small extension to manage the focus on win32 platforms. +#BUILD_WINDOWING = 0 +BUILD_WINDOWING = 'auto' + + +VERBOSE = False # insert lots of diagnostic prints in extension code + + + + +## You shouldn't need to customize below this point +import ConfigParser +import os + # Build the antigrain geometry toolkit. Agg makes heavy use of # templates, so it probably requires a fairly recent compiler to build # it. It makes very nice antialiased output and also supports alpha @@ -35,19 +50,27 @@ # needed for wxpython <2.8 if you plan on doing animations BUILD_WXAGG = 1 +if os.path.exists("setup.cfg"): + config = ConfigParser.SafeConfigParser() + config.read("setup.cfg") + try: + BUILD_GTK = config.getboolean("gui_support", "gtk") + except: + pass + try: + BUILD_GTKAGG = config.getboolean("gui_support", "gtkagg") + except: + pass + try: + BUILD_TKAGG = config.getboolean("gui_support", "tkagg") + except: + pass + try: + BUILD_WXAGG = config.getboolean("gui_support", "wxagg") + except: + pass -# build a small extension to manage the focus on win32 platforms. -#BUILD_WINDOWING = 0 -BUILD_WINDOWING = 'auto' - -VERBOSE = False # insert lots of diagnostic prints in extension code - - - - -## You shouldn't need to customize below this point - # BEFORE importing disutils, remove MANIFEST. distutils doesn't properly # update it when the contents of directories change. import os This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2007-11-12 16:31:32
|
Revision: 4223 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4223&view=rev Author: jdh2358 Date: 2007-11-12 08:31:28 -0800 (Mon, 12 Nov 2007) Log Message: ----------- added some mlab imports back to pylab Modified Paths: -------------- trunk/matplotlib/API_CHANGES trunk/matplotlib/Makefile trunk/matplotlib/lib/matplotlib/axes.py trunk/matplotlib/lib/matplotlib/mlab.py trunk/matplotlib/lib/matplotlib/pylab.py trunk/matplotlib/lib/matplotlib/pyplot.py Modified: trunk/matplotlib/API_CHANGES =================================================================== --- trunk/matplotlib/API_CHANGES 2007-11-12 15:36:08 UTC (rev 4222) +++ trunk/matplotlib/API_CHANGES 2007-11-12 16:31:28 UTC (rev 4223) @@ -1,4 +1,3 @@ - Moved mlab.csv2rec -> recutils.csv2rec Added ax kwarg to pyplot.colorbar and Figure.colorbar so that one can specify the axes object from which space for the colorbar Modified: trunk/matplotlib/Makefile =================================================================== --- trunk/matplotlib/Makefile 2007-11-12 15:36:08 UTC (rev 4222) +++ trunk/matplotlib/Makefile 2007-11-12 16:31:28 UTC (rev 4223) @@ -1,6 +1,6 @@ # Makefile for matplotlib -PYTHON = /usr/bin/python2.5 +PYTHON = `which python` VERSION = `${PYTHON} setup.py --version` DISTFILES = API_CHANGES KNOWN_BUGS INSTALL README TODO license \ @@ -12,11 +12,11 @@ clean: ${PYTHON} setup.py clean;\ - rm -f *.png *.ps *.eps *.svg *.jpg + rm -f *.png *.ps *.eps *.svg *.jpg *.pdf find . -name "_tmp*.py" | xargs rm -f;\ find . \( -name "*~" -o -name "*.pyc" \) | xargs rm -f;\ - find examples \( -name "*.svg" -o -name "*.png" -o -name "*.ps" -o -name "*.eps" -o -name "*.tar" -o -name "*.gz" -o -name "*.log" -o -name "*.aux" -o -name "*.tex" \) | xargs rm -f - find unit \( -name "*.png" -o -name "*.ps" -o -name "*.eps" \) | xargs rm -f + find examples \( -name "*.svg" C-o -name "*.png" -o -name "*.pdf" -o -name "*.ps" -o -name "*.eps" -o -name "*.tar" -o -name "*.gz" -o -name "*.log" -o -name "*.aux" -o -name "*.tex" \) | xargs rm -f + find unit \( -name "*.png" -o -name "*.ps" -o -name "*.pdf" -o -name "*.eps" \) | xargs rm -f find . \( -name "#*" -o -name ".#*" -o -name ".*~" -o -name "*~" \) | xargs rm -f Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2007-11-12 15:36:08 UTC (rev 4222) +++ trunk/matplotlib/lib/matplotlib/axes.py 2007-11-12 16:31:28 UTC (rev 4223) @@ -4798,6 +4798,39 @@ return mtable.table(self, **kwargs) table.__doc__ = cbook.dedent(table.__doc__) % martist.kwdocd + def twinx(self): + """ + ax = twinx() + + create a twin of Axes for generating a plot with a sharex + x-axis but independent y axis. The y-axis of self will have + ticks on left and the returned axes will have ticks on the + right + """ + + ax2 = self.figure.add_axes(self.get_position(), sharex=self, frameon=False) + ax2.yaxis.tick_right() + ax2.yaxis.set_label_position('right') + self.yaxis.tick_left() + return ax2 + + def twiny(self): + """ + ax = twiny() + + create a twin of Axes for generating a plot with a shared + y-axis but independent x axis. The x-axis of self will have + ticks on bottom and the returned axes will have ticks on the + top + """ + + ax2 = self.figure.add_axes(self.get_position(), sharey=self, frameon=False) + ax2.xaxis.tick_top() + ax2.xaxis.set_label_position('top') + self.xaxis.tick_bottom() + return ax2 + + #### Data analysis Modified: trunk/matplotlib/lib/matplotlib/mlab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mlab.py 2007-11-12 15:36:08 UTC (rev 4222) +++ trunk/matplotlib/lib/matplotlib/mlab.py 2007-11-12 16:31:28 UTC (rev 4223) @@ -442,8 +442,9 @@ kw = dict(rowvar=False) return npy.corrcoef(*args, **kw) -def polyfit(x,y,N): +def polyfit(*args, **kwargs): """ + def polyfit(x,y,N) Do a best fit polynomial of order N of y to x. Return value is a vector of polynomial coefficients [pk ... p1 p0]. Eg, for N=2 @@ -480,21 +481,13 @@ See also polyval """ - x = npy.asarray(x, dtype=npy.float_) - #y = npy.asarray(y, dtype=npy.float_) - #y.shape = (len(y),1) - #X = npy.matrix(npy.vander(x, N+1)) - #Xt = npy.matrix(X.transpose()) - #c = npy.array(npy.linalg.inv(Xt*X)*Xt*y) # convert back to array - #c.shape = (N+1,) - #return c - X = npy.vander(x, N+1) - return npy.linalg.lstsq(X, y)[0] + warnings.warn("use numpy.poyfit", DeprecationWarning) + return npy.polyfit(*args, **kw) -def polyval(p,x): +def polyval(*args, **kwargs): """ y = polyval(p,x) @@ -510,14 +503,11 @@ See also polyfit """ - x = npy.asarray(x, dtype=npy.float_) - p = npy.asarray(p, dtype=npy.float_).reshape((len(p),1)) - X = npy.vander(x,len(p)) - y = npy.dot(X,p) - return y.reshape(x.shape) + warnings.warn("use numpy.polyval", DeprecationWarning) + return npy.polyval(*args, **kw) -def vander(x,N=None): +def vander(*args, **kwargs): """ X = vander(x,N=None) @@ -527,7 +517,7 @@ """ warnings.warn("Use numpy.vander()", DeprecationWarning) - return npy.vander(x, N) + return npy.vander(*args, **kwargs) def donothing_callback(*args): @@ -1262,6 +1252,17 @@ fh = cbook.to_filehandle(fname) X = [] + if delimiter==' ': + # space splitting is a special case since x.split() is what + # you want, not x.split(' ') + def splitfunc(x): + return x.split() + else: + def splitfunc(x): + return x.split(delimiter) + + + converterseq = None for i,line in enumerate(fh): if i<skiprows: continue @@ -1269,13 +1270,13 @@ if not len(line): continue if converterseq is None: converterseq = [converters.get(j,float) - for j,val in enumerate(line.split(delimiter))] + for j,val in enumerate(splitfunc(line))] if usecols is not None: vals = line.split(delimiter) row = [converterseq[j](vals[j]) for j in usecols] else: row = [converterseq[j](val) - for j,val in enumerate(line.split(delimiter))] + for j,val in enumerate(splitfunc(line))] thisLen = len(row) X.append(row) @@ -2281,7 +2282,7 @@ FormatFloat.__init__(self, precision, scale=1e-6) -class FormatDate(FormatString): +class FormatDate(FormatObj): def __init__(self, fmt): self.fmt = fmt @@ -2301,7 +2302,7 @@ npy.float32 : FormatFloat(), npy.float64 : FormatFloat(), npy.object_ : FormatObj(), - npy.string_ : FormatString(), + npy.string_ : FormatObj(), } def get_formatd(r, formatd=None): @@ -2658,7 +2659,7 @@ - def rec2gtk(r, formatd=None, rownum=0): + def rec2gtk(r, formatd=None, rownum=0, autowin=True): """ save record array r to excel pyExcelerator worksheet ws starting at rownum. if ws is string like, assume it is a @@ -2666,7 +2667,13 @@ formatd is a dictionary mapping dtype name -> FormatXL instances - The next rownum after writing is returned + This function creates a SortedStringsScrolledWindow (derived + from gtk.ScrolledWindow) and returns it. if autowin is True, + a gtk.Window is created, attached to the + SortedStringsScrolledWindow instance, shown and returned. If + autowin=False, the caller is responsible for adding the + SortedStringsScrolledWindow instance to a gtk widget and + showing it. """ @@ -2692,6 +2699,14 @@ for row in r: scroll.add_row(row) + + if autowin: + win = gtk.Window() + win.set_default_size(800,600) + win.add(scroll) + win.show_all() + scroll.win = win + return scroll Modified: trunk/matplotlib/lib/matplotlib/pylab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/pylab.py 2007-11-12 15:36:08 UTC (rev 4222) +++ trunk/matplotlib/lib/matplotlib/pylab.py 2007-11-12 16:31:28 UTC (rev 4223) @@ -249,6 +249,19 @@ from numpy.random import * from numpy.linalg import * +from matplotlib.mlab import load, window_hanning, window_none, conv, detrend, demean, \ + detrend_mean, detrend_none, detrend_linear, entropy, normpdf, levypdf, \ + find, longest_contiguous_ones, longest_ones, prepca, prctile, prctile_rank, \ + center_matrix, rk4, bivariate_normal, get_xyz_where, get_sparse_matrix, dist, \ + dist_point_to_segment, segments_intersect, fftsurr, liaupunov, movavg, \ + save, load, slopes, stineman_interp, inside_poly, poly_below, poly_between, exp_safe, \ + amap, rms_flat, l1norm, l2norm, norm_flat, frange, diagonal_matrix, identity, \ + base_repr, binary_repr, log2, ispower2, fromfunction_kw, rem, norm, orth, rank, sqrtm,\ + mfuncC, approx_real, rec_append_field, rec_drop_fields, rec_join, csv2rec, rec2csv + + + + # old style--if True, override standard numpy with oldnumeric if False: from numpy.oldnumeric import array, zeros, shape, rank, size, fromstring,\ Modified: trunk/matplotlib/lib/matplotlib/pyplot.py =================================================================== --- trunk/matplotlib/lib/matplotlib/pyplot.py 2007-11-12 15:36:08 UTC (rev 4222) +++ trunk/matplotlib/lib/matplotlib/pyplot.py 2007-11-12 16:31:28 UTC (rev 4223) @@ -492,14 +492,8 @@ """ if ax is None: ax=gca() - - - ax2 = gcf().add_axes(ax.get_position(), sharex=ax, frameon=False) - ax2.yaxis.tick_right() - ax2.yaxis.set_label_position('right') - ax.yaxis.tick_left() draw_if_interactive() - return ax2 + return ax.twinx() def twiny(ax=None): @@ -510,14 +504,8 @@ """ if ax is None: ax=gca() - - - ax2 = gcf().add_axes(ax.get_position(), sharey=ax, frameon=False) - ax2.xaxis.tick_top() - ax2.xaxis.set_label_position('top') - ax.xaxis.tick_bottom() draw_if_interactive() - return ax2 + return ax.twiny() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-11-12 18:10:29
|
Revision: 4231 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4231&view=rev Author: mdboom Date: 2007-11-12 10:10:25 -0800 (Mon, 12 Nov 2007) Log Message: ----------- Provide way to access STIX "letterlike" symbols using LaTeX font commands. Add "stixsans" option to typeset math with sans-serif glyphs. Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/examples/mathtext_examples.py trunk/matplotlib/lib/matplotlib/_mathtext_data.py trunk/matplotlib/lib/matplotlib/config/mplconfig.py trunk/matplotlib/lib/matplotlib/config/rcsetup.py trunk/matplotlib/lib/matplotlib/mathtext.py trunk/matplotlib/lib/matplotlib/rcsetup.py trunk/matplotlib/matplotlibrc.template Added Paths: ----------- trunk/matplotlib/examples/stix_fonts_demo.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2007-11-12 17:03:28 UTC (rev 4230) +++ trunk/matplotlib/CHANGELOG 2007-11-12 18:10:25 UTC (rev 4231) @@ -1,3 +1,25 @@ +2007-11-12 Added support for STIX fonts. A new rcParam, + mathtext.fontset, can be used to choose between: + + 'cm': + The TeX/LaTeX Computer Modern fonts + + 'stix': + The STIX fonts (see stixfonts.org) + + 'stixsans': + The STIX fonts, using sans-serif glyphs by default + + 'custom': + A generic Unicode font, in which case the mathtext font + must be specified using mathtext.bf, mathtext.it, + mathtext.sf etc. + + Added a new example, stix_fonts_demo.py to show how to access + different fonts and unusual symbols. + + - MGD + 2007-11-12 Options to disable building backend extension modules moved from setup.py to setup.cfg - DSD Modified: trunk/matplotlib/examples/mathtext_examples.py =================================================================== --- trunk/matplotlib/examples/mathtext_examples.py 2007-11-12 17:03:28 UTC (rev 4230) +++ trunk/matplotlib/examples/mathtext_examples.py 2007-11-12 18:10:25 UTC (rev 4231) @@ -49,7 +49,7 @@ r'$\widehat{abc}\widetilde{def}$', r'$\Gamma \Delta \Theta \Lambda \Xi \Pi \Sigma \Upsilon \Phi \Psi \Omega$', r'$\alpha \beta \gamma \delta \epsilon \zeta \eta \theta \iota \lambda \mu \nu \xi \pi \kappa \rho \sigma \tau \upsilon \phi \chi \psi$', - #ur'Generic symbol: $\u23ce \mathrm{\ue0f2 \U0001D538}$' + ur'Generic symbol: $\u23ce \mathrm{\ue0f2 \U0001D538}$' ] from pylab import * @@ -66,7 +66,7 @@ print (i, s) text(0.1, -i, s, fontsize=20) - #savefig('mathtext_example') + savefig('mathtext_examples') #close('all') show() Added: trunk/matplotlib/examples/stix_fonts_demo.py =================================================================== --- trunk/matplotlib/examples/stix_fonts_demo.py (rev 0) +++ trunk/matplotlib/examples/stix_fonts_demo.py 2007-11-12 18:10:25 UTC (rev 4231) @@ -0,0 +1,54 @@ +#!/usr/bin/env python + +import os, sys, re + +import gc + +stests = [ + r'$\mathcircled{123} \mathrm{\mathcircled{123}} \mathbf{\mathcircled{123}}$', + r'$\mathsf{Sans \Omega} \mathrm{\mathsf{Sans \Omega}} \mathbf{\mathsf{Sans \Omega}}$', + r'$\mathtt{Monospace}$', + r'$\mathcal{CALLIGRAPHIC}$', + r'$\mathbb{Blackboard \pi}$', + r'$\mathrm{\mathbb{Blackboard \pi}}$', + r'$\mathbf{\mathbb{Blackboard \pi}}$', + r'$\mathfrak{Fraktur} \mathbf{\mathfrak{Fraktur}}$', + r'$\mathscr{Script}$', + ur'Direct Unicode: $\u23ce \mathrm{\ue0f2 \U0001D538}$' + ] + +from pylab import * + +def doall(): + tests = stests + + figure(figsize=(8, (len(tests) * 1) + 2)) + plot([0, 0], 'r') + grid(False) + axis([0, 3, -len(tests), 0]) + yticks(arange(len(tests)) * -1) + for i, s in enumerate(tests): + print (i, s) + text(0.1, -i, s, fontsize=32) + + savefig('stix_fonts_example') + #close('all') + show() + +if '--latex' in sys.argv: + fd = open("stix_fonts_examples.ltx", "w") + fd.write("\\documentclass{article}\n") + fd.write("\\begin{document}\n") + fd.write("\\begin{enumerate}\n") + + for i, s in enumerate(stests): + s = re.sub(r"(?<!\\)\$", "$$", s) + fd.write("\\item %s\n" % s) + + fd.write("\\end{enumerate}\n") + fd.write("\\end{document}\n") + fd.close() + + os.system("pdflatex stix_fonts_examples.ltx") +else: + doall() Property changes on: trunk/matplotlib/examples/stix_fonts_demo.py ___________________________________________________________________ Name: svn:executable + * Modified: trunk/matplotlib/lib/matplotlib/_mathtext_data.py =================================================================== --- trunk/matplotlib/lib/matplotlib/_mathtext_data.py 2007-11-12 17:03:28 UTC (rev 4230) +++ trunk/matplotlib/lib/matplotlib/_mathtext_data.py 2007-11-12 18:10:25 UTC (rev 4231) @@ -2265,482 +2265,207 @@ 'bigotimes': 10754 } -uni2tex = dict([(v,k) for k,v in tex2uni.items()]) - -tex2type1 = {'doteq': 'uni2250', -'partial': 'uni2202', -'gg': 'uni226B', -'asymp': 'uni224D', -'blacktriangledown': 'uni25BE', -'otimes': 'uni2297', -'nearrow': 'uni2197', -'varpi': 'uni03D6', -'vee': 'uni2228', -'vec': 'uni20D7', -'smile': 'uni2323', -'succnsim': 'uni22E9', -'gimel': 'uni2137', -'vert': 'bar', -'varrho': 'uni03F1', -'P': 'paragraph', -'approxident': 'uni224B', -'Swarrow': 'uni21D9', -'textasciicircum': 'asciicircum', -'imageof': 'uni22B7', -'ntriangleleft': 'uni22EA', -'nleq': 'uni2270', -'div': 'divide', -'nparallel': 'uni2226', -'Leftarrow': 'uni21D0', -'lll': 'uni22D8', -'oiint': 'uni222F', -'ngeq': 'uni2271', -'Theta': 'uni0398', -'origof': 'uni22B6', -'blacksquare': 'uni25A0', -'hspace': 'uni200A', -'solbar': 'uni233F', -'neg': 'logicalnot', -'sum': 'uni2211', -'Vdash': 'uni22A9', -'coloneq': 'uni2254', -'degree': 'degree', -'bowtie': 'uni22C8', -'blacktriangleright': 'uni25B6', -'varsigma': 'uni03C2', -'leq': 'uni2264', -'ggg': 'uni22D9', -'lneqq': 'uni2268', -'scurel': 'uni22B1', -'stareq': 'uni225B', -'BbbN': 'uni2115', -'nLeftarrow': 'uni21CD', -'nLeftrightarrow': 'uni21CE', -'k': 'uni0328', -'bot': 'uni22A5', -'BbbC': 'uni2102', -'Lsh': 'uni21B0', -'leftleftarrows': 'uni21C7', -'BbbZ': 'uni2124', -'digamma': 'uni03DD', -'BbbR': 'uni211D', -'BbbP': 'uni2119', -'BbbQ': 'uni211A', -'vartriangleright': 'uni22B3', -'succsim': 'uni227F', -'wedge': 'uni2227', -'lessgtr': 'uni2276', -'veebar': 'uni22BB', -'mapsdown': 'uni21A7', -'Rsh': 'uni21B1', -'chi': 'uni03C7', -'prec': 'uni227A', -'nsubseteq': 'uni2288', -'therefore': 'uni2234', -'eqcirc': 'uni2256', -'textexclamdown': 'exclamdown', -'nRightarrow': 'uni21CF', -'flat': 'uni266D', -'notin': 'uni2209', -'llcorner': 'uni231E', -'varepsilon': 'uni03B5', -'bigtriangleup': 'uni25B3', -'aleph': 'uni2135', -'dotminus': 'uni2238', -'upsilon': 'uni03C5', -'Lambda': 'uni039B', -'cap': 'uni2229', -'barleftarrow': 'uni21E4', -'mu': 'uni03BC', -'boxplus': 'uni229E', -'mp': 'uni2213', -'circledast': 'uni229B', -'tau': 'uni03C4', -'in': 'uni2208', -'backslash': 'backslash', -'varnothing': 'uni2205', -'sharp': 'uni266F', -'eqsim': 'uni2242', -'gnsim': 'uni22E7', -'Searrow': 'uni21D8', -'updownarrows': 'uni21C5', -'heartsuit': 'uni2661', -'trianglelefteq': 'uni22B4', -'ddag': 'daggerdbl', -'sqsubseteq': 'uni2291', -'mapsfrom': 'uni21A4', -'boxbar': 'uni25EB', -'sim': 'uni223C', -'Nwarrow': 'uni21D6', -'nequiv': 'uni2262', -'succ': 'uni227B', -'vdash': 'uni22A2', -'Leftrightarrow': 'uni21D4', -'parallel': 'uni2225', -'invnot': 'uni2310', -'natural': 'uni266E', -'ss': 'germandbls', -'uparrow': 'uni2191', -'nsim': 'uni2241', -'hookrightarrow': 'uni21AA', -'Equiv': 'uni2263', -'approx': 'uni2248', -'Vvdash': 'uni22AA', -'nsucc': 'uni2281', -'leftrightharpoons': 'uni21CB', -'Re': 'uni211C', -'boxminus': 'uni229F', -'equiv': 'uni2261', -'Lleftarrow': 'uni21DA', -'thinspace': 'uni2009', -'ll': 'uni226A', -'Cup': 'uni22D3', -'measeq': 'uni225E', -'upharpoonleft': 'uni21BF', -'lq': 'quoteleft', -'Upsilon': 'uni03D2', -'subsetneq': 'uni228A', -'greater': 'greater', -'supsetneq': 'uni228B', -'Cap': 'uni22D2', -'L': 'Lslash', -'spadesuit': 'uni2660', -'lrcorner': 'uni231F', -'not': 'uni0338', -'bar': 'uni0304', -'rightharpoonaccent': 'uni20D1', -'boxdot': 'uni22A1', -'l': 'lslash', -'leftharpoondown': 'uni21BD', -'bigcup': 'uni22C3', -'iint': 'uni222C', -'bigwedge': 'uni22C0', -'downharpoonleft': 'uni21C3', -'textasciitilde': 'asciitilde', -'subset': 'uni2282', -'leqq': 'uni2266', -'mapsup': 'uni21A5', -'nvDash': 'uni22AD', -'looparrowleft': 'uni21AB', -'nless': 'uni226E', -'rightarrowbar': 'uni21E5', -'Vert': 'uni2016', -'downdownarrows': 'uni21CA', -'uplus': 'uni228E', -'simeq': 'uni2243', -'napprox': 'uni2249', -'ast': 'uni2217', -'twoheaduparrow': 'uni219F', -'doublebarwedge ?': 'uni2306', -'Sigma': 'uni03A3', -'leftharpoonaccent': 'uni20D0', -'ntrianglelefteq': 'uni22EC', -'nexists': 'uni2204', -'times': 'multiply', -'measuredangle': 'uni2221', -'bumpeq': 'uni224F', -'carriagereturn': 'uni21B5', -'adots': 'uni22F0', -'checkmark': 'uni2713', -'lambda': 'uni03BB', -'xi': 'uni03BE', -'rbrace': 'braceright', -'rbrack': 'bracketright', -'Nearrow': 'uni21D7', -'maltese': 'uni2720', -'clubsuit': 'uni2663', -'top': 'uni22A4', -'overarc': 'uni0311', -'varphi': 'uni03C6', -'Delta': 'uni0394', -'iota': 'uni03B9', -'nleftarrow': 'uni219A', -'candra': 'uni0310', -'supset': 'uni2283', -'triangleleft': 'uni25C1', -'gtreqless': 'uni22DB', -'ntrianglerighteq': 'uni22ED', -'quad': 'uni2003', -'Xi': 'uni039E', -'gtrdot': 'uni22D7', -'leftthreetimes': 'uni22CB', -'minus': 'minus', -'preccurlyeq': 'uni227C', -'nleftrightarrow': 'uni21AE', -'lambdabar': 'uni019B', -'blacktriangle': 'uni25B4', -'kernelcontraction': 'uni223B', -'Phi': 'uni03A6', -'angle': 'uni2220', -'spadesuitopen': 'uni2664', -'eqless': 'uni22DC', -'mid': 'uni2223', -'varkappa': 'uni03F0', -'Ldsh': 'uni21B2', -'updownarrow': 'uni2195', -'beta': 'uni03B2', -'textquotedblleft': 'quotedblleft', -'rho': 'uni03C1', -'alpha': 'uni03B1', -'intercal': 'uni22BA', -'beth': 'uni2136', -'grave': 'uni0300', -'acwopencirclearrow': 'uni21BA', -'nmid': 'uni2224', -'nsupset': 'uni2285', -'sigma': 'uni03C3', -'dot': 'uni0307', -'Rightarrow': 'uni21D2', -'turnednot': 'uni2319', -'backsimeq': 'uni22CD', -'leftarrowtail': 'uni21A2', -'approxeq': 'uni224A', -'curlyeqsucc': 'uni22DF', -'rightarrowtail': 'uni21A3', -'Psi': 'uni03A8', -'copyright': 'copyright', -'yen': 'yen', -'vartriangleleft': 'uni22B2', -'rasp': 'uni02BC', -'triangleright': 'uni25B7', -'precsim': 'uni227E', -'infty': 'uni221E', -'geq': 'uni2265', -'updownarrowbar': 'uni21A8', -'precnsim': 'uni22E8', -'H': 'uni030B', -'ulcorner': 'uni231C', -'looparrowright': 'uni21AC', -'ncong': 'uni2247', -'downarrow': 'uni2193', -'circeq': 'uni2257', -'subseteq': 'uni2286', -'bigstar': 'uni2605', -'prime': 'uni2032', -'lceil': 'uni2308', -'Rrightarrow': 'uni21DB', -'oiiint': 'uni2230', -'curlywedge': 'uni22CF', -'vDash': 'uni22A8', -'lfloor': 'uni230A', -'ddots': 'uni22F1', -'exists': 'uni2203', -'underbar': 'uni0331', -'Pi': 'uni03A0', -'leftrightarrows': 'uni21C6', -'sphericalangle': 'uni2222', -'coprod': 'uni2210', -'circledcirc': 'uni229A', -'gtrsim': 'uni2273', -'gneqq': 'uni2269', -'between': 'uni226C', -'theta': 'uni03B8', -'complement': 'uni2201', -'arceq': 'uni2258', -'nVdash': 'uni22AE', -'S': 'section', -'wr': 'uni2240', -'wp': 'uni2118', -'backcong': 'uni224C', -'lasp': 'uni02BD', -'c': 'uni0327', -'nabla': 'uni2207', -'dotplus': 'uni2214', -'eta': 'uni03B7', -'forall': 'uni2200', -'eth': 'eth', -'colon': 'colon', -'sqcup': 'uni2294', -'rightrightarrows': 'uni21C9', -'sqsupset': 'uni2290', -'mapsto': 'uni21A6', -'bigtriangledown': 'uni25BD', -'sqsupseteq': 'uni2292', -'propto': 'uni221D', -'pi': 'uni03C0', -'pm': 'plusminus', -'dots': 'ellipsis', -'nrightarrow': 'uni219B', -'textasciiacute': 'acute', -'Doteq': 'uni2251', -'breve': 'uni0306', -'sqcap': 'uni2293', -'twoheadrightarrow': 'uni21A0', -'kappa': 'uni03BA', -'vartriangle': 'uni25B5', -'diamondsuit': 'uni2662', -'pitchfork': 'uni22D4', -'blacktriangleleft': 'uni25C0', -'nprec': 'uni2280', -'vdots': 'uni22EE', -'curvearrowright': 'uni21B7', -'barwedge': 'uni22BC', -'multimap': 'uni22B8', -'textquestiondown': 'questiondown', -'cong': 'uni2245', -'rtimes': 'uni22CA', -'rightzigzagarrow': 'uni21DD', -'rightarrow': 'uni2192', -'leftarrow': 'uni2190', -'__sqrt__': 'uni221A', -'twoheaddownarrow': 'uni21A1', -'oint': 'uni222E', -'bigvee': 'uni22C1', -'eqdef': 'uni225D', -'sterling': 'sterling', -'phi': 'uni03D5', -'Updownarrow': 'uni21D5', -'backprime': 'uni2035', -'emdash': 'emdash', -'Gamma': 'uni0393', -'i': 'dotlessi', -'rceil': 'uni2309', -'leftharpoonup': 'uni21BC', -'Im': 'uni2111', -'curvearrowleft': 'uni21B6', -'wedgeq': 'uni2259', -'fallingdotseq': 'uni2252', -'curlyeqprec': 'uni22DE', -'questeq': 'uni225F', -'less': 'less', -'upuparrows': 'uni21C8', -'tilde': 'uni0303', -'textasciigrave': 'grave', -'smallsetminus': 'uni2216', -'ell': 'uni2113', -'cup': 'uni222A', -'danger': 'uni2621', -'nVDash': 'uni22AF', -'cdotp': 'periodcentered', -'cdots': 'uni22EF', -'hat': 'uni0302', -'eqgtr': 'uni22DD', -'enspace': 'uni2002', -'psi': 'uni03C8', -'frown': 'uni2322', -'acute': 'uni0301', -'downzigzagarrow': 'uni21AF', -'ntriangleright': 'uni22EB', -'cupdot': 'uni228D', -'circleddash': 'uni229D', -'oslash': 'uni2298', -'mho': 'uni2127', -'d': 'uni0323', -'sqsubset': 'uni228F', -'cdot': 'uni22C5', -'Omega': 'uni03A9', -'OE': 'OE', -'veeeq': 'uni225A', -'Finv': 'uni2132', -'t': 'uni0361', -'leftrightarrow': 'uni2194', -'swarrow': 'uni2199', -'rightthreetimes': 'uni22CC', -'rightleftharpoons': 'uni21CC', -'lesssim': 'uni2272', -'searrow': 'uni2198', -'because': 'uni2235', -'gtrless': 'uni2277', -'star': 'uni22C6', -'nsubset': 'uni2284', -'zeta': 'uni03B6', -'dddot': 'uni20DB', -'bigcirc': 'uni25CB', -'Supset': 'uni22D1', -'circ': 'uni2218', -'slash': 'uni2215', -'ocirc': 'uni030A', -'prod': 'uni220F', -'twoheadleftarrow': 'uni219E', -'daleth': 'uni2138', -'upharpoonright': 'uni21BE', -'odot': 'uni2299', -'Uparrow': 'uni21D1', -'O': 'Oslash', -'hookleftarrow': 'uni21A9', -'trianglerighteq': 'uni22B5', -'nsime': 'uni2244', -'oe': 'oe', -'nwarrow': 'uni2196', -'o': 'oslash', -'ddddot': 'uni20DC', -'downharpoonright': 'uni21C2', -'succcurlyeq': 'uni227D', -'gamma': 'uni03B3', -'scrR': 'uni211B', -'dag': 'dagger', -'thickspace': 'uni2005', -'frakZ': 'uni2128', -'lessdot': 'uni22D6', -'triangledown': 'uni25BF', -'ltimes': 'uni22C9', -'scrB': 'uni212C', -'endash': 'endash', -'scrE': 'uni2130', -'scrF': 'uni2131', -'scrH': 'uni210B', -'scrI': 'uni2110', -'rightharpoondown': 'uni21C1', -'scrL': 'uni2112', -'scrM': 'uni2133', -'frakC': 'uni212D', -'nsupseteq': 'uni2289', -'circledR': 'registered', -'circledS': 'uni24C8', -'ngtr': 'uni226F', -'bigcap': 'uni22C2', -'scre': 'uni212F', -'Downarrow': 'uni21D3', -'scrg': 'uni210A', -'overleftrightarrow': 'uni20E1', -'scro': 'uni2134', -'lnsim': 'uni22E6', -'eqcolon': 'uni2255', -'curlyvee': 'uni22CE', -'urcorner': 'uni231D', -'lbrace': 'braceleft', -'Bumpeq': 'uni224E', -'delta': 'uni03B4', -'boxtimes': 'uni22A0', -'overleftarrow': 'uni20D6', -'prurel': 'uni22B0', -'clubsuitopen': 'uni2667', -'cwopencirclearrow': 'uni21BB', -'geqq': 'uni2267', -'rightleftarrows': 'uni21C4', -'ac': 'uni223E', -'ae': 'ae', -'int': 'uni222B', -'rfloor': 'uni230B', -'risingdotseq': 'uni2253', -'nvdash': 'uni22AC', -'diamond': 'uni22C4', -'ddot': 'uni0308', -'backsim': 'uni223D', -'oplus': 'uni2295', -'triangleq': 'uni225C', -'check': 'uni030C', -'ni': 'uni220B', -'iiint': 'uni222D', -'ne': 'uni2260', -'lesseqgtr': 'uni22DA', -'obar': 'uni233D', -'supseteq': 'uni2287', -'nu': 'uni03BD', -'AA': 'uni212B', -'AE': 'AE', -'models': 'uni22A7', -'ominus': 'uni2296', -'dashv': 'uni22A3', -'omega': 'uni03C9', -'rq': 'quoteright', -'Subset': 'uni22D0', -'rightharpoonup': 'uni21C0', -'Rdsh': 'uni21B3', -'bullet': 'uni2219', -'divideontimes': 'uni22C7', -'lbrack': 'bracketleft', -'textquotedblright': 'quotedblright', -'Colon': 'uni2237'} - -type12tex = dict([(v,k) for k,v in tex2type1.items()]) +# Each element is a 4-tuple of the form: +# src_start, src_end, dst_font, dst_start +# +stix_virtual_fonts = { + 'bb': + { + 'rm': + [ + (0x0030, 0x0039, 'rm', 0x1d7d8), # 0-9 + (0x0041, 0x0042, 'rm', 0x1d538), # A-B + (0x0043, 0x0043, 'rm', 0x2102), # C + (0x0044, 0x0047, 'rm', 0x1d53b), # D-G + (0x0048, 0x0048, 'rm', 0x210d), # H + (0x0049, 0x004d, 'rm', 0x1d540), # I-M + (0x004e, 0x004e, 'rm', 0x2115), # N + (0x004f, 0x004f, 'rm', 0x1d546), # O + (0x0050, 0x0051, 'rm', 0x2119), # P-Q + (0x0052, 0x0052, 'rm', 0x211d), # R + (0x0053, 0x0059, 'rm', 0x1d54a), # S-Y + (0x005a, 0x005a, 'rm', 0x2124), # Z + (0x0061, 0x007a, 'rm', 0x1d552), # a-z + (0x0393, 0x0393, 'rm', 0x213e), # \Gamma + (0x03a0, 0x03a0, 'rm', 0x213f), # \Pi + (0x03a3, 0x03a3, 'rm', 0x2140), # \Sigma + (0x03b3, 0x03b3, 'rm', 0x213d), # \gamma + (0x03c0, 0x03c0, 'rm', 0x213c), # \pi + ], + 'it': + [ + (0x0041, 0x0041, 'it', 0xe154), # A-B + (0x0043, 0x0043, 'it', 0x2102), # C (missing in beta STIX fonts) + (0x0044, 0x0044, 'it', 0x2145), # D + (0x0045, 0x0047, 'it', 0xe156), # E-G + (0x0048, 0x0048, 'it', 0x210d), # H (missing in beta STIX fonts) + (0x0049, 0x004d, 'it', 0xe159), # I-M + (0x004e, 0x004e, 'it', 0x2115), # N (missing in beta STIX fonts) + (0x004f, 0x004f, 'it', 0xe15e), # O + (0x0050, 0x0051, 'it', 0x2119), # P-Q (missing in beta STIX fonts) + (0x0052, 0x0052, 'it', 0x211d), # R (missing in beta STIX fonts) + (0x0053, 0x0059, 'it', 0xe15f), # S-Y + (0x005a, 0x005a, 'it', 0x2124), # Z (missing in beta STIX fonts) + (0x0061, 0x0063, 'it', 0xe166), # a-c + (0x0064, 0x0065, 'it', 0x2146), # d-e + (0x0066, 0x0068, 'it', 0xe169), # f-h + (0x0069, 0x006a, 'it', 0x2148), # i-j + (0x006b, 0x007a, 'it', 0xe16c), # k-z + (0x0393, 0x0393, 'it', 0x213e), # \Gamma (missing in beta STIX fonts) + (0x03a0, 0x03a0, 'it', 0x213f), # \Pi + (0x03a3, 0x03a3, 'it', 0x2140), # \Sigma (missing in beta STIX fonts) + (0x03b3, 0x03b3, 'it', 0x213d), # \gamma (missing in beta STIX fonts) + (0x03c0, 0x03c0, 'it', 0x213c), # \pi + ], + 'bf': + [ + (0x0030, 0x0039, 'rm', 0x1d7d8), # 0-9 + (0x0041, 0x005a, 'bf', 0xe38a), # A-Z + (0x0061, 0x007a, 'bf', 0xe39d), # a-z + (0x0393, 0x0393, 'bf', 0x213e), # \Gamma + (0x03a0, 0x03a0, 'bf', 0x213f), # \Pi + (0x03a3, 0x03a3, 'bf', 0x2140), # \Sigma + (0x03b3, 0x03b3, 'bf', 0x213d), # \gamma + (0x03c0, 0x03c0, 'bf', 0x213c), # \pi + ], + }, + 'cal': + [ + (0x0041, 0x005a, 'it', 0xe22d), # A-Z + ], + 'circled': + { + 'rm': + [ + (0x0030, 0x0030, 'rm', 0x24ea), # 0 + (0x0031, 0x0039, 'rm', 0x2460), # 1-9 + (0x0041, 0x005a, 'rm', 0x24b6), # A-Z + (0x0061, 0x007a, 'rm', 0x24d0) # a-z + ], + 'it': + [ + (0x0030, 0x0030, 'it', 0x24ea), # 0 + (0x0031, 0x0039, 'it', 0x2460), # 1-9 + (0x0041, 0x005a, 'it', 0x24b6), # A-Z + (0x0061, 0x007a, 'it', 0x24d0) # a-z + ], + 'bf': + [ + (0x0030, 0x0030, 'bf', 0x24ea), # 0 + (0x0031, 0x0039, 'bf', 0x2460), # 1-9 + (0x0041, 0x005a, 'bf', 0x24b6), # A-Z + (0x0061, 0x007a, 'bf', 0x24d0) # a-z + ], + }, + 'frak': + { + 'rm': + [ + (0x0041, 0x0042, 'rm', 0x1d504), # A-B + (0x0043, 0x0043, 'rm', 0x212d), # C + (0x0044, 0x0047, 'rm', 0x1d507), # D-G + (0x0048, 0x0048, 'rm', 0x210c), # H + (0x0049, 0x0049, 'rm', 0x2111), # I + (0x004a, 0x0051, 'rm', 0x1d50d), # J-Q + (0x0052, 0x0052, 'rm', 0x211c), # R + (0x0053, 0x0059, 'rm', 0x1d516), # S-Y + (0x005a, 0x005a, 'rm', 0x2128), # Z + (0x0061, 0x007a, 'rm', 0x1d51e), # a-z + ], + 'it': + [ + (0x0041, 0x0042, 'rm', 0x1d504), # A-B + (0x0043, 0x0043, 'rm', 0x212d), # C + (0x0044, 0x0047, 'rm', 0x1d507), # D-G + (0x0048, 0x0048, 'rm', 0x210c), # H + (0x0049, 0x0049, 'rm', 0x2111), # I + (0x004a, 0x0051, 'rm', 0x1d50d), # J-Q + (0x0052, 0x0052, 'rm', 0x211c), # R + (0x0053, 0x0059, 'rm', 0x1d516), # S-Y + (0x005a, 0x005a, 'rm', 0x2128), # Z + (0x0061, 0x007a, 'rm', 0x1d51e), # a-z + ], + 'bf': + [ + (0x0041, 0x005a, 'bf', 0x1d56c), # A-Z + (0x0061, 0x007a, 'bf', 0x1d586), # a-z + ], + }, + 'scr': + [ + (0x0041, 0x0041, 'it', 0x1d49c), # A + (0x0042, 0x0042, 'it', 0x212c), # B + (0x0043, 0x0044, 'it', 0x1d49e), # C-D + (0x0045, 0x0046, 'it', 0x2130), # E-F + (0x0047, 0x0047, 'it', 0x1d4a2), # G + (0x0048, 0x0048, 'it', 0x210b), # H + (0x0049, 0x0049, 'it', 0x2110), # I + (0x004a, 0x004b, 'it', 0x1d4a5), # J-K + (0x004c, 0x004c, 'it', 0x2112), # L + (0x004d, 0x003d, 'it', 0x2113), # M + (0x004e, 0x0051, 'it', 0x1d4a9), # N-Q + (0x0052, 0x0052, 'it', 0x211b), # R + (0x0053, 0x005a, 'it', 0x1d4ae), # S-Z + (0x0061, 0x0064, 'it', 0x1d4b6), # a-d + (0x0065, 0x0065, 'it', 0x212f), # e + (0x0066, 0x0066, 'it', 0x1d4bb), # f + (0x0067, 0x0067, 'it', 0x210a), # g + (0x0068, 0x006e, 'it', 0x1d4bd), # h-n + (0x006f, 0x006f, 'it', 0x2134), # o + (0x0070, 0x007a, 'it', 0x1d4c5), # p-z + ], + 'sf': + { + 'rm': + [ + (0x0030, 0x0039, 'rm', 0x1d7e2), # 0-9 + (0x0041, 0x005a, 'rm', 0x1d5a0), # A-Z + (0x0061, 0x007a, 'rm', 0x1d5ba), # a-z + (0x0391, 0x03a9, 'rm', 0xe17d), # \Alpha-\Omega + (0x03b1, 0x03c9, 'rm', 0xe196), # \alpha-\omega + (0x03d1, 0x03d1, 'rm', 0xe1b0), # theta variant + (0x03d5, 0x03d5, 'rm', 0xe1b1), # phi variant + (0x03d6, 0x03d6, 'rm', 0xe1b3), # pi variant + (0x03f1, 0x03f1, 'rm', 0xe1b2), # rho variant + (0x03f5, 0x03f5, 'rm', 0xe1af), # lunate epsilon + (0x2202, 0x2202, 'rm', 0xe17c), # partial differential + ], + 'it': + [ + (0x0030, 0x0039, 'it', 0xe1b4), # 0-9 + (0x0041, 0x005a, 'it', 0x1d608), # A-Z + (0x0061, 0x007a, 'it', 0x1d622), # a-z + (0x0391, 0x03a9, 'it', 0xe1bf), # \Alpha-\Omega + (0x03b1, 0x03c9, 'it', 0xe1d8), # \alpha-\omega + (0x03d1, 0x03d1, 'it', 0xe1f2), # theta variant + (0x03d5, 0x03d5, 'it', 0xe1f3), # phi variant + (0x03d6, 0x03d6, 'it', 0xe1f5), # pi variant + (0x03f1, 0x03f1, 'it', 0xe1f4), # rho variant + (0x03f5, 0x03f5, 'it', 0xe1f1), # lunate epsilon + ], + 'bf': + [ + (0x0030, 0x0039, 'bf', 0x1d7ec), # 0-9 + (0x0041, 0x005a, 'bf', 0x1d5d4), # A-Z + (0x0061, 0x007a, 'bf', 0x1d5ee), # a-z + (0x0391, 0x03a9, 'bf', 0x1d756), # \Alpha-\Omega + (0x03b1, 0x03c9, 'bf', 0x1d770), # \alpha-\omega + (0x03d1, 0x03d1, 'bf', 0x1d78b), # theta variant + (0x03d5, 0x03d5, 'bf', 0x1d78d), # phi variant + (0x03d6, 0x03d6, 'bf', 0x1d78f), # pi variant + (0x03f0, 0x03f0, 'bf', 0x1d78c), # kappa variant + (0x03f1, 0x03f1, 'bf', 0x1d78e), # rho variant + (0x03f5, 0x03f5, 'bf', 0x1d78a), # lunate epsilon + (0x2202, 0x2202, 'bf', 0x1d789), # partial differential + (0x2207, 0x2207, 'bf', 0x1d76f), # \Nabla + ], + }, + 'tt': + [ + (0x0030, 0x0039, 'rm', 0x1d7f6), # 0-9 + (0x0041, 0x005a, 'rm', 0x1d670), # A-Z + (0x0061, 0x007a, 'rm', 0x1d68a) # a-z + ], + } + + Modified: trunk/matplotlib/lib/matplotlib/config/mplconfig.py =================================================================== --- trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2007-11-12 17:03:28 UTC (rev 4230) +++ trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2007-11-12 18:10:25 UTC (rev 4231) @@ -166,7 +166,7 @@ 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', 'custom') + fontset = T.Trait('cm', 'cm', 'stix', 'stixsans', 'custom') fallback_to_cm = T.true class axes(TConfig): Modified: trunk/matplotlib/lib/matplotlib/config/rcsetup.py =================================================================== --- trunk/matplotlib/lib/matplotlib/config/rcsetup.py 2007-11-12 17:03:28 UTC (rev 4230) +++ trunk/matplotlib/lib/matplotlib/config/rcsetup.py 2007-11-12 18:10:25 UTC (rev 4231) @@ -203,7 +203,7 @@ parse_fontconfig_pattern(s) return s -validate_fontset = ValidateInStrings('fontset', ['cm', 'stix', 'custom']) +validate_fontset = ValidateInStrings('fontset', ['cm', 'stix', 'stixsans', 'custom']) validate_verbose = ValidateInStrings('verbose',[ 'silent', 'helpful', 'debug', 'debug-annoying', Modified: trunk/matplotlib/lib/matplotlib/mathtext.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mathtext.py 2007-11-12 17:03:28 UTC (rev 4230) +++ trunk/matplotlib/lib/matplotlib/mathtext.py 2007-11-12 18:10:25 UTC (rev 4231) @@ -146,8 +146,7 @@ from matplotlib.ft2font import FT2Font, FT2Image, KERNING_DEFAULT, LOAD_FORCE_AUTOHINT, LOAD_NO_HINTING from matplotlib.font_manager import findfont, FontProperties from matplotlib._mathtext_data import latex_to_bakoma, \ - latex_to_standard, tex2uni, type12uni, tex2type1, uni2type1, \ - latex_to_cmex + latex_to_standard, tex2uni, latex_to_cmex, stix_virtual_fonts from matplotlib import get_data_path, rcParams #################### @@ -184,29 +183,6 @@ raise ValueError, message -#Not used, but might turn useful -def get_type1_name(symbol): - """get_type1_name(symbol) -> string - -Returns the the Type1 name of symbol. -symbol can be a single unicode character, or a TeX command (i.e. r'\pi'). - -""" - try:# This will succeed if symbol is a single unicode char - return uni2type1[ord(symbol)] - except TypeError: - pass - try:# Is symbol a TeX symbol (i.e. \alpha) - return tex2type1[symbol.strip("\\")] - except KeyError: - pass - # The symbol is already a Type1 name so return it - if isinstance(symbol, str): - return symbol - else: - # The user did not suply a valid symbol, show usage - raise ValueError, get_type1_name.__doc__ - class MathtextBackend(object): def __init__(self): self.fonts_object = None @@ -470,7 +446,7 @@ """ return 0. - def get_metrics(self, font, sym, fontsize, dpi): + def get_metrics(self, font, font_class, sym, fontsize, dpi): """ font: one of the TeX font names, tt, it, rm, cal, sf, bf or default (non-math) @@ -485,7 +461,7 @@ iceberg - the distance from the baseline to the top of the glyph. horiBearingY in Truetype parlance, height in TeX parlance """ - info = self._get_info(font, sym, fontsize, dpi) + info = self._get_info(font, font_class, sym, fontsize, dpi) return info.metrics def set_canvas_size(self, w, h, d): @@ -493,8 +469,8 @@ self.width, self.height, self.depth = ceil(w), ceil(h), ceil(d) self.mathtext_backend.set_canvas_size(self.width, self.height, self.depth) - def render_glyph(self, ox, oy, facename, sym, fontsize, dpi): - info = self._get_info(facename, sym, fontsize, dpi) + def render_glyph(self, ox, oy, facename, font_class, sym, fontsize, dpi): + info = self._get_info(facename, font_class, sym, fontsize, dpi) realpath, stat_key = get_realpath_and_stat(info.font.fname) used_characters = self.used_characters.setdefault( stat_key, (realpath, Set())) @@ -568,7 +544,10 @@ cached_font = self.fonts.get(basename) if cached_font is None: - font = FT2Font(basename) + try: + font = FT2Font(basename) + except RuntimeError: + return None cached_font = self.CachedFont(font) self.fonts[basename] = cached_font self.fonts[font.postscript_name] = cached_font @@ -580,15 +559,15 @@ return glyph.height/64.0/2.0 + 256.0/64.0 * dpi/72.0 return 0. - def _get_info (self, fontname, sym, fontsize, dpi, mark_as_used=True): + def _get_info(self, fontname, font_class, sym, fontsize, dpi): 'load the cmfont, metrics and glyph with caching' - key = fontname, sym, fontsize, dpi + key = fontname, font_class, sym, fontsize, dpi bunch = self.glyphd.get(key) if bunch is not None: return bunch cached_font, num, symbol_name, fontsize, slanted = \ - self._get_glyph(fontname, sym, fontsize) + self._get_glyph(fontname, font_class, sym, fontsize) font = cached_font.font font.set_size(fontsize, dpi) @@ -629,7 +608,7 @@ pclt = cached_font.font.get_sfnt_table('pclt') if pclt is None: # Some fonts don't store the xHeight, so we do a poor man's xHeight - metrics = self.get_metrics(font, 'x', fontsize, dpi) + metrics = self.get_metrics(font, 'it', 'x', fontsize, dpi) return metrics.iceberg xHeight = pclt['xHeight'] / 64.0 return xHeight @@ -638,11 +617,11 @@ cached_font = self._get_font(font) return max(1.0, cached_font.font.underline_thickness / 64.0 / fontsize * 10.0) - def get_kern(self, font1, sym1, fontsize1, - font2, sym2, fontsize2, dpi): + def get_kern(self, font1, fontclass1, sym1, fontsize1, + font2, fontclass2, sym2, fontsize2, dpi): if font1 == font2 and fontsize1 == fontsize2: - info1 = self._get_info(font1, sym1, fontsize1, dpi) - info2 = self._get_info(font2, sym2, fontsize2, dpi) + info1 = self._get_info(font1, fontclass1, sym1, fontsize1, dpi) + info2 = self._get_info(font2, fontclass2, sym2, fontsize2, dpi) font = info1.font return font.get_kerning(info1.num, info2.num, KERNING_DEFAULT) / 64.0 return 0.0 @@ -671,7 +650,7 @@ _slanted_symbols = Set(r"\int \oint".split()) - def _get_glyph(self, fontname, sym, fontsize): + def _get_glyph(self, fontname, font_class, sym, fontsize): symbol_name = None if fontname in self.fontmap and latex_to_bakoma.has_key(sym): basename, num = latex_to_bakoma[sym] @@ -682,11 +661,12 @@ elif len(sym) == 1: slanted = (fontname == "it") cached_font = self._get_font(fontname) - num = ord(sym) - gid = cached_font.charmap.get(num) - if gid is not None: - symbol_name = cached_font.font.get_glyph_name( - cached_font.charmap[num]) + if cached_font is not None: + num = ord(sym) + gid = cached_font.charmap.get(num) + if gid is not None: + symbol_name = cached_font.font.get_glyph_name( + cached_font.charmap[num]) if symbol_name is None: warn("Unrecognized symbol '%s'. Substituting with a dummy symbol." @@ -780,8 +760,11 @@ self.fontmap['ex'] = font _slanted_symbols = Set(r"\int \oint".split()) - - def _get_glyph(self, fontname, sym, fontsize): + + def _map_virtual_font(self, fontname, font_class, uniindex): + return fontname, uniindex + + def _get_glyph(self, fontname, font_class, sym, fontsize): found_symbol = False if self.use_cmex: @@ -800,6 +783,9 @@ sym.encode('ascii', 'backslashreplace'), MathTextWarning) + fontname, uniindex = self._map_virtual_font( + fontname, font_class, uniindex) + # Only characters in the "Letter" class should be italicized in 'it' # mode. Greek capital letters should be Roman. if found_symbol: @@ -807,26 +793,29 @@ if fontname == 'it': unistring = unichr(uniindex) - if (not unicodedata.category(unistring).startswith("L") + if (not unicodedata.category(unistring)[0] == "L" or unicodedata.name(unistring).startswith("GREEK CAPITAL")): new_fontname = 'rm' slanted = (new_fontname == 'it') or sym in self._slanted_symbols cached_font = self._get_font(new_fontname) - try: - glyphindex = cached_font.charmap[uniindex] - except KeyError: - warn("Font '%s' does not have a glyph for '%s'" % - (cached_font.font.postscript_name, - sym.encode('ascii', 'backslashreplace')), - MathTextWarning) - found_symbol = False + found_symbol = False + if cached_font is not None: + try: + glyphindex = cached_font.charmap[uniindex] + found_symbol = True + except KeyError: + warn("Font '%s' does not have a glyph for '%s'" % + (cached_font.font.postscript_name, + sym.encode('ascii', 'backslashreplace')), + MathTextWarning) if not found_symbol: if self.cm_fallback: warn("Substituting with a symbol from Computer Modern.", MathTextWarning) - return self.cm_fallback._get_glyph(fontname, sym, fontsize) + return self.cm_fallback._get_glyph( + fontname, 'it', sym, fontsize) else: warn("Substituting with a dummy symbol.", MathTextWarning) fontname = 'rm' @@ -847,10 +836,8 @@ class StixFonts(UnicodeFonts): _fontmap = { 'rm' : 'STIXGeneral', - 'tt' : 'VeraMono', 'it' : 'STIXGeneralItalic', 'bf' : 'STIXGeneralBol', - 'sf' : 'Vera', 'nonunirm' : 'STIXNonUni', 'nonuniit' : 'STIXNonUniIta', 'nonunibf' : 'STIXNonUniBol', @@ -867,6 +854,7 @@ cm_fallback = False def __init__(self, *args, **kwargs): + self._sans = kwargs.pop("sans", False) TruetypeFonts.__init__(self, *args, **kwargs) if not len(self.fontmap): for key, name in self._fontmap.iteritems(): @@ -874,20 +862,47 @@ self.fontmap[key] = fullpath self.fontmap[name] = fullpath - def _get_glyph(self, fontname, sym, fontsize): - # Handle calligraphic letters - if fontname == 'cal': - if len(sym) != 1 or ord(sym) < ord('A') or ord(sym) > ord('Z'): - raise ValueError(r"Sym '%s' is not available in \mathcal font" % sym) - fontname = 'nonuniit' - sym = unichr(ord(sym) + 0xe22d - ord('A')) + def _map_virtual_font(self, fontname, font_class, uniindex): + # Handle these "fonts" that are actually embedded in + # other fonts. + mapping = stix_virtual_fonts.get(fontname) + if self._sans and mapping is None: + mapping = stix_virtual_fonts['sf'] + doing_sans_conversion = True + else: + doing_sans_conversion = False + if mapping is not None: + if isinstance(mapping, dict): + mapping = mapping[font_class] + + # Binary search for the source glyph + lo = 0 + hi = len(mapping) + while lo < hi: + mid = (lo+hi)//2 + range = mapping[mid] + if uniindex < range[0]: + hi = mid + elif uniindex <= range[1]: + break + else: + lo = mid + 1 + + if uniindex >= range[0] and uniindex <= range[1]: + uniindex = uniindex - range[0] + range[3] + fontname = range[2] + elif not doing_sans_conversion: + # This will generate a dummy character + uniindex = 0x1 + fontname = 'it' + # Handle private use area glyphs if (fontname in ('it', 'rm', 'bf') and - len(sym) == 1 and ord(sym) >= 0xe000 and ord(sym) <= 0xf8ff): + uniindex >= 0xe000 and uniindex <= 0xf8ff): fontname = 'nonuni' + fontname - return UnicodeFonts._get_glyph(self, fontname, sym, fontsize) + return fontname, uniindex _size_alternatives = {} def get_sized_alternatives_for_symbol(self, fontname, sym): @@ -955,7 +970,7 @@ self.fonts[cached_font.get_fontname()] = cached_font return cached_font - def _get_info (self, fontname, sym, fontsize, dpi): + def _get_info (self, fontname, font_class, sym, fontsize, dpi): 'load the cmfont, metrics and glyph with caching' key = fontname, sym, fontsize, dpi tup = self.glyphd.get(key) @@ -1033,11 +1048,11 @@ return self.glyphd[key] - def get_kern(self, font1, sym1, fontsize1, - font2, sym2, fontsize2, dpi): + def get_kern(self, font1, fontclass1, sym1, fontsize1, + font2, fontclass2, sym2, fontsize2, dpi): if font1 == font2 and fontsize1 == fontsize2: - info1 = self._get_info(font1, sym1, fontsize1, dpi) - info2 = self._get_info(font2, sym2, fontsize2, dpi) + info1 = self._get_info(font1, fontclass1, sym1, fontsize1, dpi) + info2 = self._get_info(font2, fontclass2, sym2, fontsize2, dpi) font = info1.font return (font.get_kern_dist(info1.glyph, info2.glyph) * 0.001 * fontsize1) @@ -1173,6 +1188,7 @@ self.font_output = state.font_output assert isinstance(state.font, (str, unicode, int)) self.font = state.font + self.font_class = state.font_class self.fontsize = state.fontsize self.dpi = state.dpi # The real width, height and depth will be set during the @@ -1184,7 +1200,7 @@ def _update_metrics(self): metrics = self._metrics = self.font_output.get_metrics( - self.font, self.c, self.fontsize, self.dpi) + self.font, self.font_class, self.c, self.fontsize, self.dpi) if self.c == ' ': self.width = metrics.advance else: @@ -1203,8 +1219,8 @@ kern = 0. if isinstance(next, Char): kern = self.font_output.get_kern( - self.font, self.c, self.fontsize, - next.font, next.c, next.fontsize, + self.font, self.font_class, self.c, self.fontsize, + next.font, next.font_class, next.c, next.fontsize, self.dpi) return advance + kern @@ -1212,7 +1228,7 @@ """Render the character to the canvas""" self.font_output.render_glyph( x, y, - self.font, self.c, self.fontsize, self.dpi) + self.font, self.font_class, self.c, self.fontsize, self.dpi) def shrink(self): Node.shrink(self) @@ -1234,7 +1250,7 @@ are already offset correctly from the baseline in TrueType fonts.""" def _update_metrics(self): metrics = self._metrics = self.font_output.get_metrics( - self.font, self.c, self.fontsize, self.dpi) + self.font, self.font_class, self.c, self.fontsize, self.dpi) self.width = metrics.xmax - metrics.xmin self.height = metrics.ymax - metrics.ymin self.depth = 0 @@ -1251,7 +1267,7 @@ """Render the character to the canvas""" self.font_output.render_glyph( x - self._metrics.xmin, y + self._metrics.ymin, - self.font, self.c, self.fontsize, self.dpi) + self.font, self.font_class, self.c, self.fontsize, self.dpi) class List(Box): """A list of nodes (either horizontal or vertical). @@ -1936,7 +1952,9 @@ "tanh") fontname = oneOf("rm cal it tt sf bf") - latex2efont = oneOf("mathrm mathcal mathit mathtt mathsf mathbf mathdefault") + latex2efont = oneOf("mathrm mathcal mathit mathtt mathsf mathbf " + "mathdefault mathbb mathfrak mathcircled " + "mathscr") space =(FollowedBy(bslash) + (Literal(r'\ ') @@ -2093,7 +2111,7 @@ self._em_width_cache = {} def parse(self, s, fonts_object, fontsize, dpi): - self._state_stack = [self.State(fonts_object, 'default', fontsize, dpi)] + self._state_stack = [self.State(fonts_object, 'default', 'rm', fontsize, dpi)] try: self._expression.parseString(s) except ParseException, err: @@ -2108,10 +2126,11 @@ # entering and leaving a group { } or math/non-math, the stack # is pushed and popped accordingly. The current state always # exists in the top element of the stack. - class State: - def __init__(self, font_output, font, fontsize, dpi): + class State(object): + def __init__(self, font_output, font, font_class, fontsize, dpi): self.font_output = font_output - self.font = font + self._font = font + self.font_class = font_class self.fontsize = fontsize self.dpi = dpi @@ -2119,9 +2138,18 @@ return Parser.State( self.font_output, self.font, + self.font_class, self.fontsize, self.dpi) + def _get_font(self): + return self._font + def _set_font(self, name): + if name in ('it', 'rm', 'bf'): + self.font_class = name + self._font = name + font = property(_get_font, _set_font) + def get_state(self): return self._state_stack[-1] @@ -2159,7 +2187,7 @@ width = self._em_width_cache.get(key) if width is None: metrics = state.font_output.get_metrics( - state.font, 'm', state.fontsize, state.dpi) + state.font, 'it', 'm', state.fontsize, state.dpi) width = metrics.advance self._em_width_cache[key] = width return Kern(width * percentage) @@ -2474,7 +2502,7 @@ # Shift so the fraction line sits in the middle of the # equals sign metrics = state.font_output.get_metrics( - state.font, '=', state.fontsize, state.dpi) + state.font, 'it', '=', state.fontsize, state.dpi) shift = (cden.height - ((metrics.ymax + metrics.ymin) / 2 - thickness * 3.0)) @@ -2594,10 +2622,12 @@ font_output = BakomaFonts(prop, backend) elif fontset == 'stix': font_output = StixFonts(prop, backend) + elif fontset == 'stixsans': + font_output = StixFonts(prop, backend, sans=True) elif fontset == 'custom': font_output = UnicodeFonts(prop, backend) else: - raise ValueError("mathtext.fontset must be either 'cm', 'stix', or 'custom'") + raise ValueError("mathtext.fontset must be either 'cm', 'stix', 'stixsans', or 'custom'") fontsize = prop.get_size_in_points() Modified: trunk/matplotlib/lib/matplotlib/rcsetup.py =================================================================== --- trunk/matplotlib/lib/matplotlib/rcsetup.py 2007-11-12 17:03:28 UTC (rev 4230) +++ trunk/matplotlib/lib/matplotlib/rcsetup.py 2007-11-12 18:10:25 UTC (rev 4231) @@ -203,7 +203,7 @@ parse_fontconfig_pattern(s) return s -validate_fontset = ValidateInStrings('fontset', ['cm', 'stix', 'custom']) +validate_fontset = ValidateInStrings('fontset', ['cm', 'stix', 'stixsans', 'custom']) validate_verbose = ValidateInStrings('verbose',[ 'silent', 'helpful', 'debug', 'debug-annoying', Modified: trunk/matplotlib/matplotlibrc.template =================================================================== --- trunk/matplotlib/matplotlibrc.template 2007-11-12 17:03:28 UTC (rev 4230) +++ trunk/matplotlib/matplotlibrc.template 2007-11-12 18:10:25 UTC (rev 4231) @@ -168,7 +168,8 @@ #mathtext.it : serif:italic #mathtext.bf : serif:bold #mathtext.sf : sans -#mathtext.fontset : cm # Should be 'cm' (Computer Modern), 'stix' or 'custom' +#mathtext.fontset : cm # Should be 'cm' (Computer Modern), 'stix', + # 'stixsans' or 'custom' #mathtext.fallback_to_cm : True # When True, use symbols from the Computer Modern # fonts when a symbol can not be found in one of # the custom math fonts. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-11-12 20:27:36
|
Revision: 4237 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4237&view=rev Author: mdboom Date: 2007-11-12 12:27:33 -0800 (Mon, 12 Nov 2007) Log Message: ----------- [ 1448342 ] FigureCanvasAgg.print_figure fails with StringIO 'file' Added support to write png to an arbitrary Python file-like object in the agg backend. Will continue to use faster C-only calls if the file-like object is in fact a file. Also, clean up exception handling in write_png. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py trunk/matplotlib/src/_backend_agg.cpp Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2007-11-12 20:08:11 UTC (rev 4236) +++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2007-11-12 20:27:33 UTC (rev 4237) @@ -415,5 +415,5 @@ def print_png(self, filename, *args, **kwargs): self.draw() - self.get_renderer()._renderer.write_png(str(filename), self.figure.dpi.get()) + self.get_renderer()._renderer.write_png(filename, self.figure.dpi.get()) Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2007-11-12 20:08:11 UTC (rev 4236) +++ trunk/matplotlib/src/_backend_agg.cpp 2007-11-12 20:27:33 UTC (rev 4237) @@ -2256,7 +2256,22 @@ } +static void write_png_data(png_structp png_ptr, png_bytep data, png_size_t length) { + PyObject* py_file_obj = (PyObject*)png_get_io_ptr(png_ptr); + PyObject* write_method = PyObject_GetAttrString(py_file_obj, "write"); + PyObject_CallFunction(write_method, "s#", data, length); + + // MGDTODO: Check NULL on failure +} +static void flush_png_data(png_structp png_ptr) { + PyObject* py_file_obj = (PyObject*)png_get_io_ptr(png_ptr); + PyObject* flush_method = PyObject_GetAttrString(py_file_obj, "write"); + if (flush_method) { + PyObject_CallFunction(flush_method, ""); + } +} + // this code is heavily adapted from the paint license, which is in // the file paint.license (BSD compatible) included in this // distribution. TODO, add license file to MANIFEST.in and CVS @@ -2267,97 +2282,96 @@ args.verify_length(1, 2); - FILE *fp; - Py::Object o = Py::Object(args[0]); - bool fpclose = true; - if (o.isString()) { - std::string fileName = Py::String(o); + FILE *fp = NULL; + Py::Object py_fileobj = Py::Object(args[0]); + if (py_fileobj.isString()) { + std::string fileName = Py::String(py_fileobj); const char *file_name = fileName.c_str(); if ((fp = fopen(file_name, "wb")) == NULL) throw Py::RuntimeError( Printf("Could not open file %s", file_name).str() ); } else { - if ((fp = PyFile_AsFile(o.ptr())) == NULL) - throw Py::TypeError("Could not convert object to file pointer"); - fpclose = false; + if ((fp = PyFile_AsFile(py_fileobj.ptr())) == NULL) { + PyObject* write_method = PyObject_GetAttrString(py_fileobj.ptr(), "write"); + if (!(write_method && PyCallable_Check(write_method))) + throw Py::TypeError("Object does not appear to be a Python file-like object"); + } } + + png_bytep *row_pointers = NULL; + png_structp png_ptr = NULL; + png_infop info_ptr = NULL; - png_structp png_ptr; - png_infop info_ptr; - struct png_color_8_struct sig_bit; - png_uint_32 row; + try { + struct png_color_8_struct sig_bit; + png_uint_32 row; + + row_pointers = new png_bytep[height]; + for (row = 0; row < height; ++row) { + row_pointers[row] = pixBuffer + row * width * 4; + } - png_bytep *row_pointers = new png_bytep[height]; - for (row = 0; row < height; ++row) { - row_pointers[row] = pixBuffer + row * width * 4; - } + png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + if (png_ptr == NULL) { + throw Py::RuntimeError("Could not create write struct"); + } + info_ptr = png_create_info_struct(png_ptr); + if (info_ptr == NULL) { + throw Py::RuntimeError("Could not create info struct"); + } - if (fp == NULL) { - delete [] row_pointers; - throw Py::RuntimeError("Could not open file"); - } + if (setjmp(png_ptr->jmpbuf)) { + throw Py::RuntimeError("Error building image"); + } - - png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - if (png_ptr == NULL) { - if (fpclose) fclose(fp); - delete [] row_pointers; - throw Py::RuntimeError("Could not create write struct"); - } - - info_ptr = png_create_info_struct(png_ptr); - if (info_ptr == NULL) { - if (fpclose) fclose(fp); - png_destroy_write_struct(&png_ptr, &info_ptr); - delete [] row_pointers; - throw Py::RuntimeError("Could not create info struct"); - } - - if (setjmp(png_ptr->jmpbuf)) { - if (fpclose) fclose(fp); - png_destroy_write_struct(&png_ptr, &info_ptr); - delete [] row_pointers; - throw Py::RuntimeError("Error building image"); - } - - png_init_io(png_ptr, fp); - png_set_IHDR(png_ptr, info_ptr, - width, height, 8, - PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE, - PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); + if (fp) { + png_init_io(png_ptr, fp); + } else { + png_set_write_fn(png_ptr, (void*)py_fileobj.ptr(), + &write_png_data, &flush_png_data); + } + png_set_IHDR(png_ptr, info_ptr, + width, height, 8, + PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE, + PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); - // Save the dpi of the image in the file - if (args.size() == 2) { - double dpi = Py::Float(args[1]); - size_t dots_per_meter = (size_t)(dpi / (2.54 / 100.0)); - png_set_pHYs(png_ptr, info_ptr, dots_per_meter, dots_per_meter, PNG_RESOLUTION_METER); + // Save the dpi of the image in the file + if (args.size() == 2) { + double dpi = Py::Float(args[1]); + size_t dots_per_meter = (size_t)(dpi / (2.54 / 100.0)); + png_set_pHYs(png_ptr, info_ptr, dots_per_meter, dots_per_meter, PNG_RESOLUTION_METER); + } + + // this a a color image! + sig_bit.gray = 0; + sig_bit.red = 8; + sig_bit.green = 8; + sig_bit.blue = 8; + /* if the image has an alpha channel then */ + sig_bit.alpha = 8; + png_set_sBIT(png_ptr, info_ptr, &sig_bit); + + png_write_info(png_ptr, info_ptr); + png_write_image(png_ptr, row_pointers); + png_write_end(png_ptr, info_ptr); + + /* Changed calls to png_destroy_write_struct to follow + http://www.libpng.org/pub/png/libpng-manual.txt. + This ensures the info_ptr memory is released. + */ + + } catch (...) { + if (fp) fclose(fp); + delete [] row_pointers; + if (png_ptr && info_ptr) png_destroy_write_struct(&png_ptr, &info_ptr); + throw; } - // this a a color image! - sig_bit.gray = 0; - sig_bit.red = 8; - sig_bit.green = 8; - sig_bit.blue = 8; - /* if the image has an alpha channel then */ - sig_bit.alpha = 8; - png_set_sBIT(png_ptr, info_ptr, &sig_bit); - - png_write_info(png_ptr, info_ptr); - png_write_image(png_ptr, row_pointers); - png_write_end(png_ptr, info_ptr); - - /* Changed calls to png_destroy_write_struct to follow - http://www.libpng.org/pub/png/libpng-manual.txt. - This ensures the info_ptr memory is released. - */ - png_destroy_write_struct(&png_ptr, &info_ptr); - delete [] row_pointers; - - if (fpclose) fclose(fp); - + if (fp) fclose(fp); + return Py::Object(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-11-12 20:45:18
|
Revision: 4238 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4238&view=rev Author: mdboom Date: 2007-11-12 12:45:15 -0800 (Mon, 12 Nov 2007) Log Message: ----------- [ 1358130 ] Cannot get underscore in mathtext Fixed. Modified Paths: -------------- trunk/matplotlib/examples/mathtext_examples.py trunk/matplotlib/lib/matplotlib/_mathtext_data.py trunk/matplotlib/lib/matplotlib/mathtext.py Modified: trunk/matplotlib/examples/mathtext_examples.py =================================================================== --- trunk/matplotlib/examples/mathtext_examples.py 2007-11-12 20:27:33 UTC (rev 4237) +++ trunk/matplotlib/examples/mathtext_examples.py 2007-11-12 20:45:15 UTC (rev 4238) @@ -6,7 +6,7 @@ stests = [ r'Kerning: AVA $AVA$', - r'\$100.00 $\alpha$', + r'\$100.00 $\alpha \_$', r'$\frac{\$100.00}{y}$', r'$x y$', r'$x+y\ x=y\ x<y\ x:y\ x,y\ x@y$', Modified: trunk/matplotlib/lib/matplotlib/_mathtext_data.py =================================================================== --- trunk/matplotlib/lib/matplotlib/_mathtext_data.py 2007-11-12 20:27:33 UTC (rev 4237) +++ trunk/matplotlib/lib/matplotlib/_mathtext_data.py 2007-11-12 20:45:15 UTC (rev 4238) @@ -117,6 +117,7 @@ r'%' : ('cmr10', 48), r'\$' : ('cmr10', 99), r'@' : ('cmr10', 111), + r'\_' : ('cmtt10', 79), r'\Gamma' : ('cmr10', 19), r'\Delta' : ('cmr10', 6), r'\Theta' : ('cmr10', 7), @@ -2236,6 +2237,7 @@ '$': 36, '{': 123, '}': 125, +'_': 95, 'imath': 0x131, 'circumflexaccent' : 770, 'combiningbreve' : 774, Modified: trunk/matplotlib/lib/matplotlib/mathtext.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mathtext.py 2007-11-12 20:27:33 UTC (rev 4237) +++ trunk/matplotlib/lib/matplotlib/mathtext.py 2007-11-12 20:45:15 UTC (rev 4238) @@ -1975,7 +1975,7 @@ ).setParseAction(self.customspace).setName('customspace') unicode_range = u"\U00000080-\U0001ffff" - symbol =(Regex(UR"([a-zA-Z0-9 +\-*/<>=:,.;!'@()%s])|(\\[%%${}\[\]])" % unicode_range) + symbol =(Regex(UR"([a-zA-Z0-9 +\-*/<>=:,.;!'@()%s])|(\\[%%${}\[\]_])" % unicode_range) | Combine( bslash + oneOf(tex2uni.keys()) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ds...@us...> - 2007-11-12 22:00:20
|
Revision: 4239 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4239&view=rev Author: dsdale Date: 2007-11-12 14:00:15 -0800 (Mon, 12 Nov 2007) Log Message: ----------- expose remaining build options in setup.cfg. See setup.cfg for details Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/configobj.py trunk/matplotlib/lib/dateutil/__init__.py trunk/matplotlib/lib/pytz/__init__.py trunk/matplotlib/setup.cfg.template trunk/matplotlib/setup.py trunk/matplotlib/setupext.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2007-11-12 20:45:15 UTC (rev 4238) +++ trunk/matplotlib/CHANGELOG 2007-11-12 22:00:15 UTC (rev 4239) @@ -1,3 +1,9 @@ +2007-11-12 Exposed all the build options in setup.cfg. These options are + read into a dict called "options" by setupext.py. Also, added + "-mpl" tags to the version strings for packages provided by + matplotlib. Versions provided by mpl will be identified and + updated on subsequent installs - DSD + 2007-11-12 Added support for STIX fonts. A new rcParam, mathtext.fontset, can be used to choose between: Modified: trunk/matplotlib/lib/configobj.py =================================================================== --- trunk/matplotlib/lib/configobj.py 2007-11-12 20:45:15 UTC (rev 4238) +++ trunk/matplotlib/lib/configobj.py 2007-11-12 22:00:15 UTC (rev 4239) @@ -109,7 +109,7 @@ True, False = 1, 0 -__version__ = '4.4.0' +__version__ = '4.4.0-mpl' __revision__ = '$Id: configobj.py 156 2006-01-31 14:57:08Z fuzzyman $' Modified: trunk/matplotlib/lib/dateutil/__init__.py =================================================================== --- trunk/matplotlib/lib/dateutil/__init__.py 2007-11-12 20:45:15 UTC (rev 4238) +++ trunk/matplotlib/lib/dateutil/__init__.py 2007-11-12 22:00:15 UTC (rev 4239) @@ -6,4 +6,4 @@ """ __author__ = "Gustavo Niemeyer <gu...@ni...>" __license__ = "PSF License" -__version__ = "1.2" +__version__ = "1.2-mpl" Modified: trunk/matplotlib/lib/pytz/__init__.py =================================================================== --- trunk/matplotlib/lib/pytz/__init__.py 2007-11-12 20:45:15 UTC (rev 4238) +++ trunk/matplotlib/lib/pytz/__init__.py 2007-11-12 22:00:15 UTC (rev 4239) @@ -12,7 +12,7 @@ OLSON_VERSION = '2007g' VERSION = OLSON_VERSION #VERSION = OLSON_VERSION + '.2' -__version__ = OLSON_VERSION +__version__ = OLSON_VERSION+'-mpl' OLSEN_VERSION = OLSON_VERSION # Old releases had this misspelling Modified: trunk/matplotlib/setup.cfg.template =================================================================== --- trunk/matplotlib/setup.cfg.template 2007-11-12 20:45:15 UTC (rev 4238) +++ trunk/matplotlib/setup.cfg.template 2007-11-12 22:00:15 UTC (rev 4239) @@ -13,7 +13,11 @@ [provide_packages] # By default, matplotlib checks for a few dependencies and # installs them if missing. This feature can be turned off -# by uncommenting the following lines: +# by uncommenting the following lines. Acceptible values are: +# True: install, overwrite an existing installation +# False: do not install +# auto: install only if the package is unavailable. This +# is the default behavior # ## Date/timezone support: #pytz = False @@ -40,8 +44,34 @@ # installed on your system. # # You can uncomment any the following lines if you know you do -# not want to use the GUI toolkit. +# not want to use the GUI toolkit. Acceptible values are: +# True: build the extension. Exits with a warning if the +# required dependencies are not available +# False: do not build the extension +# auto: build if the required dependencies are available, +# otherwise skip silently. This is the default +# behavior +# #gtk = False #gtkagg = False #tkagg = False #wxagg = False + +[rc_options] +# User-configurable options +# +# Default backend, one of: Agg, Cairo, CocoaAgg, GTK, GTKAgg, +# GTKCairo, FltkAgg, QtAgg, Qt4Agg, SVG, TkAgg, WX, WXAgg. +# Only the Agg and SVG backends do not require external +# dependencies. Do not choose GTK, GTKAgg, GTKCairo, TkAgg or +# WXAgg if you have disabled the relevent extension modules. +# Agg will be used by default. +#backend = Agg +# +# The numerix module was historically used to provide +# compatibility between the Numeric, numarray, and NumPy array +# packages. Now that NumPy has emerge as the universal array +# package for python, numerix is not really necessary and is +# maintained to provide backward compatibility. Do not change +# this unless you have a compelling reason to do so. +#numerix = numpy Modified: trunk/matplotlib/setup.py =================================================================== --- trunk/matplotlib/setup.py 2007-11-12 20:45:15 UTC (rev 4238) +++ trunk/matplotlib/setup.py 2007-11-12 22:00:15 UTC (rev 4239) @@ -3,74 +3,19 @@ matplotlib, inlcuding the *-devel versions of these libraries if you are using a package manager like RPM or debian. -matplotlib has added some extension module code which can optionally -be built by setting the appropriate flag below. - -The GTKAgg and TkAgg will try to build if they detect pygtk or Tkinter -respectively; set them to 0 if you do not want to build them +The matplotlib build options can be modified with a setup.cfg file. See +setup.cfg.template for more information. """ -rc = {'backend':'PS', 'numerix':'numpy'} - -# build the image support module - requires agg. By default, matplotlib will -# build support for whatever array packages you have installed. -BUILD_IMAGE = 1 - - -# build a small extension to manage the focus on win32 platforms. -#BUILD_WINDOWING = 0 -BUILD_WINDOWING = 'auto' - - VERBOSE = False # insert lots of diagnostic prints in extension code +# This dict will be updated as we try to select the best option during +# the build process. However, values in setup.cfg will be used, if +# defined. +rc = {'backend':'Agg', 'numerix':'numpy'} - -## You shouldn't need to customize below this point -import ConfigParser -import os - -# Build the antigrain geometry toolkit. Agg makes heavy use of -# templates, so it probably requires a fairly recent compiler to build -# it. It makes very nice antialiased output and also supports alpha -# blending -BUILD_AGG = 1 -BUILD_GTKAGG = 1 -BUILD_GTK = 1 - -# build TK GUI with Agg renderer ; requires Tkinter Python extension -# and Tk includes -# Use False or 0 if you don't want to build -BUILD_TKAGG = 'auto' - - -# build wxPython extension code to efficiently blit agg into wx. Only -# needed for wxpython <2.8 if you plan on doing animations -BUILD_WXAGG = 1 - -if os.path.exists("setup.cfg"): - config = ConfigParser.SafeConfigParser() - config.read("setup.cfg") - try: - BUILD_GTK = config.getboolean("gui_support", "gtk") - except: - pass - try: - BUILD_GTKAGG = config.getboolean("gui_support", "gtkagg") - except: - pass - try: - BUILD_TKAGG = config.getboolean("gui_support", "tkagg") - except: - pass - try: - BUILD_WXAGG = config.getboolean("gui_support", "wxagg") - except: - pass - - # BEFORE importing disutils, remove MANIFEST. distutils doesn't properly # update it when the contents of directories change. import os @@ -106,7 +51,7 @@ check_for_cairo, check_provide_traits, check_provide_pytz, \ check_provide_dateutil, check_provide_configobj, check_for_dvipng, \ check_for_ghostscript, check_for_latex, check_for_pdftops, \ - check_for_datetime + check_for_datetime, options #import distutils.sysconfig # jdh @@ -127,12 +72,6 @@ ext_modules = [] -# these are not optional -BUILD_FT2FONT = 1 -BUILD_TTCONV = 1 -BUILD_CONTOUR = 1 -BUILD_NXUTILS = 1 - for line in file('lib/matplotlib/__init__.py').readlines(): if (line.startswith('__version__')): exec(line.strip()) @@ -166,16 +105,6 @@ if not check_for_numpy(): sys.exit() -# The NUMERIX variable (a list) is left over from the days when it had -# a string for each of the supported backends. Now there is only one -# supported backend, so this approach could (should?) get changed for -# simplicity. - -import numpy -NUMERIX = ['numpy'] - -rc['numerix'] = NUMERIX[-1] - try: import subprocess except ImportError: havesubprocess = False else: havesubprocess = True @@ -196,61 +125,64 @@ if not check_for_freetype(): sys.exit(1) -if BUILD_FT2FONT: - build_ft2font(ext_modules, packages) +build_ft2font(ext_modules, packages) +build_ttconv(ext_modules, packages) +build_contour(ext_modules, packages) +build_nxutils(ext_modules, packages) -if BUILD_TTCONV: - build_ttconv(ext_modules, packages) - -if 1: # I don't think we need to make these optional - build_contour(ext_modules, packages) - build_nxutils(ext_modules, packages) - build_swigagg(ext_modules, packages) build_transforms(ext_modules, packages) print_raw("") print_raw("OPTIONAL BACKEND DEPENDENCIES") -if check_for_gtk() and (BUILD_GTK or BUILD_GTKAGG): - if BUILD_GTK: + +# the options can be True, False, or 'auto'. If True, try to build +# regardless of the lack of dependencies. If auto, silently skip +# when dependencies are missing. +hasgtk = check_for_gtk() +if options['build_gtk']: + if hasgtk or (options['build_gtk'] is True): build_gdk(ext_modules, packages) rc['backend'] = 'GTK' - if BUILD_GTKAGG: - BUILD_AGG = 1 +if options['build_gtkagg']: + if hasgtk or (options['build_gtkagg'] is True): + options['build_agg'] = 1 build_gtkagg(ext_modules, packages) rc['backend'] = 'GTKAgg' -if check_for_tk() and BUILD_TKAGG: - BUILD_AGG = 1 - build_tkagg(ext_modules, packages) - rc['backend'] = 'TkAgg' +if options['build_tkagg']: + if check_for_tk() or (options['build_tkagg'] is True): + options['build_agg'] = 1 + build_tkagg(ext_modules, packages) + rc['backend'] = 'TkAgg' -explanation = None -if check_for_wx() and BUILD_WXAGG: - BUILD_AGG = 1 - import wx - if getattr(wx, '__version__', '0.0')[0:3] < '2.8': - build_wxagg(ext_modules, packages) - wxagg_backend_status = "yes" - else: - print_message("WxAgg extension not required for wxPython >= 2.8") - rc['backend'] = 'WXAgg' +if options['build_wxagg']: + if check_for_wx() or (options['build_wxagg'] is True): + options['build_agg'] = 1 + import wx + if getattr(wx, '__version__', '0.0')[0:3] < '2.8' : + build_wxagg(ext_modules, packages) + wxagg_backend_status = "yes" + else: + print_message("WxAgg extension not required for wxPython >= 2.8") + rc['backend'] = 'WXAgg' -# These are informational only. We don't build -# any extensions for them. +# These are informational only. We don't build any extensions for them. check_for_qt() check_for_qt4() check_for_cairo() -if check_for_libpng() and BUILD_AGG: +if check_for_libpng() and options['build_agg']: build_agg(ext_modules, packages) - if rc['backend'] == 'PS': rc['backend'] = 'Agg' + rc['backend'] = 'Agg' +else: + rc['backend'] = 'SVG' -if BUILD_WINDOWING and sys.platform=='win32': +if options['build_windowing'] and sys.platform=='win32': build_windowing(ext_modules, packages) -if BUILD_IMAGE: +if options['build_image']: build_image(ext_modules, packages) for mod in ext_modules: @@ -314,12 +246,13 @@ print_raw("[Edit setup.cfg to suppress the above messages]") print_line() -# packagers: set rc['numerix'] and rc['backend'] here to override the auto -# defaults, eg -#rc['numerix'] = numpy -#rc['backend'] = 'GTKAgg' +# Write the default matplotlibrc file if sys.platform=='win32': - rc = dict(backend='TkAgg', numerix='numpy') + rc['backend'] = 'TkAgg' + rc['numerix'] = 'numpy' +else: + if options['backend']: rc['backend'] = options['backend'] + if options['numerix']: rc['numerix'] = options['numerix'] template = file('matplotlibrc.template').read() file('lib/matplotlib/mpl-data/matplotlibrc', 'w').write(template%rc) Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2007-11-12 20:45:15 UTC (rev 4238) +++ trunk/matplotlib/setupext.py 2007-11-12 22:00:15 UTC (rev 4239) @@ -97,38 +97,64 @@ # for nonstandard installation/build with --prefix variable numpy_inc_dirs = [] -# Based on the contents of setup.cfg, determine if the status block -# should be displayed, if missing external packages should be provided -display_status = True -provide_pytz = True -provide_dateutil = True -provide_configobj = True -provide_traits = True +# matplotlib build options, which can be altered using setup.cfg +options = {'display_status': True, + 'provide_pytz': 'auto', + 'provide_dateutil': 'auto', + 'provide_configobj': 'auto', + 'provide_traits': 'auto', + 'build_agg': True, + 'build_gtk': 'auto', + 'build_gtkagg': 'auto', + 'build_tkagg': 'auto', + 'build_wxagg': 'auto', + 'build_image': True, + 'build_windowing': True, + 'backend': None, + 'numerix': None} + +# Based on the contents of setup.cfg, determine the build options if os.path.exists("setup.cfg"): config = ConfigParser.SafeConfigParser() config.read("setup.cfg") - try: - display_status = not config.getboolean("status", "suppress") - except: - pass - try: - provide_pytz = config.getboolean("provide_packages", "pytz") - except: - pass - try: - provide_dateutil = config.getboolean("provide_packages", "dateutil") - except: - pass - try: - provide_configobj = config.getboolean("provide_packages", "configobj") - except: - pass - try: - provide_traits = config.getboolean("provide_packages", "enthought.traits") - except: - pass + try: options['display_status'] = not config.getboolean("status", "suppress") + except: pass -if display_status: + try: options['provide_pytz'] = config.getboolean("provide_packages", "pytz") + except: options['provide_pytz'] = 'auto' + + try: options['provide_dateutil'] = config.getboolean("provide_packages", + "dateutil") + except: options['provide_dateutil'] = 'auto' + + try: options['provide_configobj'] = config.getboolean("provide_packages", + "configobj") + except: options['provide_configobj'] = 'auto' + + try: options['provide_traits'] = config.getboolean("provide_packages", + "enthought.traits") + except: options['provide_traits'] = 'auto' + + try: options['build_gtk'] = config.getboolean("gui_support", "gtk") + except: options['build_gtk'] = 'auto' + + try: options['build_gtkagg'] = config.getboolean("gui_support", "gtkagg") + except: options['build_gtkagg'] = 'auto' + + try: options['build_tkagg'] = config.getboolean("gui_support", "tkagg") + except: options['build_tkagg'] = 'auto' + + try: options['build_wxagg'] = config.getboolean("gui_support", "wxagg") + except: options['build_wxagg'] = 'auto' + + try: options['backend'] = config.get("rc_options", "backend") + except: pass + + try: options['numerix'] = config.get("rc_options", "numerix") + except: pass + + +if options['display_status']: def print_line(char='='): print char * 76 @@ -356,24 +382,34 @@ return True def check_provide_pytz(hasdatetime=True): + if hasdatetime and (options['provide_pytz'] is True): + print_status("pytz", "matplotlib will provide") + return True try: import pytz except ImportError: - if hasdatetime and provide_pytz: + if hasdatetime and options['provide_pytz']: print_status("pytz", "matplotlib will provide") return True else: print_status("pytz", "no") return False else: - print_status("pytz", pytz.__version__) - return False + if pytz.__version__.endswith('mpl'): + print_status("pytz", "matplotlib will provide") + return True + else: + print_status("pytz", pytz.__version__) + return False def check_provide_dateutil(hasdatetime=True): + if hasdatetime and (options['provide_dateutil'] is True): + print_status("dateutil", "matplotlib will provide") + return True try: import dateutil except ImportError: - if hasdatetime and provide_dateutil: + if hasdatetime and options['provide_dateutil']: print_status("dateutil", "matplotlib will provide") return True else: @@ -381,26 +417,41 @@ return False else: try: - print_status("dateutil", dateutil.__version__) + if dateutil.__version__.endswith('mpl'): + print_status("dateutil", "matplotlib will provide") + return True + else: + print_status("dateutil", dateutil.__version__) + return False except AttributeError: print_status("dateutil", "present, version unknown") - return False + return False def check_provide_configobj(): + if options['provide_configobj'] is True: + print_status("configobj", "matplotlib will provide") + return True try: import configobj except ImportError: - if provide_configobj: + if options['provide_configobj']: print_status("configobj", "matplotlib will provide") return True else: print_status("configobj", "no") return False else: - print_status("configobj", configobj.__version__) - return False + if configobj.__version__.endswith('mpl'): + print_status("configobj", "matplotlib will provide") + return True + else: + print_status("configobj", configobj.__version__) + return False def check_provide_traits(): + if options['provide_traits'] is True: + print_status("enthought.traits", "matplotlib will provide") + return True try: from enthought import traits try: @@ -416,7 +467,7 @@ print_status("enthought.traits", version.version) return False except ImportError: - if provide_traits: + if options['provide_traits']: print_status("enthought.traits", "matplotlib will provide") return True else: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ds...@us...> - 2007-11-12 23:38:15
|
Revision: 4241 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4241&view=rev Author: dsdale Date: 2007-11-12 15:38:12 -0800 (Mon, 12 Nov 2007) Log Message: ----------- expose verbose build option in setup.cfg Modified Paths: -------------- trunk/matplotlib/setup.cfg.template trunk/matplotlib/setup.py trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setup.cfg.template =================================================================== --- trunk/matplotlib/setup.cfg.template 2007-11-12 23:29:44 UTC (rev 4240) +++ trunk/matplotlib/setup.cfg.template 2007-11-12 23:38:12 UTC (rev 4241) @@ -7,8 +7,10 @@ [status] # To suppress display of the dependencies and their versions # at the top of the build log, uncomment the following line: +#suppress = True # -#suppress = True +# Uncomment to insert lots of diagnostic prints in extension code +#verbose = True [provide_packages] # By default, matplotlib checks for a few dependencies and Modified: trunk/matplotlib/setup.py =================================================================== --- trunk/matplotlib/setup.py 2007-11-12 23:29:44 UTC (rev 4240) +++ trunk/matplotlib/setup.py 2007-11-12 23:38:12 UTC (rev 4241) @@ -7,9 +7,6 @@ setup.cfg.template for more information. """ - -VERBOSE = False # insert lots of diagnostic prints in extension code - # This dict will be updated as we try to select the best option during # the build process. However, values in setup.cfg will be used, if # defined. @@ -186,7 +183,7 @@ build_image(ext_modules, packages) for mod in ext_modules: - if VERBOSE: + if options['verbose']: mod.extra_compile_args.append('-DVERBOSE') print_raw("") Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2007-11-12 23:29:44 UTC (rev 4240) +++ trunk/matplotlib/setupext.py 2007-11-12 23:38:12 UTC (rev 4241) @@ -99,6 +99,7 @@ # matplotlib build options, which can be altered using setup.cfg options = {'display_status': True, + 'verbose': False, 'provide_pytz': 'auto', 'provide_dateutil': 'auto', 'provide_configobj': 'auto', @@ -117,9 +118,13 @@ if os.path.exists("setup.cfg"): config = ConfigParser.SafeConfigParser() config.read("setup.cfg") + try: options['display_status'] = not config.getboolean("status", "suppress") except: pass + try: options['verbose'] = not config.getboolean("status", "verbose") + except: pass + try: options['provide_pytz'] = config.getboolean("provide_packages", "pytz") except: options['provide_pytz'] = 'auto' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ds...@us...> - 2007-11-13 13:50:30
|
Revision: 4242 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4242&view=rev Author: dsdale Date: 2007-11-13 05:50:29 -0800 (Tue, 13 Nov 2007) Log Message: ----------- updated creation of default config files at build time: * modify matplotlib.conf based on available backends and setup.cfg * modify backend selection: SVG, Agg, TkAgg, WXAgg, GTK, GTKAgg, selection in setup.cfg Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/config/mplconfig.py trunk/matplotlib/setup.py Added Paths: ----------- trunk/matplotlib/lib/matplotlib/mpl-data/matplotlib.conf.template Removed Paths: ------------- trunk/matplotlib/lib/matplotlib/mpl-data/matplotlib.conf trunk/matplotlib/lib/matplotlib/mpl-data/matplotlib.conf.backup Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2007-11-12 23:38:12 UTC (rev 4241) +++ trunk/matplotlib/CHANGELOG 2007-11-13 13:50:29 UTC (rev 4242) @@ -1,3 +1,12 @@ +2007-11-13 Improved the default backend selection at build time: + SVG -> Agg -> TkAgg -> WXAgg -> GTK -> GTKAgg. The last usable + backend in this progression will be chosen in the default + config file. If a backend is defined in setup.cfg, that will + be the default backend - DSD + +2007-11-13 Improved creation of default config files at build time for + traited config package - DSD + 2007-11-12 Exposed all the build options in setup.cfg. These options are read into a dict called "options" by setupext.py. Also, added "-mpl" tags to the version strings for packages provided by Modified: trunk/matplotlib/lib/matplotlib/config/mplconfig.py =================================================================== --- trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2007-11-12 23:38:12 UTC (rev 4241) +++ trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2007-11-13 13:50:29 UTC (rev 4242) @@ -65,7 +65,7 @@ class backend(TConfig): """Valid backends are: 'GTKAgg', 'GTKCairo', 'QtAgg', 'Qt4Agg', 'TkAgg', 'Agg', 'Cairo', 'PS', 'PDF', 'SVG'""" - use = T.Trait('TkAgg', mplT.BackendHandler()) + use = T.Trait('Agg', mplT.BackendHandler()) class cairo(TConfig): format = T.Trait('png', 'png', 'ps', 'pdf', 'svg') @@ -525,5 +525,5 @@ ############################################################################## if __name__ == "__main__": mplConfig = MPLConfig() - tconf2File(mplConfig, '../mpl-data/matplotlib.conf', force=True) - print 'Default matplotlib.conf created in ../mpl-data' + tconf2File(mplConfig, '../mpl-data/matplotlib.conf.template', force=True) + print 'matplotlib.conf.template created in ../mpl-data' Deleted: trunk/matplotlib/lib/matplotlib/mpl-data/matplotlib.conf =================================================================== --- trunk/matplotlib/lib/matplotlib/mpl-data/matplotlib.conf 2007-11-12 23:38:12 UTC (rev 4241) +++ trunk/matplotlib/lib/matplotlib/mpl-data/matplotlib.conf 2007-11-13 13:50:29 UTC (rev 4242) @@ -1,410 +0,0 @@ -# MPLConfig - plaintext (in .conf format) - -# This is a sample matplotlib configuration file. It should be placed -# in HOME/.matplotlib/matplotlibrc (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, or 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 ### - -# a value of type 'str' -datapath = '/usr/lib64/python2.5/site-packages/matplotlib/mpl-data' -# one of 0, on, false, 1, no, n, y, off, yes, true -interactive = False -# a value of type 'bool' -maskedarray = False -# 'numpy' or 'numeric' or 'numarray' -numerix = 'numpy' -# 'Africa/Abidjan' or 'Africa/Accra' or 'Africa/Addis_Ababa' or 'Africa/Algiers' -# or 'Africa/Asmara' or 'Africa/Asmera' or 'Africa/Bamako' or 'Africa/Bangui' o -# r 'Africa/Banjul' or 'Africa/Bissau' or 'Africa/Blantyre' or 'Africa/Brazzavil -# <...snipped 10590 chars...> -# or 'Turkey' or 'UCT' or 'US/Alaska' or 'US/Aleutian' or 'US/Arizona' or 'US/Ce -# ntral' or 'US/East-Indiana' or 'US/Eastern' or 'US/Hawaii' or 'US/Indiana-Star -# ke' or 'US/Michigan' or 'US/Mountain' or 'US/Pacific' or 'US/Pacific-New' or ' -# US/Samoa' or 'UTC' or 'Universal' or 'W-SU' or 'WET' or 'Zulu' or 'posixrules' -timezone = 'UTC' -# 'toolbar2' or None -toolbar = 'toolbar2' -# a value of type 'bool' -units = False - -[axes] - # a value of type 'bool' - axisbelow = False - # any valid matplotlib color, eg an abbreviation like 'r' for red, a full - # name like 'orange', a hex color like '#efefef', a grayscale intensity - # like '0.5', or an RGBA tuple (1,0,0,1) - edgecolor = 'black' - # any valid matplotlib color, eg an abbreviation like 'r' for red, a full - # name like 'orange', a hex color like '#efefef', a grayscale intensity - # like '0.5', or an RGBA tuple (1,0,0,1) - facecolor = 'white' - # one of 0, on, false, 1, no, n, y, off, yes, true - grid = False - # one of 0, on, false, 1, no, n, y, off, yes, true - hold = True - # any valid matplotlib color, eg an abbreviation like 'r' for red, a full - # name like 'orange', a hex color like '#efefef', a grayscale intensity - # like '0.5', or an RGBA tuple (1,0,0,1) - labelcolor = 'black' - # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or 'medium' - # or 'large' or 'x-large' or 'xx-large' - labelsize = 'medium' - # a value of type 'float' - linewidth = 1.0 - # one of 0, on, false, 1, no, n, y, off, yes, true - polargrid = True - # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or 'medium' - # or 'large' or 'x-large' or 'xx-large' - titlesize = 'large' - - [[formatter]] - # a list of from 2 to 2 items each of which is a value of type 'float' - limits = [-7.0, 7.0] - -[backend] - # Valid backends are: 'GTKAgg', 'GTKCairo', 'QtAgg', 'Qt4Agg', - # 'TkAgg', 'Agg', 'Cairo', 'PS', 'PDF', 'SVG' - # one of ps, qt4agg, tkagg, gtkagg, agg, cairo, gtkcairo, wxagg, qtagg, temp - # late, svg, pdf - use = 'TkAgg' - - [[cairo]] - # 'png' or 'ps' or 'pdf' or 'svg' - format = 'png' - - [[pdf]] - # 0 <= an integer <= 9 - compression = 6 - # 3 or 42 - fonttype = 3 - # a value of type 'bool' - inheritcolor = False - # a value of type 'bool' - use14corefonts = False - - [[ps]] - # 3 or 42 - fonttype = 3 - # 'auto' or 'letter' or 'legal' or 'ledger' or 'A0' or 'A1' or 'A2' or ' - # A3' or 'A4' or 'A5' or 'A6' or 'A7' or 'A8' or 'A9' or 'A10' or 'B0' o - # r 'B1' or 'B2' or 'B3' or 'B4' or 'B5' or 'B6' or 'B7' or 'B8' or 'B9' - # or 'B10' - papersize = 'letter' - # a value of type 'bool' - useafm = False - - [[[distiller]]] - # a value of type 'float' - resolution = 6000.0 - # a bool or None or 'ghostscript' or 'xpdf' - use = None - - [[svg]] - # a value of type 'bool' - embed_chars = True - # a value of type 'bool' - image_inline = True - # a value of type 'bool' - image_noscale = False - - [[tk]] - # window_focus : Maintain shell focus for TkAgg - # pythoninspect: tk sets PYTHONINSPECT - - # a value of type 'bool' - pythoninspect = False - # a value of type 'bool' - window_focus = False - -[contour] - # 'dashed' or 'solid' - negative_linestyle = 'dashed' - -[figure] - # a value of type 'float' - dpi = 80.0 - # any valid matplotlib color, eg an abbreviation like 'r' for red, a full - # name like 'orange', a hex color like '#efefef', a grayscale intensity - # like '0.5', or an RGBA tuple (1,0,0,1) - edgecolor = 'white' - # any valid matplotlib color, eg an abbreviation like 'r' for red, a full - # name like 'orange', a hex color like '#efefef', a grayscale intensity - # like '0.5', or an RGBA tuple (1,0,0,1) - facecolor = '0.75' - # a list of from 2 to 2 items each of which is a value of type 'float' - figsize = [8.0, 6.0] - - [[subplot]] - # The figure subplot parameters. All dimensions are fraction - # of the figure width or height - # a value of type 'float' - bottom = 0.10000000000000001 - # a value of type 'float' - hspace = 0.20000000000000001 - # a value of type 'float' - left = 0.125 - # a value of type 'float' - right = 0.90000000000000002 - # a value of type 'float' - top = 0.90000000000000002 - # a value of type 'float' - wspace = 0.20000000000000001 - -[font] - # a list of items each of which is a value of type 'str' - cursive = ['Apple Chancery', 'Textile', 'Zapf Chancery', 'Sand', 'cursive'] - # 'sans-serif' or 'serif' or 'cursive' or 'fantasy' or 'monospace' - family = 'sans-serif' - # a list of items each of which is a value of type 'str' - fantasy = ['Comic Sans MS', 'Chicago', 'Charcoal', 'Impact', 'Western', 'fantasy'] - # a list of items each of which is a value of type 'str' - monospace = ['Bitstream Vera Sans Mono', 'Andale Mono', 'Nimbus Mono L', 'Courier New', 'Courier', 'Fixed', 'Terminal', 'monospace'] - # a list of items each of which is a value of type 'str' - sans_serif = ['Bitstream Vera Sans', 'Lucida Grande', 'Verdana', 'Geneva', 'Lucid', 'Arial', 'Helvetica', 'Avant Garde', 'sans-serif'] - # a list of items each of which is a value of type 'str' - serif = ['Bitstream Vera Serif', 'New Century Schoolbook', 'Century Schoolbook L', 'Utopia', 'ITC Bookman', 'Bookman', 'Nimbus Roman No9 L', 'Times New Roman', 'Times', 'Palatino', 'Charter', 'serif'] - # a value of type 'float' - size = 12.0 - # 'ultra-condensed' or 'extra-condensed' or 'condensed' or 'semi-condensed' - # or 'normal' or 'semi-expanded' or 'expanded' or 'extra-expanded' or 'ultra - # -expanded' or 'wider' or 'narrower' - stretch = 'normal' - # 'normal' or 'italic' or 'oblique' - style = 'normal' - # 'normal' or 'small-caps' - variant = 'normal' - # 'normal' or 'bold' or 'bolder' or 'lighter' or 100 or 200 or 300 or 400 or - # 500 or 600 or 700 or 800 or 900 - weight = 'normal' - -[grid] - # any valid matplotlib color, eg an abbreviation like 'r' for red, a full - # name like 'orange', a hex color like '#efefef', a grayscale intensity - # like '0.5', or an RGBA tuple (1,0,0,1) - color = 'black' - # '-' or '--' or '-.' or ':' or 'steps' or '' or ' ' - linestyle = ':' - # a value of type 'float' - linewidth = 0.5 - -[image] - # a value of type 'float' or 'equal' or 'auto' - aspect = 'equal' - # 'Accent' or 'Accent_r' or 'Blues' or 'Blues_r' or 'BrBG' or 'BrBG_r' or 'B - # uGn' or 'BuGn_r' or 'BuPu' or 'BuPu_r' or 'Dark2' or 'Dark2_r' or 'GnBu' o - # r 'GnBu_r' or 'Greens' or 'Greens_r' or 'Greys' or 'Greys_r' or 'OrRd' or - # <...snipped 1010 chars...> - # ist_stern' or 'gist_stern_r' or 'gist_yarg' or 'gist_yarg_r' or 'gray' or - # 'gray_r' or 'hot' or 'hot_r' or 'hsv' or 'hsv_r' or 'jet' or 'jet_r' or 'p - # ink' or 'pink_r' or 'prism' or 'prism_r' or 'spectral' or 'spectral_r' or - # 'spring' or 'spring_r' or 'summer' or 'summer_r' or 'winter' or 'winter_r' - cmap = 'jet' - # 'bilinear' or 'nearest' or 'bicubic' or 'spline16' or 'spline36' or 'hanni - # ng' or 'hamming' or 'hermite' or 'kaiser' or 'quadric' or 'catrom' or 'gau - # ssian' or 'bessel' or 'mitchell' or 'sinc' or 'lanczos' or 'blackman' - interpolation = 'bilinear' - # a value of type 'int' - lut = 256 - # 'upper' or 'lower' - origin = 'upper' - -[legend] - # a value of type 'float' - axespad = 0.02 - # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or 'medium' - # or 'large' or 'x-large' or 'xx-large' - fontsize = 'medium' - # a value of type 'float' - handlelen = 0.050000000000000003 - # a value of type 'float' - handletextsep = 0.02 - # a value of type 'bool' - isaxes = True - # a value of type 'float' - labelsep = 0.01 - # 'best' or 'upper right' or 'upper left' or 'lower left' or 'lower right' o - # r 'right' or 'center left' or 'center right' or 'lower center' or 'upper c - # enter' or 'center' - loc = 'upper right' - # a value of type 'float' - markerscale = 1.0 - # a value of type 'int' - numpoints = 3 - # a value of type 'float' - pad = 0.20000000000000001 - # a value of type 'bool' - shadow = False - -[lines] - # a value of type 'bool' - antialiased = True - # any valid matplotlib color, eg an abbreviation like 'r' for red, a full - # name like 'orange', a hex color like '#efefef', a grayscale intensity - # like '0.5', or an RGBA tuple (1,0,0,1) - color = 'blue' - # 'butt' or 'round' or 'projecting' - dash_capstyle = 'butt' - # 'miter' or 'round' or 'bevel' - dash_joinstyle = 'miter' - # '-' or '--' or '-.' or ':' or 'steps' or '' or ' ' or None - linestyle = '-' - # a value of type 'float' - linewidth = 1.0 - # 'None' or 'o' or '.' or ',' or '^' or 'v' or '<' or '>' or 's' or '+' or ' - # x' or 'D' or 'd' or '1' or '2' or '3' or '4' or 'h' or 'H' or 'p' or '|' o - # r '_' - marker = 'None' - # a value of type 'float' - markeredgewidth = 0.5 - # a value of type 'float' - markersize = 6.0 - # 'butt' or 'round' or 'projecting' - solid_capstyle = 'butt' - # 'miter' or 'round' or 'bevel' - solid_joinstyle = 'miter' - -[mathtext] - # A fontconfig pattern. See the fontconfig user manual for more information - # . - bf = 'serif:bold' - # A fontconfig pattern. See the fontconfig user manual for more information - # . - cal = 'cursive' - # a value of type 'bool' - fallback_to_cm = True - # 'cm' or 'stix' or 'stixsans' or 'custom' - fontset = 'cm' - # A fontconfig pattern. See the fontconfig user manual for more information - # . - it = 'serif:oblique' - # A fontconfig pattern. See the fontconfig user manual for more information - # . - rm = 'serif' - # A fontconfig pattern. See the fontconfig user manual for more information - # . - sf = 'sans' - # A fontconfig pattern. See the fontconfig user manual for more information - # . - tt = 'monospace' - -[patch] - # a value of type 'bool' - antialiased = True - # any valid matplotlib color, eg an abbreviation like 'r' for red, a full - # name like 'orange', a hex color like '#efefef', a grayscale intensity - # like '0.5', or an RGBA tuple (1,0,0,1) - edgecolor = 'black' - # any valid matplotlib color, eg an abbreviation like 'r' for red, a full - # name like 'orange', a hex color like '#efefef', a grayscale intensity - # like '0.5', or an RGBA tuple (1,0,0,1) - facecolor = 'blue' - # a value of type 'float' - linewidth = 1.0 - -[savefig] - # a value of type 'float' - dpi = 100.0 - # any valid matplotlib color, eg an abbreviation like 'r' for red, a full - # name like 'orange', a hex color like '#efefef', a grayscale intensity - # like '0.5', or an RGBA tuple (1,0,0,1) - edgecolor = 'white' - # any valid matplotlib color, eg an abbreviation like 'r' for red, a full - # name like 'orange', a hex color like '#efefef', a grayscale intensity - # like '0.5', or an RGBA tuple (1,0,0,1) - facecolor = 'white' - # 'portrait' or 'landscape' - orientation = 'portrait' - -[text] - # any valid matplotlib color, eg an abbreviation like 'r' for red, a full - # name like 'orange', a hex color like '#efefef', a grayscale intensity - # like '0.5', or an RGBA tuple (1,0,0,1) - color = 'black' - # a value of type 'bool' - usetex = False - - [[latex]] - # a value of type 'bool' - dvipnghack = False - # a list of items each of which is a value of type 'str' - preamble = [] - # a value of type 'bool' - unicode = False - -[verbose] - # a value of type 'str' or a value of type 'unicode' or 'sys.stdout' - fileo = 'sys.stdout' - # 'silent' or 'helpful' or 'debug' or 'debug-annoying' - level = 'silent' - -[xticks] - # any valid matplotlib color, eg an abbreviation like 'r' for red, a full - # name like 'orange', a hex color like '#efefef', a grayscale intensity - # like '0.5', or an RGBA tuple (1,0,0,1) - color = 'black' - # 'in' or 'out' - direction = 'in' - # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or 'medium' - # or 'large' or 'x-large' or 'xx-large' - labelsize = 'small' - - [[major]] - # a value of type 'float' - pad = 4.0 - # a value of type 'float' - size = 4.0 - - [[minor]] - # a value of type 'float' - pad = 4.0 - # a value of type 'float' - size = 2.0 - -[yticks] - # any valid matplotlib color, eg an abbreviation like 'r' for red, a full - # name like 'orange', a hex color like '#efefef', a grayscale intensity - # like '0.5', or an RGBA tuple (1,0,0,1) - color = 'black' - # 'in' or 'out' - direction = 'in' - # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or 'medium' - # or 'large' or 'x-large' or 'xx-large' - labelsize = 'small' - - [[major]] - # a value of type 'float' - pad = 4.0 - # a value of type 'float' - size = 4.0 - - [[minor]] - # a value of type 'float' - pad = 4.0 - # a value of type 'float' - size = 2.0 \ No newline at end of file Deleted: trunk/matplotlib/lib/matplotlib/mpl-data/matplotlib.conf.backup =================================================================== --- trunk/matplotlib/lib/matplotlib/mpl-data/matplotlib.conf.backup 2007-11-12 23:38:12 UTC (rev 4241) +++ trunk/matplotlib/lib/matplotlib/mpl-data/matplotlib.conf.backup 2007-11-13 13:50:29 UTC (rev 4242) @@ -1,456 +0,0 @@ -### MATPLOTLIBRC FORMAT - -# This is a sample matplotlib configuration file. It should be placed -# in HOME/.matplotlib/matplotlibrc (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 your's, 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, or 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 - -#### CONFIGURATION BEGINS HERE - -# numpy, Numeric or numarray -numerix = 'numpy' - -# True to use external maskedarray module instead of numpy.ma; this is a -# temporary setting for testing maskedarray. -maskedarray = False - -# see http://matplotlib.sourceforge.net/interactive.html -interactive = False - -# None | classic | toolbar2 -toolbar = 'toolbar2' - -# a pytz timezone string, eg US/Central or Europe/Paris -timezone = 'UTC' - -units = False - -# Where your matplotlib data lives if you installed to a non-default -#location. This is where the matplotlib fonts, bitmaps, etc reside -#datapath = '/home/fperez/.matplotlib' - -#bogus = 1 -#[bogus_section] -# foo = 1 - -[backend] - - #[[bogus_subsection]] - # bar =1 - - # 'GTKAgg', 'GTKCairo', 'QtAgg', 'Qt4Agg', 'TkAgg', 'Agg', - # 'Cairo', 'PS', 'PDF', 'SVG' - use = 'TkAgg' - - [[cairo]] - # png, ps, pdf, svg - format = 'png' - - [[tk]] - # Maintain shell focus for TkAgg - window_focus = False - - # tk sets PYTHONINSEPCT - pythoninspect = False - - [[ps]] - # auto, letter, legal, ledger, A0-A10, B0-B10 - papersize = 'letter' - - # use of afm fonts, results in smaller files - useafm = False - - # 3 (Type3) or 42 (TrueType) - fonttype = 3 - - [[[distiller]]] - # can be: None, ghostscript or xpdf - # xpdf intended for production of publication quality - # files, but requires ghostscript, xpdf and ps2eps - use = None - - # distiller resolution, dpi - resolution = 6000.0 - - [[pdf]] - # integer from 0 to 9 - # 0 disables compression (good for debugging) - compression = 6 - - # 3 (Type3) or 42 (TrueType) - fonttype = 3 - - [[svg]] - # write raster image data directly into the svg file - image_inline = True - - # suppress scaling of raster data embedded in SVG - image_noscale = False - - # embed character outlines in the SVG file - embed_chars = False - -[lines] - # See http://matplotlib.sourceforge.net/matplotlib.lines.html for more - # information on line properties. - - # line width in points - linewidth = 1.0 - - # '-','--','-.', ':', 'steps', '', ' ', or None - linestyle = '-' - - color = 'blue' - - # The default marker: 'None', 'o', '.', ',', '^', 'v', '<', '>', 's', '+', - # 'x', 'D', 'd', '1', '2', '3', '4', 'h', 'H', 'p', '|', '_' - marker = 'None' - - # the line width around the marker symbol - markeredgewidth = 0.5 - - # markersize, in points - markersize = 6.0 - - # miter|round|bevel - dash_joinstyle = 'miter' - solid_joinstyle = 'miter' - - # butt|round|projecting - dash_capstyle = 'butt' - solid_capstyle = 'projecting' - - # render antialised lines (no jaggies) - antialiased = True - -[patch] - # Patches are graphical objects that fill 2D space, like polygons or - # circles. See - # http://matplotlib.sourceforge.net/matplotlib.patches.html for more - # information on patch properties - - # edge width in points - linewidth = 1.0 - - facecolor = 'blue' - edgecolor = 'black' - - # render antialised lines (no jaggies) - antialiased = True - -[font] - # font properties used by text.Text. See - # http://matplotlib.sourceforge.net/matplotlib.font_manager.html for more - # information on font properties. The 6 font properties used for font - # matching are given below with their default values. - # - # The font.family property has five values: 'serif' (e.g. Times), - # 'sans-serif' (e.g. Helvetica), 'cursive' (e.g. Zapf-Chancery), - # 'fantasy' (e.g. Western), and 'monospace' (e.g. Courier). Each of - # these font families has a default list of font names in decreasing - # order of priority associated with them. - family = 'sans-serif' - - # The font.style property has three values: normal (or roman), italic - # or oblique. The oblique style will be used for italic, if it is not - # present. - style = 'normal' - - # The font.variant property has two values: normal or small-caps. For - # TrueType fonts, which are scalable fonts, small-caps is equivalent - # to using a font size of 'smaller', or about 83% of the current font - # size. - variant = 'normal' - - # The font.weight property has effectively 13 values= normal, bold, - # bolder, lighter, 100, 200, 300, ..., 900. Normal is the same as - # 400, and bold is 700. bolder and lighter are relative values with - # respect to the current weight. - weight = 'normal' - - # The font.stretch property has 11 values: ultra-condensed, - # extra-condensed, condensed, semi-condensed, normal, semi-expanded, - # expanded, extra-expanded, ultra-expanded, wider, and narrower. This - # property is not currently implemented. - stretch = 'normal' - - # The font.size property is the default font size for text, given in pts. - # 12pt is the standard value. - # - # Note that font.size controls default text sizes. To configure - # special text sizes tick labels, axes, labels, title, etc, see the rc - # settings for axes and ticks. Special text sizes can be defined - # relative to font.size, using the following values: xx-small, x-small, - # small, medium, large, x-large, xx-large, larger, or smaller - size = 12.0 - - # A search list for each of the font families - serif = ['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 = ['Bitstream Vera Sans', 'Lucida Grande', 'Verdana', 'Geneva', 'Lucid', 'Arial', 'Helvetica', 'Avant Garde', 'sans-serif'] - cursive = ['Apple Chancery', 'Textile', 'Zapf Chancery', 'Sand', 'cursive'] - fantasy = ['Comic Sans MS', 'Chicago', 'Charcoal', 'Impact', 'Western', 'fantasy'] - monospace = ['Bitstream Vera Sans Mono', 'Andale Mono', 'Nimbus Mono L', 'Courier New', 'Courier', 'Fixed', 'Terminal', 'monospace'] - -[text] - # text properties used by text.Text. See - # http://matplotlib.sourceforge.net/matplotlib.text.html for more - # information on text properties - color = 'black' - - ### LaTeX customizations - # See http://www.scipy.org/Wiki/Cookbook/Matplotlib/UsingTex - - # use latex for all text handling. The following fonts - # are supported through the usual rc parameter settings: - # new century schoolbook, bookman, times, palatino, - # zapf chancery, charter, serif, sans-serif, helvetica, - # avant garde, courier, monospace, computer modern roman, - # computer modern sans serif, computer modern typewriter - # If another font is desired which can loaded using the - # LaTeX \usepackage command, please inquire at the - # matplotlib mailing list - usetex = False - - [[latex]] - # use "ucs" and "inputenc" LaTeX packages for - # handling unicode strings. - unicode = False - - # IMPROPER USE OF THE PREAMBLE WILL LEAD TO LATEX - # FAILURES AND IS THEREFORE UNSUPPORTED. PLEASE DO NOT - # ASK FOR HELP IF THIS FEATURE DOES NOT DO WHAT YOU - # EXPECT IT TO. - # preamble is a comma separated list of LaTeX - # statements that are included in the LaTeX document - # preamble. - # An example: - # text.latex.preamble = ["\usepackage{bm}", "\usepackage{euler}"] - # The following packages are always loaded with usetex, - # so beware of package collisions: color, geometry, - # graphicx, type1cm, textcomp. Adobe Postscript - # (PSSNFS) font packages may also be loaded, depending - # on your font settings - preamble = [] - - # some versions of dvipng don't handle alpha channel properly. - # Use True to correct and flush ~/.matplotlib/tex.cache before - # testing - dvipnghack = False - -[axes] - # default face and edge color, default tick sizes, - # default fontsizes for ticklabels, and so on. See - # http://matplotlib.sourceforge.net/matplotlib.axes.html#Axes - - # whether to clear the axes by default - hold = True - - # axes background color - facecolor = 'white' - - # axes edge color - edgecolor = 'black' - - # edge linewidth - linewidth = 1.0 - - # display grid on regular or polar axes - grid = False - polargrid = True - - # fontsize of the axes title and labels - titlesize = 'large' - labelsize = 'medium' - - labelcolor = 'black' - - # whether axis gridlines and ticks are below the axes elements - # (lines, text, etc) - axisbelow = False - - [[formatter]] - # use scientific notation if log10 of the axis range is smaller - # than the first or larger than the second - limits = [-7.0, 7.0] - -[xticks] - # see http://matplotlib.sourceforge.net/matplotlib.axis.html#Ticks - color = 'k' - labelsize = 'small' - - # direction: in or out - direction = 'in' - - [[major]] - # in points - size = 4.0 - pad = 4.0 - - [[minor]] - # in points - size = 2.0 - pad = 4.0 - -[yticks] - color = 'k' - labelsize = 'small' - - # direction: in or out - direction = 'in' - - [[major]] - # in points - size = 4.0 - pad = 4.0 - - [[minor]] - # in points - size = 2.0 - pad = 4.0 - -[grid] - color = 'black' - - # '-','--','-.', ':', 'steps', '', ' ', or None - linestyle = ':' - - linewidth = 0.5 - -[legend] - loc = 'upper right' - - isaxes = True - - # the number of points in the legend line - numpoints = 2 - - fontsize = 'medium' - - # the fractional whitespace inside the legend border - pad = 0.20000000000000001 - - # the relative size of legend markers vs. original - # the following dimensions are in axes coords - markerscale = 1.0 - - # the vertical space between the legend entries - labelsep = 0.01 - - # the length of the legend lines - handlelen = 0.050000000000000003 - - # the space between the legend line and legend text - handletextsep = 0.02 - - # the border between the axes and legend edge - axespad = 0.02 - - # Show a shadow behind the legend - shadow = False - -[figure] - # See http://matplotlib.sourceforge.net/matplotlib.figure.html#Figure - - # figure size in inches - figsize = [8.0, 6.0] - - # figure dots per inch - dpi = 80.0 - - # figure face and edge colors; '0.75' is scalar gray - facecolor = '0.75' - edgecolor = 'white' - - [[subplot]] - # The figure subplot parameters. All dimensions are fraction of the - # figure width or height - left = 0.125 - right = 0.90000000000000002 - bottom = 0.10000000000000001 - top = 0.90000000000000002 - - # the amount of width or height reserved for blank space between - #subplots - wspace = 0.20000000000000001 - hspace = 0.20000000000000001 - - -[image] - # equal | auto | a number - aspect = 'equal' - - # see help(imshow) for options - interpolation = 'bilinear' - cmap = 'jet' - - # the size of the colormap lookup table - lut = 256 - - # 'lower' or 'upper' - origin = 'upper' - - -[contour] - # 'dashed' or 'solid' - negative_linestyle = 'dashed' - -[savefig] - # Saving figures - # the default savefig params can be different for the GUI backends. - # Eg, you may want a higher resolution, or to make the figure - # background white - - # figure dots per inch - dpi = 100.0 - - # figure face and edge colors - facecolor = 'white' - edgecolor = 'white' - orientation = 'portrait' - -[verbose] - # Set the verbose flags. This controls how much information - # matplotlib gives you at runtime and where it goes. The verbosity - # levels are: silent, helpful, debug, debug-annoying. Any level is - # inclusive of all the levels below it. If you setting is debug, - # you'll get all the debug and helpful messages. When submitting - # problems to the mailing-list, please set verbose to helpful or debug - # and paste the output into your report. - # - # The fileo gives the destination for any calls to verbose.report. - # These objects can a filename, or a filehandle like sys.stdout. - # - # You can override the rc default verbosity from the command line by - # giving the flags --verbose-LEVEL where LEVEL is one of the legal - # levels, eg --verbose-helpful. - # - # You can access the verbose instance in your code - # from matplotlib import verbose. - - # 'silent', 'helpful', 'debug', or 'debug-annoying' - level = 'silent' - - # a log filename, 'sys.stdout' or 'sys.stderr' - fileo = 'sys.stdout' Added: trunk/matplotlib/lib/matplotlib/mpl-data/matplotlib.conf.template =================================================================== --- trunk/matplotlib/lib/matplotlib/mpl-data/matplotlib.conf.template (rev 0) +++ trunk/matplotlib/lib/matplotlib/mpl-data/matplotlib.conf.template 2007-11-13 13:50:29 UTC (rev 4242) @@ -0,0 +1,410 @@ +# MPLConfig - plaintext (in .conf format) + +# This is a sample matplotlib configuration file. It should be placed +# in HOME/.matplotlib/matplotlibrc (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, or 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 ### + +# a value of type 'str' +datapath = '/usr/lib64/python2.5/site-packages/matplotlib/mpl-data' +# one of 0, on, false, 1, no, n, y, off, yes, true +interactive = False +# a value of type 'bool' +maskedarray = False +# 'numpy' or 'numeric' or 'numarray' +numerix = 'numpy' +# 'Africa/Abidjan' or 'Africa/Accra' or 'Africa/Addis_Ababa' or 'Africa/Algiers' +# or 'Africa/Asmara' or 'Africa/Asmera' or 'Africa/Bamako' or 'Africa/Bangui' o +# r 'Africa/Banjul' or 'Africa/Bissau' or 'Africa/Blantyre' or 'Africa/Brazzavil +# <...snipped 10590 chars...> +# or 'Turkey' or 'UCT' or 'US/Alaska' or 'US/Aleutian' or 'US/Arizona' or 'US/Ce +# ntral' or 'US/East-Indiana' or 'US/Eastern' or 'US/Hawaii' or 'US/Indiana-Star +# ke' or 'US/Michigan' or 'US/Mountain' or 'US/Pacific' or 'US/Pacific-New' or ' +# US/Samoa' or 'UTC' or 'Universal' or 'W-SU' or 'WET' or 'Zulu' or 'posixrules' +timezone = 'UTC' +# 'toolbar2' or None +toolbar = 'toolbar2' +# a value of type 'bool' +units = False + +[axes] + # a value of type 'bool' + axisbelow = False + # any valid matplotlib color, eg an abbreviation like 'r' for red, a full + # name like 'orange', a hex color like '#efefef', a grayscale intensity + # like '0.5', or an RGBA tuple (1,0,0,1) + edgecolor = 'black' + # any valid matplotlib color, eg an abbreviation like 'r' for red, a full + # name like 'orange', a hex color like '#efefef', a grayscale intensity + # like '0.5', or an RGBA tuple (1,0,0,1) + facecolor = 'white' + # one of 0, on, false, 1, no, n, y, off, yes, true + grid = False + # one of 0, on, false, 1, no, n, y, off, yes, true + hold = True + # any valid matplotlib color, eg an abbreviation like 'r' for red, a full + # name like 'orange', a hex color like '#efefef', a grayscale intensity + # like '0.5', or an RGBA tuple (1,0,0,1) + labelcolor = 'black' + # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or 'medium' + # or 'large' or 'x-large' or 'xx-large' + labelsize = 'medium' + # a value of type 'float' + linewidth = 1.0 + # one of 0, on, false, 1, no, n, y, off, yes, true + polargrid = True + # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or 'medium' + # or 'large' or 'x-large' or 'xx-large' + titlesize = 'large' + + [[formatter]] + # a list of from 2 to 2 items each of which is a value of type 'float' + limits = [-7.0, 7.0] + +[backend] + # Valid backends are: 'GTKAgg', 'GTKCairo', 'QtAgg', 'Qt4Agg', + # 'TkAgg', 'Agg', 'Cairo', 'PS', 'PDF', 'SVG' + # one of ps, qt4agg, tkagg, gtkagg, agg, cairo, gtkcairo, wxagg, qtagg, temp + # late, svg, pdf + use = 'Agg' + + [[cairo]] + # 'png' or 'ps' or 'pdf' or 'svg' + format = 'png' + + [[pdf]] + # 0 <= an integer <= 9 + compression = 6 + # 3 or 42 + fonttype = 3 + # a value of type 'bool' + inheritcolor = False + # a value of type 'bool' + use14corefonts = False + + [[ps]] + # 3 or 42 + fonttype = 3 + # 'auto' or 'letter' or 'legal' or 'ledger' or 'A0' or 'A1' or 'A2' or ' + # A3' or 'A4' or 'A5' or 'A6' or 'A7' or 'A8' or 'A9' or 'A10' or 'B0' o + # r 'B1' or 'B2' or 'B3' or 'B4' or 'B5' or 'B6' or 'B7' or 'B8' or 'B9' + # or 'B10' + papersize = 'letter' + # a value of type 'bool' + useafm = False + + [[[distiller]]] + # a value of type 'float' + resolution = 6000.0 + # a bool or None or 'ghostscript' or 'xpdf' + use = None + + [[svg]] + # a value of type 'bool' + embed_chars = True + # a value of type 'bool' + image_inline = True + # a value of type 'bool' + image_noscale = False + + [[tk]] + # window_focus : Maintain shell focus for TkAgg + # pythoninspect: tk sets PYTHONINSPECT + + # a value of type 'bool' + pythoninspect = False + # a value of type 'bool' + window_focus = False + +[contour] + # 'dashed' or 'solid' + negative_linestyle = 'dashed' + +[figure] + # a value of type 'float' + dpi = 80.0 + # any valid matplotlib color, eg an abbreviation like 'r' for red, a full + # name like 'orange', a hex color like '#efefef', a grayscale intensity + # like '0.5', or an RGBA tuple (1,0,0,1) + edgecolor = 'white' + # any valid matplotlib color, eg an abbreviation like 'r' for red, a full + # name like 'orange', a hex color like '#efefef', a grayscale intensity + # like '0.5', or an RGBA tuple (1,0,0,1) + facecolor = '0.75' + # a list of from 2 to 2 items each of which is a value of type 'float' + figsize = [8.0, 6.0] + + [[subplot]] + # The figure subplot parameters. All dimensions are fraction + # of the figure width or height + # a value of type 'float' + bottom = 0.10000000000000001 + # a value of type 'float' + hspace = 0.20000000000000001 + # a value of type 'float' + left = 0.125 + # a value of type 'float' + right = 0.90000000000000002 + # a value of type 'float' + top = 0.90000000000000002 + # a value of type 'float' + wspace = 0.20000000000000001 + +[font] + # a list of items each of which is a value of type 'str' + cursive = ['Apple Chancery', 'Textile', 'Zapf Chancery', 'Sand', 'cursive'] + # 'sans-serif' or 'serif' or 'cursive' or 'fantasy' or 'monospace' + family = 'sans-serif' + # a list of items each of which is a value of type 'str' + fantasy = ['Comic Sans MS', 'Chicago', 'Charcoal', 'Impact', 'Western', 'fantasy'] + # a list of items each of which is a value of type 'str' + monospace = ['Bitstream Vera Sans Mono', 'Andale Mono', 'Nimbus Mono L', 'Courier New', 'Courier', 'Fixed', 'Terminal', 'monospace'] + # a list of items each of which is a value of type 'str' + sans_serif = ['Bitstream Vera Sans', 'Lucida Grande', 'Verdana', 'Geneva', 'Lucid', 'Arial', 'Helvetica', 'Avant Garde', 'sans-serif'] + # a list of items each of which is a value of type 'str' + serif = ['Bitstream Vera Serif', 'New Century Schoolbook', 'Century Schoolbook L', 'Utopia', 'ITC Bookman', 'Bookman', 'Nimbus Roman No9 L', 'Times New Roman', 'Times', 'Palatino', 'Charter', 'serif'] + # a value of type 'float' + size = 12.0 + # 'ultra-condensed' or 'extra-condensed' or 'condensed' or 'semi-condensed' + # or 'normal' or 'semi-expanded' or 'expanded' or 'extra-expanded' or 'ultra + # -expanded' or 'wider' or 'narrower' + stretch = 'normal' + # 'normal' or 'italic' or 'oblique' + style = 'normal' + # 'normal' or 'small-caps' + variant = 'normal' + # 'normal' or 'bold' or 'bolder' or 'lighter' or 100 or 200 or 300 or 400 or + # 500 or 600 or 700 or 800 or 900 + weight = 'normal' + +[grid] + # any valid matplotlib color, eg an abbreviation like 'r' for red, a full + # name like 'orange', a hex color like '#efefef', a grayscale intensity + # like '0.5', or an RGBA tuple (1,0,0,1) + color = 'black' + # '-' or '--' or '-.' or ':' or 'steps' or '' or ' ' + linestyle = ':' + # a value of type 'float' + linewidth = 0.5 + +[image] + # a value of type 'float' or 'equal' or 'auto' + aspect = 'equal' + # 'Accent' or 'Accent_r' or 'Blues' or 'Blues_r' or 'BrBG' or 'BrBG_r' or 'B + # uGn' or 'BuGn_r' or 'BuPu' or 'BuPu_r' or 'Dark2' or 'Dark2_r' or 'GnBu' o + # r 'GnBu_r' or 'Greens' or 'Greens_r' or 'Greys' or 'Greys_r' or 'OrRd' or + # <...snipped 1010 chars...> + # ist_stern' or 'gist_stern_r' or 'gist_yarg' or 'gist_yarg_r' or 'gray' or + # 'gray_r' or 'hot' or 'hot_r' or 'hsv' or 'hsv_r' or 'jet' or 'jet_r' or 'p + # ink' or 'pink_r' or 'prism' or 'prism_r' or 'spectral' or 'spectral_r' or + # 'spring' or 'spring_r' or 'summer' or 'summer_r' or 'winter' or 'winter_r' + cmap = 'jet' + # 'bilinear' or 'nearest' or 'bicubic' or 'spline16' or 'spline36' or 'hanni + # ng' or 'hamming' or 'hermite' or 'kaiser' or 'quadric' or 'catrom' or 'gau + # ssian' or 'bessel' or 'mitchell' or 'sinc' or 'lanczos' or 'blackman' + interpolation = 'bilinear' + # a value of type 'int' + lut = 256 + # 'upper' or 'lower' + origin = 'upper' + +[legend] + # a value of type 'float' + axespad = 0.02 + # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or 'medium' + # or 'large' or 'x-large' or 'xx-large' + fontsize = 'medium' + # a value of type 'float' + handlelen = 0.050000000000000003 + # a value of type 'float' + handletextsep = 0.02 + # a value of type 'bool' + isaxes = True + # a value of type 'float' + labelsep = 0.01 + # 'best' or 'upper right' or 'upper left' or 'lower left' or 'lower right' o + # r 'right' or 'center left' or 'center right' or 'lower center' or 'upper c + # enter' or 'center' + loc = 'upper right' + # a value of type 'float' + markerscale = 1.0 + # a value of type 'int' + numpoints = 3 + # a value of type 'float' + pad = 0.20000000000000001 + # a value of type 'bool' + shadow = False + +[lines] + # a value of type 'bool' + antialiased = True + # any valid matplotlib color, eg an abbreviation like 'r' for red, a full + # name like 'orange', a hex color like '#efefef', a grayscale intensity + # like '0.5', or an RGBA tuple (1,0,0,1) + color = 'blue' + # 'butt' or 'round' or 'projecting' + dash_capstyle = 'butt' + # 'miter' or 'round' or 'bevel' + dash_joinstyle = 'miter' + # '-' or '--' or '-.' or ':' or 'steps' or '' or ' ' or None + linestyle = '-' + # a value of type 'float' + linewidth = 1.0 + # 'None' or 'o' or '.' or ',' or '^' or 'v' or '<' or '>' or 's' or '+' or ' + # x' or 'D' or 'd' or '1' or '2' or '3' or '4' or 'h' or 'H' or 'p' or '|' o + # r '_' + marker = 'None' + # a value of type 'float' + markeredgewidth = 0.5 + # a value of type 'float' + markersize = 6.0 + # 'butt' or 'round' or 'projecting' + solid_capstyle = 'butt' + # 'miter' or 'round' or 'bevel' + solid_joinstyle = 'miter' + +[mathtext] + # A fontconfig pattern. See the fontconfig user manual for more information + # . + bf = 'serif:bold' + # A fontconfig pattern. See the fontconfig user manual for more information + # . + cal = 'cursive' + # a value of type 'bool' + fallback_to_cm = True + # 'cm' or 'stix' or 'stixsans' or 'custom' + fontset = 'cm' + # A fontconfig pattern. See the fontconfig user manual for more information + # . + it = 'serif:oblique' + # A fontconfig pattern. See the fontconfig user manual for more information + # . + rm = 'serif' + # A fontconfig pattern. See the fontconfig user manual for more information + # . + sf = 'sans' + # A fontconfig pattern. See the fontconfig user manual for more information + # . + tt = 'monospace' + +[patch] + # a value of type 'bool' + antialiased = True + # any valid matplotlib color, eg an abbreviation like 'r' for red, a full + # name like 'orange', a hex color like '#efefef', a grayscale intensity + # like '0.5', or an RGBA tuple (1,0,0,1) + edgecolor = 'black' + # any valid matplotlib color, eg an abbreviation like 'r' for red, a full + # name like 'orange', a hex color like '#efefef', a grayscale intensity + # like '0.5', or an RGBA tuple (1,0,0,1) + facecolor = 'blue' + # a value of type 'float' + linewidth = 1.0 + +[savefig] + # a value of type 'float' + dpi = 100.0 + # any valid matplotlib color, eg an abbreviation like 'r' for red, a full + # name like 'orange', a hex color like '#efefef', a grayscale intensity + # like '0.5', or an RGBA tuple (1,0,0,1) + edgecolor = 'white' + # any valid matplotlib color, eg an abbreviation like 'r' for red, a full + # name like 'orange', a hex color like '#efefef', a grayscale intensity + # like '0.5', or an RGBA tuple (1,0,0,1) + facecolor = 'white' + # 'portrait' or 'landscape' + orientation = 'portrait' + +[text] + # any valid matplotlib color, eg an abbreviation like 'r' for red, a full + # name like 'orange', a hex color like '#efefef', a grayscale intensity + # like '0.5', or an RGBA tuple (1,0,0,1) + color = 'black' + # a value of type 'bool' + usetex = False + + [[latex]] + # a value of type 'bool' + dvipnghack = False + # a list of items each of which is a value of type 'str' + preamble = [] + # a value of type 'bool' + unicode = False + +[verbose] + # a value of type 'str' or a value of type 'unicode' or 'sys.stdout' + fileo = 'sys.stdout' + # 'silent' or 'helpful' or 'debug' or 'debug-annoying' + level = 'silent' + +[xticks] + # any valid matplotlib color, eg an abbreviation like 'r' for red, a full + # name like 'orange', a hex color like '#efefef', a grayscale intensity + # like '0.5', or an RGBA tuple (1,0,0,1) + color = 'black' + # 'in' or 'out' + direction = 'in' + # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or 'medium' + # or 'large' or 'x-large' or 'xx-large' + labelsize = 'small' + + [[major]] + # a value of type 'float' + pad = 4.0 + # a value of type 'float' + size = 4.0 + + [[minor]] + # a value of type 'float' + pad = 4.0 + # a value of type 'float' + size = 2.0 + +[yticks] + # any valid matplotlib color, eg an abbreviation like 'r' for red, a full + # name like 'orange', a hex color like '#efefef', a grayscale intensity + # like '0.5', or an RGBA tuple (1,0,0,1) + color = 'black' + # 'in' or 'out' + direction = 'in' + # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or 'medium' + # or 'large' or 'x-large' or 'xx-large' + labelsize = 'small' + + [[major]] + # a value of type 'float' + pad = 4.0 + # a value of type 'float' + size = 4.0 + + [[minor]] + # a value of type 'float' + pad = 4.0 + # a value of type 'float' + size = 2.0 \ No newline at end of file Modified: trunk/matplotlib/setup.py =================================================================== --- trunk/matplotlib/setup.py 2007-11-12 23:38:12 UTC (rev 4241) +++ trunk/matplotlib/setup.py 2007-11-13 13:50:29 UTC (rev 4242) @@ -133,21 +133,21 @@ print_raw("") print_raw("OPTIONAL BACKEND DEPENDENCIES") +if check_for_libpng() and options['build_agg']: + build_agg(ext_modules, packages) + rc['backend'] = 'Agg' +else: + rc['backend'] = 'SVG' +if options['build_image']: + build_image(ext_modules, packages) + +if options['build_windowing'] and sys.platform=='win32': + build_windowing(ext_modules, packages) + # the options can be True, False, or 'auto'. If True, try to build # regardless of the lack of dependencies. If auto, silently skip # when dependencies are missing. -hasgtk = check_for_gtk() -if options['build_gtk']: - if hasgtk or (options['build_gtk'] is True): - build_gdk(ext_modules, packages) - rc['backend'] = 'GTK' -if options['build_gtkagg']: - if hasgtk or (options['build_gtkagg'] is True): - options['build_agg'] = 1 - build_gtkagg(ext_modules, packages) - rc['backend'] = 'GTKAgg' - if options['build_tkagg']: if check_for_tk() or (options['build_tkagg'] is True): options['build_agg'] = 1 @@ -165,27 +165,22 @@ print_message("WxAgg extension not required for wxPython >= 2.8") rc['backend'] = 'WXAgg' +hasgtk = check_for_gtk() +if options['build_gtk']: + if hasgtk or (options['build_gtk'] is True): + build_gdk(ext_modules, packages) + rc['backend'] = 'GTK' +if options['build_gtkagg']: + if hasgtk or (options['build_gtkagg'] is True): + options['build_agg'] = 1 + build_gtkagg(ext_modules, packages) + rc['backend'] = 'GTKAgg' + # These are informational only. We don't build any extensions for them. check_for_qt() check_for_qt4() check_for_cairo() - -if check_for_libpng() and options['build_agg']: - build_agg(ext_modules, packages) - rc['backend'] = 'Agg' -else: - rc['backend'] = 'SVG' -if options['build_windowing'] and sys.platform=='win32': - build_windowing(ext_modules, packages) - -if options['build_image']: - build_image(ext_modules, packages) - -for mod in ext_modules: - if options['verbose']: - mod.extra_compile_args.append('-DVERBOSE') - print_raw("") print_raw("OPTIONAL DATE/TIMEZONE DEPENDENCIES") @@ -253,9 +248,20 @@ template = file('matplotlibrc.template').read() file('lib/matplotlib/mpl-data/matplotlibrc', 'w').write(template%rc) +# Write the default matplotlib.conf file +template = file('lib/matplotlib/mpl-data/matplotlib.conf.template').read() +template = template.replace("datapath = ", "#datapath = ") +template = template.replace("numerix = 'numpy'", "numerix = '%s'"%rc['numerix']) +template = template.replace(" use = 'Agg'", " use = '%s'"%rc['backend']) +file('lib/matplotlib/mpl-data/matplotlib.conf', 'w').write(template) + try: additional_params # has setupegg.py provided except NameError: additional_params = {} +for mod in ext_modules: + if options['verbose']: + mod.extra_compile_args.append('-DVERBOSE') + distrib = setup(name="matplotlib", version= __version__, description = "Matlab(TM) style python plotting package", This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-11-13 15:15:38
|
Revision: 4243 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4243&view=rev Author: mdboom Date: 2007-11-13 07:15:36 -0800 (Tue, 13 Nov 2007) Log Message: ----------- All backends can write to file-like objects rather than only regular files. Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py trunk/matplotlib/lib/matplotlib/backends/backend_ps.py trunk/matplotlib/lib/matplotlib/backends/backend_svg.py trunk/matplotlib/lib/matplotlib/backends/backend_wx.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2007-11-13 13:50:29 UTC (rev 4242) +++ trunk/matplotlib/CHANGELOG 2007-11-13 15:15:36 UTC (rev 4243) @@ -1,3 +1,7 @@ +2007-11-13 All backends now support writing to a file-like object, not + just a regular file. savefig() can be passed a file-like + object in place of a file path. - MGD + 2007-11-13 Improved the default backend selection at build time: SVG -> Agg -> TkAgg -> WXAgg -> GTK -> GTKAgg. The last usable backend in this progression will be chosen in the default Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2007-11-13 13:50:29 UTC (rev 4242) +++ trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2007-11-13 15:15:36 UTC (rev 4243) @@ -365,11 +365,24 @@ pixbuf.get_from_drawable(pixmap, pixmap.get_colormap(), 0, 0, 0, 0, width, height) - try: - pixbuf.save(filename, format) - except gobject.GError, exc: - error_msg_gtk('Save figure failure:\n%s' % (exc,), parent=self) - + if is_string_like(filename): + try: + pixbuf.save(filename, format) + except gobject.GError, exc: + error_msg_gtk('Save figure failure:\n%s' % (exc,), parent=self) + elif hasattr(filename, 'write') and callable(filename.write): + if hasattr(pixbuf, 'save_to_callback'): + def save_callback(buf, data=None): + data.write(buf) + try: + pixbuf.save_to_callback(save_callback, format, user_data=filename) + except gobject.GError, exc: + error_msg_gtk('Save figure failure:\n%s' % (exc,), parent=self) + else: + raise ValueError("Saving to a Python file-like object is only supported by PyGTK >= 2.8") + else: + raise ValueError("filename must be a path or a file-like object") + def get_default_filetype(self): return 'png' Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2007-11-13 13:50:29 UTC (rev 4242) +++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2007-11-13 15:15:36 UTC (rev 4243) @@ -325,7 +325,15 @@ self.width, self.height = width, height self.nextObject = 1 # next free object id self.xrefTable = [ [0, 65535, 'the zero object'] ] - fh = file(filename, 'wb') + self.passed_in_file_object = False + if is_string_like(filename): + fh = file(filename, 'wb') + elif hasattr(filename, 'write') and callable(filename.write): + fh = filename + self.passed_in_file_object = True + else: + raise ValueError("filename must be a path or a file-like object") + self.fh = fh self.currentstream = None # stream object to write to, if any fh.write("%PDF-1.4\n") # 1.4 is the first version to have alpha @@ -423,7 +431,8 @@ self.writeMarkers() self.writeXref() self.writeTrailer() - self.fh.close() + if not self.passed_in_file_object: + self.fh.close() def write(self, data): if self.currentstream is None: Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2007-11-13 13:50:29 UTC (rev 4242) +++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2007-11-13 15:15:36 UTC (rev 4243) @@ -1047,10 +1047,16 @@ written into this file object. """ isEPSF = format == 'eps' - title = outfile - - # write to a temp file, we'll move it to outfile when done - tmpfile = os.path.join(gettempdir(), md5.md5(outfile).hexdigest()) + passed_in_file_object = False + if is_string_like(outfile): + title = outfile + tmpfile = os.path.join(gettempdir(), md5.md5(outfile).hexdigest()) + elif hasattr(outfile, 'write') and callable(outfile.write): + title = None + tmpfile = os.path.join(gettempdir(), md5.md5(str(hash(outfile))).hexdigest()) + passed_in_file_object = True + else: + raise ValueError("outfile must be a path or a file-like object") fh = file(tmpfile, 'w') # find the appropriate papertype @@ -1168,10 +1174,11 @@ elif rcParams['ps.usedistiller'] == 'xpdf': xpdf_distill(tmpfile, isEPSF, ptype=papertype, bbox=bbox) - if isinstance(outfile, file): + if passed_in_file_object: fh = file(tmpfile) print >>outfile, fh.read() - else: shutil.move(tmpfile, outfile) + else: + shutil.move(tmpfile, outfile) def _print_figure_tex(self, outfile, format, dpi, facecolor, edgecolor, orientation, isLandscape, papertype): Modified: trunk/matplotlib/lib/matplotlib/backends/backend_svg.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_svg.py 2007-11-13 13:50:29 UTC (rev 4242) +++ trunk/matplotlib/lib/matplotlib/backends/backend_svg.py 2007-11-13 15:15:36 UTC (rev 4243) @@ -5,6 +5,7 @@ from matplotlib import verbose, __version__, rcParams from matplotlib.backend_bases import RendererBase, GraphicsContextBase,\ FigureManagerBase, FigureCanvasBase +from matplotlib.cbook import is_string_like from matplotlib.colors import rgb2hex from matplotlib.figure import Figure from matplotlib.font_manager import findfont, FontProperties @@ -458,15 +459,27 @@ 'svgz': 'Scalable Vector Graphics'} def print_svg(self, filename, *args, **kwargs): - svgwriter = codecs.open(filename, 'w', 'utf-8') - return self._print_svg(filename, svgwriter) - + if is_string_like(filename): + fh_to_close = svgwriter = codecs.open(filename, 'w', 'utf-8') + elif hasattr(filename, 'write') and callable(filename.write): + svgwriter = codecs.EncodedFile(filename, 'utf-8') + fh_to_close = None + else: + raise ValueError("filename must be a path or a file-like object") + return self._print_svg(filename, svgwriter, fh_to_close) + def print_svgz(self, filename, *args, **kwargs): - gzipwriter = gzip.GzipFile(filename, 'w') - svgwriter = codecs.EncodedFile(gzipwriter, 'utf-8') - return self._print_svg(filename, svgwriter) + if is_string_like(filename): + gzipwriter = gzip.GzipFile(filename, 'w') + fh_to_close = svgwriter = codecs.EncodedFile(gzipwriter, 'utf-8') + elif hasattr(filename, 'write') and callable(filename.write): + fh_to_close = gzipwriter = gzip.GzipFile(fileobj=filename, mode='w') + svgwriter = codecs.EncodedFile(gzipwriter, 'utf-8') + else: + raise ValueError("filename must be a path or a file-like object") + return self._print_svg(filename, svgwriter, fh_to_close) - def _print_svg(self, filename, svgwriter): + def _print_svg(self, filename, svgwriter, fh_to_close=None): self.figure.dpi.set(72) width, height = self.figure.get_size_inches() w, h = width*72, height*72 @@ -474,7 +487,8 @@ renderer = RendererSVG(w, h, svgwriter, filename) self.figure.draw(renderer) renderer.finish() - svgwriter.close() + if fh_to_close is not None: + svgwriter.close() def get_default_filetype(self): return 'svg' Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2007-11-13 13:50:29 UTC (rev 4242) +++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2007-11-13 15:15:36 UTC (rev 4243) @@ -152,7 +152,7 @@ cursors from matplotlib._pylab_helpers import Gcf from matplotlib.artist import Artist -from matplotlib.cbook import exception_to_str +from matplotlib.cbook import exception_to_str, is_string_like from matplotlib.figure import Figure from matplotlib.text import _process_text_args, Text from matplotlib.widgets import SubplotTool @@ -1030,12 +1030,17 @@ # Now that we have rendered into the bitmap, save it # to the appropriate file type and clean up - if not self.bitmap.SaveFile(filename, filetype): - DEBUG_MSG('print_figure() file save error', 4, self) - # note the error must be displayed here because trapping - # the error on a call or print_figure may not work because - # printing can be qued and called from realize - raise RuntimeError('Could not save figure to %s\n' % (filename)) + if is_string_like(filename): + if not self.bitmap.SaveFile(filename, filetype): + DEBUG_MSG('print_figure() file save error', 4, self) + # note the error must be displayed here because trapping + # the error on a call or print_figure may not work because + # printing can be qued and called from realize + raise RuntimeError('Could not save figure to %s\n' % (filename)) + elif hasattr(filename, 'write') and callable(filename.write): + if not self.bitmap.ConvertToImage().SaveStream(filename, filetype): + DEBUG_MSG('print_figure() file save error', 4, self) + raise RuntimeError('Could not save figure to %s\n' % (filename)) # Restore everything to normal self.bitmap = origBitmap This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ds...@us...> - 2007-11-13 16:40:06
|
Revision: 4248 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4248&view=rev Author: dsdale Date: 2007-11-13 08:39:12 -0800 (Tue, 13 Nov 2007) Log Message: ----------- modify formatting of comments in matplotlib.conf Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/config/mplconfig.py trunk/matplotlib/lib/matplotlib/config/mpltraits.py trunk/matplotlib/lib/matplotlib/mpl-data/matplotlib.conf.template trunk/matplotlib/setup.py Modified: trunk/matplotlib/lib/matplotlib/config/mplconfig.py =================================================================== --- trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2007-11-13 16:08:33 UTC (rev 4247) +++ trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2007-11-13 16:39:12 UTC (rev 4248) @@ -43,11 +43,11 @@ the default values listed herein. Colors: for the color values below, you can either use - - a matplotlib color string, such as r, k, or b + - 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 + - a legal html color name, eg red | blue | darkslategray Interactivity: see http://matplotlib.sourceforge.net/interactive.html. @@ -63,8 +63,6 @@ units = T.false class backend(TConfig): - """Valid backends are: 'GTKAgg', 'GTKCairo', 'QtAgg', 'Qt4Agg', - 'TkAgg', 'Agg', 'Cairo', 'PS', 'PDF', 'SVG'""" use = T.Trait('Agg', mplT.BackendHandler()) class cairo(TConfig): Modified: trunk/matplotlib/lib/matplotlib/config/mpltraits.py =================================================================== --- trunk/matplotlib/lib/matplotlib/config/mpltraits.py 2007-11-13 16:08:33 UTC (rev 4247) +++ trunk/matplotlib/lib/matplotlib/config/mpltraits.py 2007-11-13 16:39:12 UTC (rev 4248) @@ -24,18 +24,22 @@ class BackendHandler(T.TraitHandler): """ """ - backends = {'tkagg': 'TkAgg', + backends = {'agg': 'Agg', + 'cairo': 'Cairo', + 'cocoaagg': 'CocoaAgg', + 'fltkagg': 'FltkAgg', + 'gtk': 'GTK', 'gtkagg': 'GTKAgg', 'gtkcairo': 'GTKCairo', + 'pdf': 'Pdf', + 'ps': 'PS', 'qt4agg': 'Qt4Agg', 'qtagg': 'QtAgg', - 'wxagg': 'WXAgg', - 'agg': 'Agg', - 'cairo': 'Cairo', - 'ps': 'PS', - 'pdf': 'Pdf', 'svg': 'SVG', - 'template': 'Template' } + 'template': 'Template', + 'tkagg': 'TkAgg', + 'wx': 'WX', + 'wxagg': 'WXAgg'} def validate(self, object, name, value): try: @@ -46,7 +50,7 @@ def info(self): be = self.backends.keys() be.sort - return "one of %s"% ', '.join(['%s'%i for i in be]) + return "one of: %s"% ' | '.join(['%s'%i for i in be]) class BoolHandler(T.TraitHandler): @@ -73,7 +77,7 @@ return self.error(object, name, value) def info(self): - return "one of %s"% ', '.join(['%s'%i for i in self.bools.keys()]) + return "one of: %s"% ' | '.join(['%s'%i for i in self.bools.keys()]) flexible_true = T.Trait(True, BoolHandler()) flexible_false = T.Trait(False, BoolHandler()) Modified: trunk/matplotlib/lib/matplotlib/mpl-data/matplotlib.conf.template =================================================================== --- trunk/matplotlib/lib/matplotlib/mpl-data/matplotlib.conf.template 2007-11-13 16:08:33 UTC (rev 4247) +++ trunk/matplotlib/lib/matplotlib/mpl-data/matplotlib.conf.template 2007-11-13 16:39:12 UTC (rev 4248) @@ -21,11 +21,11 @@ # the default values listed herein. # # Colors: for the color values below, you can either use -# - a matplotlib color string, such as r, k, or b +# - 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 +# - a legal html color name, eg red | blue | darkslategray # # Interactivity: see http://matplotlib.sourceforge.net/interactive.html. # @@ -33,7 +33,7 @@ # a value of type 'str' datapath = '/usr/lib64/python2.5/site-packages/matplotlib/mpl-data' -# one of 0, on, false, 1, no, n, y, off, yes, true +# one of: 0 | on | false | 1 | no | n | y | off | yes | true interactive = False # a value of type 'bool' maskedarray = False @@ -64,9 +64,9 @@ # name like 'orange', a hex color like '#efefef', a grayscale intensity # like '0.5', or an RGBA tuple (1,0,0,1) facecolor = 'white' - # one of 0, on, false, 1, no, n, y, off, yes, true + # one of: 0 | on | false | 1 | no | n | y | off | yes | true grid = False - # one of 0, on, false, 1, no, n, y, off, yes, true + # one of: 0 | on | false | 1 | no | n | y | off | yes | true hold = True # any valid matplotlib color, eg an abbreviation like 'r' for red, a full # name like 'orange', a hex color like '#efefef', a grayscale intensity @@ -77,7 +77,7 @@ labelsize = 'medium' # a value of type 'float' linewidth = 1.0 - # one of 0, on, false, 1, no, n, y, off, yes, true + # one of: 0 | on | false | 1 | no | n | y | off | yes | true polargrid = True # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or 'medium' # or 'large' or 'x-large' or 'xx-large' @@ -88,10 +88,8 @@ limits = [-7.0, 7.0] [backend] - # Valid backends are: 'GTKAgg', 'GTKCairo', 'QtAgg', 'Qt4Agg', - # 'TkAgg', 'Agg', 'Cairo', 'PS', 'PDF', 'SVG' - # one of ps, qt4agg, tkagg, gtkagg, agg, cairo, gtkcairo, wxagg, qtagg, temp - # late, svg, pdf + # one of: ps | qt4agg | fltkagg | gtkagg | agg | cairo | gtk | gtkcairo | wx + # agg | tkagg | qtagg | template | svg | cocoaagg | pdf | wx use = 'Agg' [[cairo]] Modified: trunk/matplotlib/setup.py =================================================================== --- trunk/matplotlib/setup.py 2007-11-13 16:08:33 UTC (rev 4247) +++ trunk/matplotlib/setup.py 2007-11-13 16:39:12 UTC (rev 4248) @@ -169,7 +169,6 @@ if options['build_gtk']: if hasgtk or (options['build_gtk'] is True): build_gdk(ext_modules, packages) - rc['backend'] = 'GTK' if options['build_gtkagg']: if hasgtk or (options['build_gtkagg'] is True): options['build_agg'] = 1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2007-11-14 16:40:40
|
Revision: 4275 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4275&view=rev Author: jdh2358 Date: 2007-11-14 08:39:47 -0800 (Wed, 14 Nov 2007) Log Message: ----------- added glen's Fc specteal patch Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/__init__.py trunk/matplotlib/lib/matplotlib/axes.py trunk/matplotlib/lib/matplotlib/backends/backend_agg.py trunk/matplotlib/lib/matplotlib/cbook.py trunk/matplotlib/lib/matplotlib/cm.py trunk/matplotlib/lib/matplotlib/collections.py trunk/matplotlib/lib/matplotlib/colorbar.py trunk/matplotlib/lib/matplotlib/config/matplotlib.conf.default trunk/matplotlib/lib/matplotlib/config/mplconfig.py trunk/matplotlib/lib/matplotlib/image.py trunk/matplotlib/lib/matplotlib/lines.py trunk/matplotlib/lib/matplotlib/mlab.py trunk/matplotlib/lib/matplotlib/numerix/__init__.py trunk/matplotlib/lib/matplotlib/pylab.py trunk/matplotlib/setup.py Modified: trunk/matplotlib/lib/matplotlib/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/__init__.py 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/lib/matplotlib/__init__.py 2007-11-14 16:39:47 UTC (rev 4275) @@ -118,8 +118,6 @@ def is_string_like(obj): - if hasattr(obj, 'shape'): return 0 # this is a workaround - # for a bug in numeric<23.1 try: obj + '' except (TypeError, ValueError): return 0 return 1 Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/lib/matplotlib/axes.py 2007-11-14 16:39:47 UTC (rev 4275) @@ -4338,7 +4338,7 @@ alpha=1.0, vmin=None, vmax=None, origin=None, extent=None) IMSHOW(X) - plot image X to current axes, resampling to scale to axes - size (X may be numarray/Numeric array or PIL image) + size (X may be numpy array or PIL image) IMSHOW(X, **kwargs) - Use keyword args to control image scaling, colormapping etc. See below for details @@ -4888,10 +4888,10 @@ return n, bins, cbook.silent_list('Patch', patches) hist.__doc__ = cbook.dedent(hist.__doc__) % martist.kwdocd - def psd(self, x, NFFT=256, Fs=2, detrend=mlab.detrend_none, + def psd(self, x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none, window=mlab.window_hanning, noverlap=0, **kwargs): """ - PSD(x, NFFT=256, Fs=2, detrend=mlab.detrend_none, + PSD(x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none, window=mlab.window_hanning, noverlap=0, **kwargs) The power spectral density by Welches average periodogram method. The @@ -4902,22 +4902,27 @@ with a scaling to correct for power loss due to windowing. Fs is the sampling frequency. - NFFT is the length of the fft segment; must be a power of 2 + * NFFT is the length of the fft segment; must be a power of 2 - Fs is the sampling frequency. + * Fs is the sampling frequency. - detrend - the function applied to each segment before fft-ing, + * Fc is the center frequency of x (defaults to 0), which offsets + the yextents of the image to reflect the frequency range used + when a signal is acquired and then filtered and downsampled to + baseband. + + * detrend - the function applied to each segment before fft-ing, designed to remove the mean or linear trend. Unlike in matlab, where the detrend parameter is a vector, in matplotlib is it a function. The mlab module defines detrend_none, detrend_mean, detrend_linear, but you can use a custom function as well. - window - the function used to window the segments. window is a + * window - the function used to window the segments. window is a function, unlike in matlab(TM) where it is a vector. mlab defines window_none, window_hanning, but you can use a custom function as well. - noverlap gives the length of the overlap between segments. + * noverlap gives the length of the overlap between segments. Returns the tuple Pxx, freqs @@ -4935,6 +4940,7 @@ if not self._hold: self.cla() pxx, freqs = mlab.psd(x, NFFT, Fs, detrend, window, noverlap) pxx.shape = len(freqs), + freqs += Fc self.plot(freqs, 10*npy.log10(pxx), **kwargs) self.set_xlabel('Frequency') @@ -4952,10 +4958,10 @@ return pxx, freqs psd.__doc__ = cbook.dedent(psd.__doc__) % martist.kwdocd - def csd(self, x, y, NFFT=256, Fs=2, detrend=mlab.detrend_none, + def csd(self, x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none, window=mlab.window_hanning, noverlap=0, **kwargs): """ - CSD(x, y, NFFT=256, Fs=2, detrend=mlab.detrend_none, + CSD(x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none, window=window_hanning, noverlap=0, **kwargs) The cross spectral density Pxy by Welches average periodogram method. @@ -4981,6 +4987,7 @@ pxy, freqs = mlab.csd(x, y, NFFT, Fs, detrend, window, noverlap) pxy.shape = len(freqs), # pxy is complex + freqs += Fc self.plot(freqs, 10*npy.log10(npy.absolute(pxy)), **kwargs) self.set_xlabel('Frequency') @@ -4997,11 +5004,10 @@ return pxy, freqs csd.__doc__ = cbook.dedent(csd.__doc__) % martist.kwdocd - def cohere(self, x, y, NFFT=256, Fs=2, detrend=mlab.detrend_none, + def cohere(self, x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none, window=mlab.window_hanning, noverlap=0, **kwargs): """ - COHERE(x, y, NFFT=256, Fs=2, - detrend = mlab.detrend_none, + COHERE(x, y, NFFT=256, Fs=2, Fc=0, detrend = mlab.detrend_none, window = mlab.window_hanning, noverlap=0, **kwargs) cohere the coherence between x and y. Coherence is the normalized @@ -5026,6 +5032,7 @@ """ if not self._hold: self.cla() cxy, freqs = mlab.cohere(x, y, NFFT, Fs, detrend, window, noverlap) + freqs += Fc self.plot(freqs, cxy, **kwargs) self.set_xlabel('Frequency') @@ -5035,11 +5042,11 @@ return cxy, freqs cohere.__doc__ = cbook.dedent(cohere.__doc__) % martist.kwdocd - def specgram(self, x, NFFT=256, Fs=2, detrend=mlab.detrend_none, + def specgram(self, x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none, window=mlab.window_hanning, noverlap=128, cmap = None, xextent=None): """ - SPECGRAM(x, NFFT=256, Fs=2, detrend=mlab.detrend_none, + SPECGRAM(x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none, window = mlab.window_hanning, noverlap=128, cmap=None, xextent=None) @@ -5081,7 +5088,8 @@ if xextent is None: xextent = 0, npy.amax(bins) xmin, xmax = xextent - extent = xmin, xmax, npy.amin(freqs), npy.amax(freqs) + freqs += Fc + extent = xmin, xmax, freqs[0], freqs[-1] im = self.imshow(Z, cmap, extent=extent) self.axis('auto') Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2007-11-14 16:39:47 UTC (rev 4275) @@ -26,8 +26,9 @@ REQUIREMENTs - python2.2+ - Numeric 22+ + python2.3+ + numpy 1.0 + + agg2 (see below) freetype 2 libpng Modified: trunk/matplotlib/lib/matplotlib/cbook.py =================================================================== --- trunk/matplotlib/lib/matplotlib/cbook.py 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/lib/matplotlib/cbook.py 2007-11-14 16:39:47 UTC (rev 4275) @@ -208,16 +208,12 @@ def is_string_like(obj): - if hasattr(obj, 'shape'): return 0 # this is a workaround - # for a bug in numeric<23.1 try: obj + '' except (TypeError, ValueError): return 0 return 1 def is_file_like(obj): - if hasattr(obj, 'shape'): return 0 # this is a workaround - # for a bug in numeric<23.1 try: obj + '' except (TypeError, ValueError): return 0 return 1 Modified: trunk/matplotlib/lib/matplotlib/cm.py =================================================================== --- trunk/matplotlib/lib/matplotlib/cm.py 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/lib/matplotlib/cm.py 2007-11-14 16:39:47 UTC (rev 4275) @@ -56,7 +56,7 @@ return x def set_array(self, A): - 'Set the image array from numeric/numarray A' + 'Set the image array from numpy array A' self._A = A def get_array(self): Modified: trunk/matplotlib/lib/matplotlib/collections.py =================================================================== --- trunk/matplotlib/lib/matplotlib/collections.py 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/lib/matplotlib/collections.py 2007-11-14 16:39:47 UTC (rev 4275) @@ -299,7 +299,7 @@ thus (meshWidth * meshHeight) quadrilaterals in the mesh. The mesh need not be regular and the polygons need not be convex. A quadrilateral mesh is represented by a - (2 x ((meshWidth + 1) * (meshHeight + 1))) Numeric array + (2 x ((meshWidth + 1) * (meshHeight + 1))) numpy array 'coordinates' where each row is the X and Y coordinates of one of the vertices. To define the function that maps from a data point to Modified: trunk/matplotlib/lib/matplotlib/colorbar.py =================================================================== --- trunk/matplotlib/lib/matplotlib/colorbar.py 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/lib/matplotlib/colorbar.py 2007-11-14 16:39:47 UTC (rev 4275) @@ -509,7 +509,7 @@ N = len(b) ii = npy.minimum(npy.searchsorted(b, xn), N-1) i0 = npy.maximum(ii - 1, 0) - #db = b[ii] - b[i0] (does not work with Numeric) + #db = b[ii] - b[i0] db = npy.take(b, ii) - npy.take(b, i0) db = npy.where(i0==ii, 1.0, db) #dy = y[ii] - y[i0] Modified: trunk/matplotlib/lib/matplotlib/config/matplotlib.conf.default =================================================================== --- trunk/matplotlib/lib/matplotlib/config/matplotlib.conf.default 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/lib/matplotlib/config/matplotlib.conf.default 2007-11-14 16:39:47 UTC (rev 4275) @@ -1,7 +1,7 @@ # MPLConfig - plaintext (in .conf format) # This is a sample matplotlib configuration file. It should be placed -# in HOME/.matplotlib/matplotlibrc (unix/linux like systems) and +# 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 Modified: trunk/matplotlib/lib/matplotlib/config/mplconfig.py =================================================================== --- trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2007-11-14 16:39:47 UTC (rev 4275) @@ -23,7 +23,7 @@ class MPLConfig(TConfig): """ This is a sample matplotlib configuration file. It should be placed - in HOME/.matplotlib/matplotlibrc (unix/linux like systems) and + 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 Modified: trunk/matplotlib/lib/matplotlib/image.py =================================================================== --- trunk/matplotlib/lib/matplotlib/image.py 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/lib/matplotlib/image.py 2007-11-14 16:39:47 UTC (rev 4275) @@ -230,7 +230,7 @@ """ retained for backwards compatibility - use set_data instead - ACCEPTS: numeric/numarray/PIL Image A""" + ACCEPTS: numpy array A or PIL Image""" # This also needs to be here to override the inherited # cm.ScalarMappable.set_array method so it is not invoked # by mistake. Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/lib/matplotlib/lines.py 2007-11-14 16:39:47 UTC (rev 4275) @@ -227,7 +227,7 @@ """ Artist.__init__(self) - #convert sequences to numeric arrays + #convert sequences to numpy arrays if not iterable(xdata): raise RuntimeError('xdata must be a sequence') if not iterable(ydata): Modified: trunk/matplotlib/lib/matplotlib/mlab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mlab.py 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/lib/matplotlib/mlab.py 2007-11-14 16:39:47 UTC (rev 4275) @@ -533,7 +533,7 @@ Cxy, Phase, freqs = cohere_pairs( X, ij, ...) Compute the coherence for all pairs in ij. X is a - numSamples,numCols Numeric array. ij is a list of tuples (i,j). + numSamples,numCols numpy array. ij is a list of tuples (i,j). Each tuple is a pair of indexes into the columns of X for which you want to compute coherence. For example, if X has 64 columns, and you want to compute all nonredundant pairs, define ij as @@ -894,7 +894,7 @@ Example 1 : ## 2D system - # Numeric solution + def derivs6(x,t): d1 = x[0] + 2*x[1] d2 = -3*x[0] + 4*x[1] @@ -1480,8 +1480,7 @@ """ A set of convenient utilities for numerical work. -Most of this module requires Numerical Python or is meant to be used with it. -See http://www.pfdubois.com/numpy for details. +Most of this module requires numpy or is meant to be used with it. Copyright (c) 2001-2004, Fernando Perez. <Fer...@co...> All rights reserved. @@ -1754,7 +1753,7 @@ #from numpy import fromfunction as fromfunction_kw def fromfunction_kw(function, dimensions, **kwargs): - """Drop-in replacement for fromfunction() from Numerical Python. + """Drop-in replacement for fromfunction() from numpy Allows passing keyword arguments to the desired function. @@ -1938,12 +1937,8 @@ ### end mlab2 functions -#Classes for manipulating and viewing numpy record arrays +#helpers for loading, saving, manipulating and viewing numpy record arrays - - - - def safe_isnan(x): 'isnan for arbitrary types' try: b = npy.isnan(x) @@ -2236,10 +2231,10 @@ # a series of classes for describing the format intentions of various rec views class FormatObj: def tostr(self, x): - return str(self.toval(x)) + return self.toval(x) def toval(self, x): - return x + return str(x) class FormatString(FormatObj): Modified: trunk/matplotlib/lib/matplotlib/numerix/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/numerix/__init__.py 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/lib/matplotlib/numerix/__init__.py 2007-11-14 16:39:47 UTC (rev 4275) @@ -35,8 +35,10 @@ use_maskedarray = True if a == "--ma": use_maskedarray = False -del a +try: del a +except NameError: pass + if which[0] is None: try: # In theory, rcParams always has *some* value for numerix. which = rcParams['numerix'], "rc" Modified: trunk/matplotlib/lib/matplotlib/pylab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/pylab.py 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/lib/matplotlib/pylab.py 2007-11-14 16:39:47 UTC (rev 4275) @@ -191,11 +191,6 @@ __end -Credits: The plotting commands were provided by -John D. Hunter <jdh...@ac...> - -Most of the other commands are from Numeric, MLab and FFT, with the -exception of those in mlab.py provided by matplotlib. """ import sys, warnings Modified: trunk/matplotlib/setup.py =================================================================== --- trunk/matplotlib/setup.py 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/setup.py 2007-11-14 16:39:47 UTC (rev 4275) @@ -263,15 +263,16 @@ distrib = setup(name="matplotlib", version= __version__, - description = "Matlab(TM) style python plotting package", + description = "Python plotting package", author = "John D. Hunter", author_email="jd...@gm...", url = "http://matplotlib.sourceforge.net", long_description = """ matplotlib strives to produce publication quality 2D graphics - using matlab plotting for inspiration. Although the main lib is - object oriented, there is a functional interface "pylab" - for people coming from Matlab. + for interactive graphing, scientific publishing, user interface + development and web application servers targeting multiple user + interfaces and hardcopy output formats. There is a 'pylab' mode + which emulates matlab graphics """, packages = packages, platforms='any', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2007-11-14 19:11:57
|
Revision: 4288 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4288&view=rev Author: jdh2358 Date: 2007-11-14 11:11:54 -0800 (Wed, 14 Nov 2007) Log Message: ----------- fixed is_string_like and removed is_file_like Modified Paths: -------------- trunk/matplotlib/API_CHANGES trunk/matplotlib/lib/matplotlib/__init__.py trunk/matplotlib/lib/matplotlib/cbook.py Modified: trunk/matplotlib/API_CHANGES =================================================================== --- trunk/matplotlib/API_CHANGES 2007-11-14 19:06:52 UTC (rev 4287) +++ trunk/matplotlib/API_CHANGES 2007-11-14 19:11:54 UTC (rev 4288) @@ -1,4 +1,5 @@ - + removed cbook.is_file_like, which appears to be broken and unused. + Added ax kwarg to pyplot.colorbar and Figure.colorbar so that one can specify the axes object from which space for the colorbar is to be taken, if one does not want to make the colorbar axes Modified: trunk/matplotlib/lib/matplotlib/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/__init__.py 2007-11-14 19:06:52 UTC (rev 4287) +++ trunk/matplotlib/lib/matplotlib/__init__.py 2007-11-14 19:11:54 UTC (rev 4288) @@ -118,6 +118,7 @@ def is_string_like(obj): + if hasattr(obj, 'shape'): return 0 try: obj + '' except (TypeError, ValueError): return 0 return 1 Modified: trunk/matplotlib/lib/matplotlib/cbook.py =================================================================== --- trunk/matplotlib/lib/matplotlib/cbook.py 2007-11-14 19:06:52 UTC (rev 4287) +++ trunk/matplotlib/lib/matplotlib/cbook.py 2007-11-14 19:11:54 UTC (rev 4288) @@ -208,16 +208,11 @@ def is_string_like(obj): + if hasattr(obj, 'shape'): return 0 try: obj + '' except (TypeError, ValueError): return 0 return 1 - -def is_file_like(obj): - try: obj + '' - except (TypeError, ValueError): return 0 - return 1 - def is_scalar(obj): return is_string_like(obj) or not iterable(obj) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-11-14 19:25:47
|
Revision: 4289 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4289&view=rev Author: mdboom Date: 2007-11-14 11:25:46 -0800 (Wed, 14 Nov 2007) Log Message: ----------- Refactored a bunch of places to use "is_writable_file_like". Modified Paths: -------------- trunk/matplotlib/API_CHANGES trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py trunk/matplotlib/lib/matplotlib/backends/backend_ps.py trunk/matplotlib/lib/matplotlib/backends/backend_svg.py trunk/matplotlib/lib/matplotlib/backends/backend_wx.py trunk/matplotlib/lib/matplotlib/cbook.py Modified: trunk/matplotlib/API_CHANGES =================================================================== --- trunk/matplotlib/API_CHANGES 2007-11-14 19:11:54 UTC (rev 4288) +++ trunk/matplotlib/API_CHANGES 2007-11-14 19:25:46 UTC (rev 4289) @@ -1,4 +1,5 @@ - removed cbook.is_file_like, which appears to be broken and unused. + Changed cbook.is_file_like to cbook.is_writable_file_like and + corrected behavior. Added ax kwarg to pyplot.colorbar and Figure.colorbar so that one can specify the axes object from which space for the colorbar Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2007-11-14 19:11:54 UTC (rev 4288) +++ trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2007-11-14 19:25:46 UTC (rev 4289) @@ -19,7 +19,7 @@ from matplotlib.backend_bases import RendererBase, GraphicsContextBase, \ FigureManagerBase, FigureCanvasBase, NavigationToolbar2, cursors from matplotlib.backends.backend_gdk import RendererGDK, FigureCanvasGDK -from matplotlib.cbook import is_string_like, enumerate +from matplotlib.cbook import is_string_like, is_writable_file_like, enumerate from matplotlib.colors import colorConverter from matplotlib.figure import Figure from matplotlib.widgets import SubplotTool @@ -370,7 +370,7 @@ pixbuf.save(filename, format) except gobject.GError, exc: error_msg_gtk('Save figure failure:\n%s' % (exc,), parent=self) - elif hasattr(filename, 'write') and callable(filename.write): + elif is_writable_file_like(filename): if hasattr(pixbuf, 'save_to_callback'): def save_callback(buf, data=None): data.write(buf) Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2007-11-14 19:11:54 UTC (rev 4288) +++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2007-11-14 19:25:46 UTC (rev 4289) @@ -24,7 +24,8 @@ from matplotlib._pylab_helpers import Gcf from matplotlib.backend_bases import RendererBase, GraphicsContextBase,\ FigureManagerBase, FigureCanvasBase -from matplotlib.cbook import Bunch, enumerate, is_string_like, reverse_dict, get_realpath_and_stat +from matplotlib.cbook import Bunch, enumerate, is_string_like, reverse_dict, \ + get_realpath_and_stat, is_writable_file_like from matplotlib.figure import Figure from matplotlib.font_manager import findfont, is_opentype_cff_font from matplotlib.afm import AFM @@ -328,7 +329,7 @@ self.passed_in_file_object = False if is_string_like(filename): fh = file(filename, 'wb') - elif hasattr(filename, 'write') and callable(filename.write): + elif is_writable_file_like(filename): fh = filename self.passed_in_file_object = True else: Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2007-11-14 19:11:54 UTC (rev 4288) +++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2007-11-14 19:25:46 UTC (rev 4289) @@ -15,7 +15,8 @@ from matplotlib.backend_bases import RendererBase, GraphicsContextBase,\ FigureManagerBase, FigureCanvasBase -from matplotlib.cbook import is_string_like, izip, get_realpath_and_stat +from matplotlib.cbook import is_string_like, izip, get_realpath_and_stat, \ + is_writable_file_like from matplotlib.figure import Figure from matplotlib.font_manager import findfont, is_opentype_cff_font @@ -1051,7 +1052,7 @@ if is_string_like(outfile): title = outfile tmpfile = os.path.join(gettempdir(), md5.md5(outfile).hexdigest()) - elif hasattr(outfile, 'write') and callable(outfile.write): + elif is_writable_file_like(outfile): title = None tmpfile = os.path.join(gettempdir(), md5.md5(str(hash(outfile))).hexdigest()) passed_in_file_object = True Modified: trunk/matplotlib/lib/matplotlib/backends/backend_svg.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_svg.py 2007-11-14 19:11:54 UTC (rev 4288) +++ trunk/matplotlib/lib/matplotlib/backends/backend_svg.py 2007-11-14 19:25:46 UTC (rev 4289) @@ -5,7 +5,7 @@ from matplotlib import verbose, __version__, rcParams from matplotlib.backend_bases import RendererBase, GraphicsContextBase,\ FigureManagerBase, FigureCanvasBase -from matplotlib.cbook import is_string_like +from matplotlib.cbook import is_string_like, is_writable_file_like from matplotlib.colors import rgb2hex from matplotlib.figure import Figure from matplotlib.font_manager import findfont, FontProperties @@ -461,7 +461,7 @@ def print_svg(self, filename, *args, **kwargs): if is_string_like(filename): fh_to_close = svgwriter = codecs.open(filename, 'w', 'utf-8') - elif hasattr(filename, 'write') and callable(filename.write): + elif is_writable_file_like(filename): svgwriter = codecs.EncodedFile(filename, 'utf-8') fh_to_close = None else: @@ -472,7 +472,7 @@ if is_string_like(filename): gzipwriter = gzip.GzipFile(filename, 'w') fh_to_close = svgwriter = codecs.EncodedFile(gzipwriter, 'utf-8') - elif hasattr(filename, 'write') and callable(filename.write): + elif is_writable_file_like(filename): fh_to_close = gzipwriter = gzip.GzipFile(fileobj=filename, mode='w') svgwriter = codecs.EncodedFile(gzipwriter, 'utf-8') else: Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2007-11-14 19:11:54 UTC (rev 4288) +++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2007-11-14 19:25:46 UTC (rev 4289) @@ -152,7 +152,7 @@ cursors from matplotlib._pylab_helpers import Gcf from matplotlib.artist import Artist -from matplotlib.cbook import exception_to_str, is_string_like +from matplotlib.cbook import exception_to_str, is_string_like, is_writable_file_like from matplotlib.figure import Figure from matplotlib.text import _process_text_args, Text from matplotlib.widgets import SubplotTool @@ -1042,7 +1042,7 @@ # the error on a call or print_figure may not work because # printing can be qued and called from realize raise RuntimeError('Could not save figure to %s\n' % (filename)) - elif hasattr(filename, 'write') and callable(filename.write): + elif is_writable_file_like(filename): if not self.bitmap.ConvertToImage().SaveStream(filename, filetype): DEBUG_MSG('print_figure() file save error', 4, self) raise RuntimeError('Could not save figure to %s\n' % (filename)) Modified: trunk/matplotlib/lib/matplotlib/cbook.py =================================================================== --- trunk/matplotlib/lib/matplotlib/cbook.py 2007-11-14 19:11:54 UTC (rev 4288) +++ trunk/matplotlib/lib/matplotlib/cbook.py 2007-11-14 19:25:46 UTC (rev 4289) @@ -213,6 +213,9 @@ except (TypeError, ValueError): return 0 return 1 +def is_writable_file_like(obj): + return hasattr(filename, 'write') and callable(filename.write) + def is_scalar(obj): return is_string_like(obj) or not iterable(obj) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cm...@us...> - 2007-11-28 01:32:00
|
Revision: 4474 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4474&view=rev Author: cmoad Date: 2007-11-27 17:31:59 -0800 (Tue, 27 Nov 2007) Log Message: ----------- version bumps Modified Paths: -------------- trunk/matplotlib/API_CHANGES trunk/matplotlib/CHANGELOG trunk/matplotlib/license/LICENSE Modified: trunk/matplotlib/API_CHANGES =================================================================== --- trunk/matplotlib/API_CHANGES 2007-11-27 20:03:48 UTC (rev 4473) +++ trunk/matplotlib/API_CHANGES 2007-11-28 01:31:59 UTC (rev 4474) @@ -1,3 +1,5 @@ +0.91.0 Released + Changed cbook.is_file_like to cbook.is_writable_file_like and corrected behavior. Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2007-11-27 20:03:48 UTC (rev 4473) +++ trunk/matplotlib/CHANGELOG 2007-11-28 01:31:59 UTC (rev 4474) @@ -1,3 +1,6 @@ +=============================================================== +2007-11-27 Released 0.91.0 at revision 4244 + 2007-11-13 All backends now support writing to a file-like object, not just a regular file. savefig() can be passed a file-like object in place of a file path. - MGD Modified: trunk/matplotlib/license/LICENSE =================================================================== --- trunk/matplotlib/license/LICENSE 2007-11-27 20:03:48 UTC (rev 4473) +++ trunk/matplotlib/license/LICENSE 2007-11-28 01:31:59 UTC (rev 4474) @@ -1,4 +1,4 @@ -LICENSE AGREEMENT FOR MATPLOTLIB 0.90 +LICENSE AGREEMENT FOR MATPLOTLIB 0.91 -------------------------------------- 1. This LICENSE AGREEMENT is between John D. Hunter ("JDH"), and the @@ -9,30 +9,30 @@ 2. Subject to the terms and conditions of this License Agreement, JDH hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare -derivative works, distribute, and otherwise use matplotlib 0.90 +derivative works, distribute, and otherwise use matplotlib 0.91 alone or in any derivative version, provided, however, that JDH's License Agreement and JDH's notice of copyright, i.e., "Copyright (c) 2002-2007 John D. Hunter; All Rights Reserved" are retained in -matplotlib 0.90 alone or in any derivative version prepared by +matplotlib 0.91 alone or in any derivative version prepared by Licensee. 3. In the event Licensee prepares a derivative work that is based on or -incorporates matplotlib 0.90 or any part thereof, and wants to +incorporates matplotlib 0.91 or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of -the changes made to matplotlib 0.90. +the changes made to matplotlib 0.91. -4. JDH is making matplotlib 0.90 available to Licensee on an "AS +4. JDH is making matplotlib 0.91 available to Licensee on an "AS IS" basis. JDH MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, JDH MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS -FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF MATPLOTLIB 0.90 +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF MATPLOTLIB 0.91 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS. 5. JDH SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF MATPLOTLIB -0.90 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR +0.91 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING -MATPLOTLIB 0.90, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF +MATPLOTLIB 0.91, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. 6. This License Agreement will automatically terminate upon a material @@ -44,6 +44,6 @@ trademarks or trade name in a trademark sense to endorse or promote products or services of Licensee, or any third party. -8. By copying, installing or otherwise using matplotlib 0.90, +8. By copying, installing or otherwise using matplotlib 0.91, Licensee agrees to be bound by the terms and conditions of this License Agreement. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cm...@us...> - 2007-11-28 02:48:40
|
Revision: 4478 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4478&view=rev Author: cmoad Date: 2007-11-27 18:48:38 -0800 (Tue, 27 Nov 2007) Log Message: ----------- reverting WrapPython.h inclusion Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/setupext.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2007-11-28 02:25:06 UTC (rev 4477) +++ trunk/matplotlib/CHANGELOG 2007-11-28 02:48:38 UTC (rev 4478) @@ -1,5 +1,5 @@ =============================================================== -2007-11-27 Released 0.91.0 at revision 4477 +2007-11-27 Released 0.91.0 at revision 4478 2007-11-13 All backends now support writing to a file-like object, not just a regular file. savefig() can be passed a file-like Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2007-11-28 02:25:06 UTC (rev 4477) +++ trunk/matplotlib/setupext.py 2007-11-28 02:48:38 UTC (rev 4478) @@ -980,7 +980,6 @@ deps = ['src/ft2font.cpp', 'src/mplutils.cpp'] deps.extend(glob.glob('CXX/*.cxx')) deps.extend(glob.glob('CXX/*.c')) - deps.extend(glob.glob('CXX/*.h')) module = Extension('matplotlib.ft2font', deps) add_ft2font_flags(module) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2007-11-29 19:44:13
|
Revision: 4504 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4504&view=rev Author: jdh2358 Date: 2007-11-29 11:43:20 -0800 (Thu, 29 Nov 2007) Log Message: ----------- minor changes for htdocs Modified Paths: -------------- trunk/matplotlib/examples/mathtext_examples.py trunk/matplotlib/lib/matplotlib/mathtext.py Modified: trunk/matplotlib/examples/mathtext_examples.py =================================================================== --- trunk/matplotlib/examples/mathtext_examples.py 2007-11-29 19:42:34 UTC (rev 4503) +++ trunk/matplotlib/examples/mathtext_examples.py 2007-11-29 19:43:20 UTC (rev 4504) @@ -49,7 +49,15 @@ r'$\widehat{abc}\widetilde{def}$', r'$\Gamma \Delta \Theta \Lambda \Xi \Pi \Sigma \Upsilon \Phi \Psi \Omega$', r'$\alpha \beta \gamma \delta \epsilon \zeta \eta \theta \iota \lambda \mu \nu \xi \pi \kappa \rho \sigma \tau \upsilon \phi \chi \psi$', +<<<<<<< .mine +<<<<<<< .mine + #ur'Generic symbol: $\u23ce \mathrm{\ue0f2}$' +======= + #ur'Generic symbol: $\u23ce \mathrm{\ue0f2 \U0001D538}$' +======= ur'Generic symbol: $\u23ce \mathrm{\ue0f2 \U0001D538}$' +>>>>>>> .r4393 +>>>>>>> .r4174 ] from pylab import * @@ -63,7 +71,11 @@ axis([0, 3, -len(tests), 0]) yticks(arange(len(tests)) * -1) for i, s in enumerate(tests): +<<<<<<< .mine + print i,s +======= print (i, s) +>>>>>>> .r4174 text(0.1, -i, s, fontsize=20) savefig('mathtext_examples') Modified: trunk/matplotlib/lib/matplotlib/mathtext.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mathtext.py 2007-11-29 19:42:34 UTC (rev 4503) +++ trunk/matplotlib/lib/matplotlib/mathtext.py 2007-11-29 19:43:20 UTC (rev 4504) @@ -1092,7 +1092,7 @@ # Typesetting math formulas # # Many of the docstrings below refer to a numbered "node" in that -# book, e.g. @123 +# book, e.g. node123 # # Note that (as TeX) y increases downward, unlike many other parts of # matplotlib. @@ -1120,7 +1120,7 @@ class Node(object): """A node in the TeX box model - @133 + node133 """ def __init__(self): self.size = 0 @@ -1149,7 +1149,7 @@ class Box(Node): """Represents any node with a physical location. - @135""" + node135""" def __init__(self, width, height, depth): Node.__init__(self) self.width = width @@ -1195,7 +1195,7 @@ The metrics must be converted to the TeX way, and the advance (if different from width) must be converted into a Kern node when the Char is added to its parent Hlist. - @134""" + node134""" def __init__(self, c, state): Node.__init__(self) self.c = c @@ -1286,7 +1286,7 @@ class List(Box): """A list of nodes (either horizontal or vertical). - @135""" + node135""" def __init__(self, elements): Box.__init__(self, 0., 0., 0.) self.shift_amount = 0. # An arbitrary offset @@ -1344,7 +1344,7 @@ class Hlist(List): """A horizontal list of boxes. - @135""" + node135""" def __init__(self, elements, w=0., m='additional', do_kern=True): List.__init__(self, elements) if do_kern: @@ -1387,7 +1387,7 @@ Thus, hpack(w, exactly) produces a box whose width is exactly w, while hpack (w, additional ) yields a box whose width is the natural width plus w. The default values produce a box with the natural width. - @644, @649""" + node644, node649""" # I don't know why these get reset in TeX. Shift_amount is pretty # much useless if we do. #self.shift_amount = 0. @@ -1434,7 +1434,7 @@ class Vlist(List): """A vertical list of boxes. - @137""" + node137""" def __init__(self, elements, h=0., m='additional'): List.__init__(self, elements) self.vpack() @@ -1451,7 +1451,7 @@ Thus, vpack(h, exactly) produces a box whose width is exactly w, while vpack(w, additional) yields a box whose width is the natural width plus w. The default values produce a box with the natural width. - @644, @668""" + node644, node668""" # I don't know why these get reset in TeX. Shift_amount is pretty # much useless if we do. # self.shift_amount = 0. @@ -1510,7 +1510,7 @@ rule up to the boundary of the innermost enclosing box. This is called a "running dimension." The width is never running in an Hlist; the height and depth are never running in a Vlist. - @138""" + node138""" def __init__(self, width, height, depth, state): Box.__init__(self, width, height, depth) self.font_output = state.font_output @@ -1538,7 +1538,7 @@ GlueSpec class, which is shared between multiple glue objects. (This is a memory optimization which probably doesn't matter anymore, but it's easier to stick to what TeX does.) - @149, @152""" + node149, node152""" def __init__(self, glue_type, copy=False): Node.__init__(self) self.glue_subtype = 'normal' @@ -1566,7 +1566,7 @@ self.glue_spec.width *= GROW_FACTOR class GlueSpec(object): - """@150, @151""" + """node150, node151""" def __init__(self, width=0., stretch=0., stretch_order=0, shrink=0., shrink_order=0): self.width = width self.stretch = stretch @@ -1647,7 +1647,7 @@ better to move them closer together or further apart. A kern node can also appear in a vertical list, when its 'width' denotes additional spacing in the vertical direction. - @155""" + node155""" def __init__(self, width): Node.__init__(self) self.width = width @@ -1733,7 +1733,7 @@ and vlist_out , which traverse the Hlists and Vlists inside of horizontal and vertical boxes. The global variables used in TeX to store state as it processes have become member variables here. - @592.""" + node592.""" def __call__(self, ox, oy, box): self.max_push = 0 # Deepest nesting of push commands so far self.cur_s = 0 @@ -1769,7 +1769,7 @@ elif isinstance(p, Kern): self.cur_h += p.width elif isinstance(p, List): - # @623 + # node623 if len(p.children) == 0: self.cur_h += p.width else: @@ -1783,7 +1783,7 @@ self.cur_h = edge + p.width self.cur_v = base_line elif isinstance(p, Box): - # @624 + # node624 rule_height = p.height rule_depth = p.depth rule_width = p.width @@ -1799,7 +1799,7 @@ self.cur_v = baseline self.cur_h += rule_width elif isinstance(p, Glue): - # @625 + # node625 glue_spec = p.glue_spec rule_width = glue_spec.width - cur_g if glue_sign != 0: # normal @@ -2470,7 +2470,7 @@ else: shift_down = SUBDROP * xHeight if super is None: - # @757 + # node757 sub.shrink() x = Hlist([sub]) # x.width += SCRIPT_SPACE * xHeight This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2007-11-29 20:16:50
|
Revision: 4507 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4507&view=rev Author: jdh2358 Date: 2007-11-29 12:16:48 -0800 (Thu, 29 Nov 2007) Log Message: ----------- Applied Ludwigs build tkagg w/o x11 server patch Modified Paths: -------------- trunk/matplotlib/CODING_GUIDE trunk/matplotlib/examples/loadrec.py trunk/matplotlib/setupext.py Modified: trunk/matplotlib/CODING_GUIDE =================================================================== --- trunk/matplotlib/CODING_GUIDE 2007-11-29 19:56:10 UTC (rev 4506) +++ trunk/matplotlib/CODING_GUIDE 2007-11-29 20:16:48 UTC (rev 4507) @@ -117,7 +117,7 @@ -for older versions of emacs (emacs<22) you may need to do +for older versions of emacs (emacs<22) you need to do (add-hook 'python-mode-hook (lambda () Modified: trunk/matplotlib/examples/loadrec.py =================================================================== --- trunk/matplotlib/examples/loadrec.py 2007-11-29 19:56:10 UTC (rev 4506) +++ trunk/matplotlib/examples/loadrec.py 2007-11-29 20:16:48 UTC (rev 4507) @@ -2,6 +2,7 @@ from pylab import figure, show a = mlab.csv2rec('data/msft.csv') +a.sort() print a.dtype fig = figure() Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2007-11-29 19:56:10 UTC (rev 4506) +++ trunk/matplotlib/setupext.py 2007-11-29 20:16:48 UTC (rev 4507) @@ -92,6 +92,8 @@ BUILT_CONTOUR = False BUILT_GDK = False +TCL_TK_CACHE = None + AGG_VERSION = 'agg23' # for nonstandard installation/build with --prefix variable @@ -797,51 +799,6 @@ # or else you'll build for a wrong version of the Tcl # interpreter (leading to nasty segfaults). -class FoundTclTk: - pass - -def find_tcltk(): - """Finds Tcl/Tk includes/libraries/version by interrogating Tkinter.""" - # By this point, we already know that Tkinter imports correctly - import Tkinter - o = FoundTclTk() - try: - tk=Tkinter.Tk() - except Tkinter.TclError: - o.tcl_lib = "/usr/local/lib" - o.tcl_inc = "/usr/local/include" - o.tk_lib = "/usr/local/lib" - o.tk_inc = "/usr/local/include" - o.tkv = "" - else: - tk.withdraw() - o.tcl_lib = os.path.normpath(os.path.join(str(tk.getvar('tcl_library')), '../')) - o.tk_lib = os.path.normpath(os.path.join(str(tk.getvar('tk_library')), '../')) - o.tkv = str(Tkinter.TkVersion)[:3] - o.tcl_inc = os.path.normpath(os.path.join(str(tk.getvar('tcl_library')), - '../../include/tcl'+o.tkv)) - if not os.path.exists(o.tcl_inc): - o.tcl_inc = os.path.normpath(os.path.join(str(tk.getvar('tcl_library')), - '../../include')) - o.tk_inc = os.path.normpath(os.path.join(str(tk.getvar('tk_library')), - '../../include/tk'+o.tkv)) - if not os.path.exists(o.tk_inc): - o.tk_inc = os.path.normpath(os.path.join(str(tk.getvar('tk_library')), - '../../include')) - - if ((not os.path.exists(os.path.join(o.tk_inc,'tk.h'))) and - os.path.exists(os.path.join(o.tcl_inc,'tk.h'))): - o.tk_inc = o.tcl_inc - - if not os.path.exists(o.tcl_inc): - # this is a hack for suse linux, which is broken - if (sys.platform.startswith('linux') and - os.path.exists('/usr/include/tcl.h') and - os.path.exists('/usr/include/tk.h')): - o.tcl_inc = '/usr/include/' - o.tk_inc = '/usr/include/' - return o - def check_for_tk(): gotit = False explanation = None @@ -853,29 +810,27 @@ explanation = 'Tkinter present but import failed' else: if Tkinter.TkVersion < 8.3: - explanation = "Tcl/Tk v8.3 or later required\n" - sys.exit(1) + explanation = "Tcl/Tk v8.3 or later required" else: - try: - tk = Tkinter.Tk() - tk.withdraw() - except Tkinter.TclError: - explanation = """\ -Using default library and include directories for Tcl and Tk because a -Tk window failed to open. You may need to define DISPLAY for Tk to work -so that setup can determine where your libraries are located.""" gotit = True - + if gotit: module = Extension('test', []) try: - add_tk_flags(module) + explanation = add_tk_flags(module) except RuntimeError, e: explanation = str(e) gotit = False - if not find_include_file(module.include_dirs, "tk.h"): - explanation = 'Tkinter present, but header files are not installed. You may need to install development packages.' - + else: + if not find_include_file(module.include_dirs, "tk.h"): + message = 'Tkinter present, but header files are not found. ' + \ + 'You may need to install development packages.' + if explanation is not None: + explanation += '\n' + message + else: + explanation = message + gotit = False + if gotit: print_status("Tkinter", "Tkinter: %s, Tk: %s, Tcl: %s" % (Tkinter.__version__.split()[-2], Tkinter.TkVersion, Tkinter.TclVersion)) @@ -885,25 +840,65 @@ print_message(explanation) return gotit +def query_tcltk(): + """Tries to open a Tk window in order to query the Tk object about its library paths. + This should never be called more than once by the same process, as Tk intricacies + may cause the Python interpreter to hang. The function also has a workaround if + no X server is running (useful for autobuild systems).""" + global TCL_TK_CACHE + # Use cached values if they exist, which ensures this function only executes once + if TCL_TK_CACHE is not None: + return TCL_TK_CACHE + + # By this point, we already know that Tkinter imports correctly + import Tkinter + tcl_lib_dir = '' + tk_lib_dir = '' + # First try to open a Tk window (requires a running X server) + try: + tk = Tkinter.Tk() + except Tkinter.TclError: + # Next, start Tcl interpreter without opening a Tk window (no need for X server) + # This feature is available in python version 2.4 and up + try: + tcl = Tkinter.Tcl() + except AttributeError: # Python version not high enough + pass + except Tkinter.TclError: # Something went wrong while opening Tcl + pass + else: + tcl_lib_dir = str(tcl.getvar('tcl_library')) + # Guess Tk location based on Tcl location + tk_lib_dir = tcl_lib_dir.replace('Tcl', 'Tk').replace('tcl', 'tk') + else: + # Obtain Tcl and Tk locations from Tk widget + tk.withdraw() + tcl_lib_dir = str(tk.getvar('tcl_library')) + tk_lib_dir = str(tk.getvar('tk_library')) + + # Save directories and version string to cache + TCL_TK_CACHE = tcl_lib_dir, tk_lib_dir, str(Tkinter.TkVersion)[:3] + return TCL_TK_CACHE + def add_tk_flags(module): 'Add the module flags to build extensions which use tk' - if sys.platform=='win32': + message = None + if sys.platform == 'win32': major, minor1, minor2, s, tmp = sys.version_info - if major==2 and minor1 in [3, 4, 5]: + if major == 2 and minor1 in [3, 4, 5]: module.include_dirs.extend(['win32_static/include/tcl8.4']) module.libraries.extend(['tk84', 'tcl84']) - elif major==2 and minor1==2: + elif major == 2 and minor1 == 2: module.include_dirs.extend(['win32_static/include/tcl8.3']) module.libraries.extend(['tk83', 'tcl83']) else: raise RuntimeError('No tk/win32 support for this python version yet') module.library_dirs.extend([os.path.join(sys.prefix, 'dlls')]) - return - - elif sys.platform == 'darwin' : + + elif sys.platform == 'darwin': # this config section lifted directly from Imaging - thanks to # the effbot! - + # First test for a MacOSX/darwin framework install from os.path import join, exists framework_dirs = [ @@ -911,8 +906,8 @@ '/Library/Frameworks', join(os.getenv('HOME'), '/Library/Frameworks') ] - - # Find the directory that contains the Tcl.framwork and Tk.framework + + # Find the directory that contains the Tcl.framework and Tk.framework # bundles. # XXX distutils should support -F! tk_framework_found = 0 @@ -936,7 +931,7 @@ for fw in 'Tcl', 'Tk' for H in 'Headers', 'Versions/Current/PrivateHeaders' ] - + # For 8.4a2, the X11 headers are not included. Rather than include a # complicated search, this is a hard-coded path. It could bail out # if X11 libs are not found... @@ -945,15 +940,55 @@ module.include_dirs.extend(tk_include_dirs) module.extra_link_args.extend(frameworks) module.extra_compile_args.extend(frameworks) - return + + # you're still here? ok we'll try it this way... + else: + # Query Tcl/Tk system for library paths and version string + tcl_lib_dir, tk_lib_dir, tk_ver = query_tcltk() # todo: try/except + + # Process base directories to obtain include + lib dirs + if tcl_lib_dir != '' and tk_lib_dir != '': + tcl_lib = os.path.normpath(os.path.join(tcl_lib_dir, '../')) + tk_lib = os.path.normpath(os.path.join(tk_lib_dir, '../')) + tcl_inc = os.path.normpath(os.path.join(tcl_lib_dir, + '../../include/tcl' + tk_ver)) + if not os.path.exists(tcl_inc): + tcl_inc = os.path.normpath(os.path.join(tcl_lib_dir, + '../../include')) + tk_inc = os.path.normpath(os.path.join(tk_lib_dir, + '../../include/tk' + tk_ver)) + if not os.path.exists(tk_inc): + tk_inc = os.path.normpath(os.path.join(tk_lib_dir, + '../../include')) + + if ((not os.path.exists(os.path.join(tk_inc,'tk.h'))) and + os.path.exists(os.path.join(tcl_inc,'tk.h'))): + tk_inc = tcl_inc + + if not os.path.exists(tcl_inc): + # this is a hack for suse linux, which is broken + if (sys.platform.startswith('linux') and + os.path.exists('/usr/include/tcl.h') and + os.path.exists('/usr/include/tk.h')): + tcl_inc = '/usr/include' + tk_inc = '/usr/include' + else: + message = """\ +Using default library and include directories for Tcl and Tk because a +Tk window failed to open. You may need to define DISPLAY for Tk to work +so that setup can determine where your libraries are located.""" + tcl_inc = "/usr/local/include" + tk_inc = "/usr/local/include" + tcl_lib = "/usr/local/lib" + tk_lib = "/usr/local/lib" + tk_ver = "" + # Add final versions of directories and libraries to module lists + module.include_dirs.extend([tcl_inc, tk_inc]) + module.library_dirs.extend([tcl_lib, tk_lib]) + module.libraries.extend(['tk' + tk_ver, 'tcl' + tk_ver]) + + return message - # you're still here? ok we'll try it this way - o = find_tcltk() # todo: try/except - module.include_dirs.extend([o.tcl_inc, o.tk_inc]) - module.library_dirs.extend([o.tcl_lib, o.tk_lib]) - module.libraries.extend(['tk'+o.tkv, 'tcl'+o.tkv]) - - def add_windowing_flags(module): 'Add the module flags to build extensions using windowing api' module.include_dirs.extend(['C:/include']) @@ -1031,9 +1066,6 @@ deps, ) - # add agg flags before pygtk because agg only supports freetype1 - # and pygtk includes freetype2. This is a bit fragile. - add_tk_flags(module) # do this first add_agg_flags(module) add_ft2font_flags(module) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cm...@us...> - 2007-11-30 02:47:08
|
Revision: 4514 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4514&view=rev Author: cmoad Date: 2007-11-29 18:47:06 -0800 (Thu, 29 Nov 2007) Log Message: ----------- minor rev bump Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/__init__.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2007-11-30 02:41:01 UTC (rev 4513) +++ trunk/matplotlib/CHANGELOG 2007-11-30 02:47:06 UTC (rev 4514) @@ -1,5 +1,5 @@ =============================================================== -2007-11-27 Released 0.91.1 at revision 4513 +2007-11-27 Released 0.91.1 at revision 4514 =============================================================== 2007-11-27 Released 0.91.0 at revision 4478 Modified: trunk/matplotlib/lib/matplotlib/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/__init__.py 2007-11-30 02:41:01 UTC (rev 4513) +++ trunk/matplotlib/lib/matplotlib/__init__.py 2007-11-30 02:47:06 UTC (rev 4514) @@ -55,7 +55,7 @@ """ from __future__ import generators -__version__ = '0.91.0' +__version__ = '0.91.1' __revision__ = '$Revision$' __date__ = '$Date$' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cm...@us...> - 2007-11-30 03:42:38
|
Revision: 4515 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4515&view=rev Author: cmoad Date: 2007-11-29 19:42:35 -0800 (Thu, 29 Nov 2007) Log Message: ----------- CXX/WrapPython.h missing from MANIFEST Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/MANIFEST.in Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2007-11-30 02:47:06 UTC (rev 4514) +++ trunk/matplotlib/CHANGELOG 2007-11-30 03:42:35 UTC (rev 4515) @@ -1,5 +1,5 @@ =============================================================== -2007-11-27 Released 0.91.1 at revision 4514 +2007-11-27 Released 0.91.1 at revision 4515 =============================================================== 2007-11-27 Released 0.91.0 at revision 4478 Modified: trunk/matplotlib/MANIFEST.in =================================================================== --- trunk/matplotlib/MANIFEST.in 2007-11-30 02:47:06 UTC (rev 4514) +++ trunk/matplotlib/MANIFEST.in 2007-11-30 03:42:35 UTC (rev 4515) @@ -12,7 +12,7 @@ recursive-include examples README *.py prune examples/_tmp_* recursive-include src *.cpp *.c *.h -recursive-include CXX *.cxx *.hxx *.c +recursive-include CXX *.cxx *.hxx *.c *.h recursive-include agg23 * recursive-include lib * recursive-include swig * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cm...@us...> - 2007-11-30 04:00:30
|
Revision: 4516 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4516&view=rev Author: cmoad Date: 2007-11-29 20:00:16 -0800 (Thu, 29 Nov 2007) Log Message: ----------- ttconv missing from MANFEST Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/MANIFEST.in Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2007-11-30 03:42:35 UTC (rev 4515) +++ trunk/matplotlib/CHANGELOG 2007-11-30 04:00:16 UTC (rev 4516) @@ -1,5 +1,5 @@ =============================================================== -2007-11-27 Released 0.91.1 at revision 4515 +2007-11-27 Released 0.91.1 at revision 4516 =============================================================== 2007-11-27 Released 0.91.0 at revision 4478 Modified: trunk/matplotlib/MANIFEST.in =================================================================== --- trunk/matplotlib/MANIFEST.in 2007-11-30 03:42:35 UTC (rev 4515) +++ trunk/matplotlib/MANIFEST.in 2007-11-30 04:00:16 UTC (rev 4516) @@ -16,3 +16,4 @@ recursive-include agg23 * recursive-include lib * recursive-include swig * +recursive-include ttconv *.cpp *.h This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cm...@us...> - 2007-11-30 04:09:49
|
Revision: 4517 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4517&view=rev Author: cmoad Date: 2007-11-29 20:09:48 -0800 (Thu, 29 Nov 2007) Log Message: ----------- added setup.cfg.template Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/MANIFEST.in Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2007-11-30 04:00:16 UTC (rev 4516) +++ trunk/matplotlib/CHANGELOG 2007-11-30 04:09:48 UTC (rev 4517) @@ -1,5 +1,5 @@ =============================================================== -2007-11-27 Released 0.91.1 at revision 4516 +2007-11-27 Released 0.91.1 at revision 4517 =============================================================== 2007-11-27 Released 0.91.0 at revision 4478 Modified: trunk/matplotlib/MANIFEST.in =================================================================== --- trunk/matplotlib/MANIFEST.in 2007-11-30 04:00:16 UTC (rev 4516) +++ trunk/matplotlib/MANIFEST.in 2007-11-30 04:09:48 UTC (rev 4517) @@ -1,7 +1,7 @@ include API_CHANGES CHANGELOG KNOWN_BUGS INSTALL NUMARRAY_ISSUES include INTERACTIVE TODO include Makefile MANIFEST.in MANIFEST -include matplotlibrc.template matplotlibrc +include matplotlibrc.template matplotlibrc setup.cfg.template include __init__.py setupext.py setup.py setupegg.py makeswig.py include examples/data/* include lib/matplotlib/toolkits This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2007-12-04 14:38:53
|
Revision: 4576 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4576&view=rev Author: jdh2358 Date: 2007-12-04 06:38:48 -0800 (Tue, 04 Dec 2007) Log Message: ----------- added additional lines to MANIFEST.in Modified Paths: -------------- trunk/matplotlib/CODING_GUIDE trunk/matplotlib/MANIFEST.in trunk/matplotlib/examples/poly_editor.py Modified: trunk/matplotlib/CODING_GUIDE =================================================================== --- trunk/matplotlib/CODING_GUIDE 2007-12-04 13:12:09 UTC (rev 4575) +++ trunk/matplotlib/CODING_GUIDE 2007-12-04 14:38:48 UTC (rev 4576) @@ -39,8 +39,11 @@ * If you have altered extension code, do you pass unit/memleak_hawaii.py? + * if you have added new files or directories, or reorganized + existing ones, are the new files included in the match patterns in + MANIFEST.in. This file determines what goes into the src + distribution of the mpl build. - == Importing and name spaces == For numpy, use: Modified: trunk/matplotlib/MANIFEST.in =================================================================== --- trunk/matplotlib/MANIFEST.in 2007-12-04 13:12:09 UTC (rev 4575) +++ trunk/matplotlib/MANIFEST.in 2007-12-04 14:38:48 UTC (rev 4576) @@ -5,8 +5,13 @@ include __init__.py setupext.py setup.py setupegg.py makeswig.py include examples/data/* include lib/matplotlib/toolkits +include lib/matplotlib/mpl-data/matplotlib.conf +include lib/matplotlib/mpl-data/matplotlib.conf.template +include lib/matplotlib/mpl-data/lineprops.glade +include lib/matplotlib/mpl-data/matplotlibrc include lib/matplotlib/mpl-data/images/* include lib/matplotlib/mpl-data/fonts/ttf/* +include lib/matplotlib/mpl-data/fonts/pdfcorefonts/* include lib/matplotlib/mpl-data/fonts/afm/* recursive-include license LICENSE* recursive-include examples README *.py Modified: trunk/matplotlib/examples/poly_editor.py =================================================================== --- trunk/matplotlib/examples/poly_editor.py 2007-12-04 13:12:09 UTC (rev 4575) +++ trunk/matplotlib/examples/poly_editor.py 2007-12-04 14:38:48 UTC (rev 4576) @@ -9,8 +9,6 @@ from matplotlib.mlab import dist_point_to_segment - - class PolygonInteractor: """ An polygon editor. @@ -73,7 +71,7 @@ # display coords xt, yt = self.poly.get_transform().numerix_x_y(x, y) d = sqrt((xt-event.x)**2 + (yt-event.y)**2) - indseq = nonzero(equal(d, amin(d))) + indseq = nonzero(equal(d, amin(d)))[0] ind = indseq[0] if d[ind]>=self.epsilon: @@ -128,6 +126,7 @@ if event.inaxes is None: return if event.button != 1: return x,y = event.xdata, event.ydata + self.poly.xy[self._ind] = x,y self.line.set_data(zip(*self.poly.xy)) @@ -160,7 +159,7 @@ ax.add_patch(poly) p = PolygonInteractor( ax, poly) -ax.add_line(p.line) +#ax.add_line(p.line) ax.set_title('Click and drag a point to move it') ax.set_xlim((-2,2)) ax.set_ylim((-2,2)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |