From: <ef...@us...> - 2008-12-13 06:20:38
|
Revision: 6595 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6595&view=rev Author: efiring Date: 2008-12-13 06:20:28 +0000 (Sat, 13 Dec 2008) Log Message: ----------- Start eliminating obsolete and temporary rcParams key, numerix.npyma module Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/config/mplconfig.py trunk/matplotlib/lib/matplotlib/config/rcsetup.py trunk/matplotlib/lib/matplotlib/numerix/__init__.py trunk/matplotlib/lib/matplotlib/numerix/ma/__init__.py trunk/matplotlib/lib/matplotlib/numerix/npyma/__init__.py trunk/matplotlib/lib/matplotlib/rcsetup.py trunk/matplotlib/matplotlibrc.template Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-12-12 21:22:04 UTC (rev 6594) +++ trunk/matplotlib/CHANGELOG 2008-12-13 06:20:28 UTC (rev 6595) @@ -1,3 +1,7 @@ +2008-12-12 Preparations to eliminate maskedarray rcParams key: its + use will now generate a warning. Similarly, importing + the obsolote numerix.npyma will generate a warning. - EF + 2008-12-12 Added support for the numpy.histogram() weights parameter to the axes hist() method. Docs taken from numpy - MM @@ -5,7 +9,7 @@ 2008-12-12 Removed external packages: configobj and enthought.traits which are only required by the experimental traited config - and are somewhat out of date. If needed, install them + and are somewhat out of date. If needed, install them independently, see: http://code.enthought.com/projects/traits Modified: trunk/matplotlib/lib/matplotlib/config/mplconfig.py =================================================================== --- trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2008-12-12 21:22:04 UTC (rev 6594) +++ trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2008-12-13 06:20:28 UTC (rev 6595) @@ -59,7 +59,6 @@ timezone = T.Trait('UTC', pytz.all_timezones) datapath = T.Trait(cutils.get_data_path()) numerix = T.Trait('numpy', 'numpy', 'numeric', 'numarray') - maskedarray = T.false units = T.false class backend(TConfig): @@ -290,7 +289,6 @@ 'backend' : (self.tconfig.backend, 'use'), 'backend_fallback' : (self.tconfig.backend, 'fallback'), 'numerix' : (self.tconfig, 'numerix'), - 'maskedarray' : (self.tconfig, 'maskedarray'), 'toolbar' : (self.tconfig, 'toolbar'), 'datapath' : (self.tconfig, 'datapath'), 'units' : (self.tconfig, 'units'), Modified: trunk/matplotlib/lib/matplotlib/config/rcsetup.py =================================================================== --- trunk/matplotlib/lib/matplotlib/config/rcsetup.py 2008-12-12 21:22:04 UTC (rev 6594) +++ trunk/matplotlib/lib/matplotlib/config/rcsetup.py 2008-12-13 06:20:28 UTC (rev 6595) @@ -296,7 +296,6 @@ defaultParams = { 'backend' : ['WXAgg', validate_backend], 'numerix' : ['numpy', validate_numerix], - 'maskedarray' : [False, validate_bool], 'toolbar' : ['toolbar2', validate_toolbar], 'datapath' : [None, validate_path_exists], # handled by _get_data_path_cached 'units' : [False, validate_bool], Modified: trunk/matplotlib/lib/matplotlib/numerix/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/numerix/__init__.py 2008-12-12 21:22:04 UTC (rev 6594) +++ trunk/matplotlib/lib/matplotlib/numerix/__init__.py 2008-12-13 06:20:28 UTC (rev 6595) @@ -20,7 +20,6 @@ from matplotlib import rcParams, verbose which = None, None -use_maskedarray = None # First, see if --numarray or --Numeric was specified on the command # line: @@ -31,10 +30,6 @@ "--NumPy", "--numpy", "--NUMPY", "--Numpy", ]: which = a[2:], "command line" - if a == "--maskedarray": - use_maskedarray = True - if a == "--ma": - use_maskedarray = False try: del a except NameError: pass @@ -45,11 +40,6 @@ except KeyError: pass -if use_maskedarray is None: - try: - use_maskedarray = rcParams['maskedarray'] - except KeyError: - use_maskedarray = False # If all the above fail, default to Numeric. Most likely not used. if which[0] is None: Modified: trunk/matplotlib/lib/matplotlib/numerix/ma/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/numerix/ma/__init__.py 2008-12-12 21:22:04 UTC (rev 6594) +++ trunk/matplotlib/lib/matplotlib/numerix/ma/__init__.py 2008-12-13 06:20:28 UTC (rev 6595) @@ -1,4 +1,4 @@ -from matplotlib.numerix import which, use_maskedarray +from matplotlib.numerix import which if which[0] == "numarray": from numarray.ma import * @@ -9,15 +9,10 @@ nomask = None getmaskorNone = getmask elif which[0] == "numpy": - if use_maskedarray: - from maskedarray import * - print "using maskedarray" - else: - try: - from numpy.ma import * # numpy 1.05 and later - except ImportError: - from numpy.core.ma import * # earlier - #print "using ma" + try: + from numpy.ma import * # numpy 1.05 and later + except ImportError: + from numpy.core.ma import * # earlier def getmaskorNone(obj): _msk = getmask(obj) if _msk is nomask: Modified: trunk/matplotlib/lib/matplotlib/numerix/npyma/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/numerix/npyma/__init__.py 2008-12-12 21:22:04 UTC (rev 6594) +++ trunk/matplotlib/lib/matplotlib/numerix/npyma/__init__.py 2008-12-13 06:20:28 UTC (rev 6595) @@ -1,11 +1,7 @@ -from matplotlib.numerix import use_maskedarray +import warnings -if use_maskedarray: - from maskedarray import * - print "using maskedarray" -else: - try: - from numpy.ma import * # numpy 1.05 and later - except ImportError: - from numpy.core.ma import * # earlier - #print "using ma" +warnings.warn("npyma is obsolete and will be removed", DeprecationWarning) +try: + from numpy.ma import * # numpy 1.05 and later +except ImportError: + from numpy.core.ma import * # earlier Modified: trunk/matplotlib/lib/matplotlib/rcsetup.py =================================================================== --- trunk/matplotlib/lib/matplotlib/rcsetup.py 2008-12-12 21:22:04 UTC (rev 6594) +++ trunk/matplotlib/lib/matplotlib/rcsetup.py 2008-12-13 06:20:28 UTC (rev 6595) @@ -118,6 +118,16 @@ if v: warnings.warn("figure.autolayout is not currently supported") +def validate_maskedarray(v): + # 2008/12/12: start warning; later, remove all traces of maskedarray + try: + if v == 'obsolete': + return v + except ValueError: + pass + warnings.warn('rcParams key "maskedarray" is obsolete and has no effect;\n' + ' please delete it from your matplotlibrc file') + class validate_nseq_float: def __init__(self, n): self.n = n @@ -311,7 +321,7 @@ 'backend' : ['Agg', validate_backend], # agg is certainly present 'backend_fallback' : [True, validate_bool], # agg is certainly present 'numerix' : ['numpy', validate_numerix], - 'maskedarray' : [False, validate_bool], + 'maskedarray' : ['obsolete', validate_maskedarray], #to be removed 'toolbar' : ['toolbar2', validate_toolbar], 'datapath' : [None, validate_path_exists], # handled by _get_data_path_cached 'units' : [False, validate_bool], Modified: trunk/matplotlib/matplotlibrc.template =================================================================== --- trunk/matplotlib/matplotlibrc.template 2008-12-12 21:22:04 UTC (rev 6594) +++ trunk/matplotlib/matplotlibrc.template 2008-12-13 06:20:28 UTC (rev 6595) @@ -35,9 +35,6 @@ # you if backend_fallback is True #backend_fallback: True numerix : %(numerix)s # numpy, Numeric or numarray -#maskedarray : False # True to use external maskedarray module - # instead of numpy.ma; this is a temporary - # setting for testing maskedarray. #interactive : False # see http://matplotlib.sourceforge.net/interactive.html #toolbar : toolbar2 # None | classic | toolbar2 #timezone : UTC # a pytz timezone string, eg US/Central or Europe/Paris This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2008-12-14 16:43:31
|
Revision: 6602 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6602&view=rev Author: jdh2358 Date: 2008-12-14 16:43:20 +0000 (Sun, 14 Dec 2008) Log Message: ----------- added release dir Modified Paths: -------------- trunk/matplotlib/doc/_templates/gallery.html trunk/matplotlib/doc/devel/release_guide.rst trunk/matplotlib/doc/users/mathtext.rst trunk/matplotlib/examples/event_handling/path_editor.py trunk/matplotlib/examples/pylab_examples/loadrec.py trunk/matplotlib/examples/pylab_examples/mathtext_examples.py Added Paths: ----------- trunk/matplotlib/release/ trunk/matplotlib/release/osx/ trunk/matplotlib/release/osx/Makefile trunk/matplotlib/release/osx/README.txt trunk/matplotlib/release/osx/data/ trunk/matplotlib/release/osx/data/bdist.patch trunk/matplotlib/release/osx/data/setup.cfg trunk/matplotlib/release/osx/matplotlib-0.98.5.tar.gz Modified: trunk/matplotlib/doc/_templates/gallery.html =================================================================== --- trunk/matplotlib/doc/_templates/gallery.html 2008-12-13 19:01:00 UTC (rev 6601) +++ trunk/matplotlib/doc/_templates/gallery.html 2008-12-14 16:43:20 UTC (rev 6602) @@ -169,8 +169,6 @@ <a href="examples/pylab_examples/customize_rc.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/customize_rc.png" border="0" alt="customize_rc"/></a> -<a href="examples/pylab_examples/dannys_example.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/dannys_example.png" border="0" alt="dannys_example"/></a> - <a href="examples/pylab_examples/dash_control.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/dash_control.png" border="0" alt="dash_control"/></a> <a href="examples/pylab_examples/dashpointlabel.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/dashpointlabel.png" border="0" alt="dashpointlabel"/></a> @@ -477,8 +475,6 @@ <a href="examples/pylab_examples/step_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/step_demo.png" border="0" alt="step_demo"/></a> -<a href="examples/pylab_examples/stix_fonts_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/stix_fonts_demo.png" border="0" alt="stix_fonts_demo"/></a> - <a href="examples/pylab_examples/subplot_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/subplot_demo.png" border="0" alt="subplot_demo"/></a> <a href="examples/pylab_examples/subplot_toolbar.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/subplot_toolbar_00.png" border="0" alt="subplot_toolbar"/></a> @@ -491,8 +487,6 @@ <a href="examples/pylab_examples/table_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/table_demo.png" border="0" alt="table_demo"/></a> -<a href="examples/pylab_examples/tex_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/tex_demo.png" border="0" alt="tex_demo"/></a> - <a href="examples/pylab_examples/text_handles.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/text_handles.png" border="0" alt="text_handles"/></a> <a href="examples/pylab_examples/text_rotation.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/text_rotation.png" border="0" alt="text_rotation"/></a> @@ -509,8 +503,6 @@ <a href="examples/pylab_examples/unicode_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/unicode_demo.png" border="0" alt="unicode_demo"/></a> -<a href="examples/pylab_examples/usetex_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/usetex_demo.png" border="0" alt="usetex_demo"/></a> - <a href="examples/pylab_examples/vertical_ticklabels.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/vertical_ticklabels.png" border="0" alt="vertical_ticklabels"/></a> <a href="examples/pylab_examples/vline_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/vline_demo.png" border="0" alt="vline_demo"/></a> Modified: trunk/matplotlib/doc/devel/release_guide.rst =================================================================== --- trunk/matplotlib/doc/devel/release_guide.rst 2008-12-13 19:01:00 UTC (rev 6601) +++ trunk/matplotlib/doc/devel/release_guide.rst 2008-12-14 16:43:20 UTC (rev 6602) @@ -42,7 +42,12 @@ * unpack the sdist and make sure you can build from that directory * Use :file:`setup.cfg` to set the default backends. For windows and - OSX, the default backend should be TkAgg. + OSX, the default backend should be TkAgg. You should also turn on + or off any platform specific build options you need. Importantly, + you also need to make sure that you delete the :file:`build` dir + after any changes to file:`setup.cfg` before rebuilding since cruft + in the :file:`build` dir can get carried along. I will add this to + the devel release notes, * on windows, unix2dos the rc file Modified: trunk/matplotlib/doc/users/mathtext.rst =================================================================== --- trunk/matplotlib/doc/users/mathtext.rst 2008-12-13 19:01:00 UTC (rev 6601) +++ trunk/matplotlib/doc/users/mathtext.rst 2008-12-14 16:43:20 UTC (rev 6602) @@ -299,5 +299,8 @@ .. plot:: pyplots/pyplot_mathtext.py :include-source: +.. plot:: mpl_examples/pylab_examples/mathtext_examples.py + + Modified: trunk/matplotlib/examples/event_handling/path_editor.py =================================================================== --- trunk/matplotlib/examples/event_handling/path_editor.py 2008-12-13 19:01:00 UTC (rev 6601) +++ trunk/matplotlib/examples/event_handling/path_editor.py 2008-12-14 16:43:20 UTC (rev 6602) @@ -1,5 +1,3 @@ -import matplotlib -matplotlib.use('TkAgg') import numpy as np import matplotlib.path as mpath import matplotlib.patches as mpatches Modified: trunk/matplotlib/examples/pylab_examples/loadrec.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/loadrec.py 2008-12-13 19:01:00 UTC (rev 6601) +++ trunk/matplotlib/examples/pylab_examples/loadrec.py 2008-12-14 16:43:20 UTC (rev 6602) @@ -11,6 +11,6 @@ fig.autofmt_xdate() # if you have pyExcelerator installed, you can output excel -#import mpl_toolkits.exceltools as exceltools -#exceltools.rec2excel(a, 'test.xls', colnum=4) +import mpl_toolkits.exceltools as exceltools +exceltools.rec2excel(a, 'test.xls') show() Modified: trunk/matplotlib/examples/pylab_examples/mathtext_examples.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/mathtext_examples.py 2008-12-13 19:01:00 UTC (rev 6601) +++ trunk/matplotlib/examples/pylab_examples/mathtext_examples.py 2008-12-14 16:43:20 UTC (rev 6602) @@ -49,11 +49,11 @@ 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$', + #ur'Generic symbol: $\u23ce$', ] -if sys.maxunicode > 0xffff: - stests.append(ur'$\mathrm{\ue0f2 \U0001D538}$') +#if sys.maxunicode > 0xffff: +# stests.append(ur'$\mathrm{\ue0f2 \U0001D538}$') from pylab import * Added: trunk/matplotlib/release/osx/Makefile =================================================================== --- trunk/matplotlib/release/osx/Makefile (rev 0) +++ trunk/matplotlib/release/osx/Makefile 2008-12-14 16:43:20 UTC (rev 6602) @@ -0,0 +1,69 @@ +SRCDIR=${PWD} +ZLIBVERSION=1.2.3 +PNGVERSION=1.2.33 +FREETYPEVERSION=2.3.7 +MPLVERSION=0.98.5 +MPLSRC=matplotlib-0.98.5 +MACOSX_DEPLOYMENT_TARGET=10.4 + +## You shouldn't need to configure past this point +CFLAGS="-Os -arch ppc -arch i386 -I${SRCDIR}/zlib-1.2.3 -I${SRCDIR}/libpng-1.2.33 -I${SRCDIR}/freetype-2.3.7/include" + +LDFLAGS="-arch ppc -arch i386 -L${SRCDIR}/zlib-1.2.3 -L${SRCDIR}/libpng-1.2.33 -L${SRCDIR}/freetype-2.3.7" + +CFLAGS_DEPS="-arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk" +LDFLAGS_DEPS="-arch i386 -arch ppc -syslibroot,/Developer/SDKs/MacOSX10.4u.sdk" + +clean: + rm -rf zlib-${ZLIBVERSION}.tar.gz libpng-${PNGVERSION}.tar.bz2 \ + freetype-${FREETYPEVERSION}.tar.bz2 bdist_mpkg-0.4.3.tar.gz \ + bdist_mpkg-0.4.3 \ + zlib-${ZLIBVERSION} libpng-${PNGVERSION} freetype-${FREETYPEVERSION} \ + matplotlib-${MPLVERSION} *~ + +fetch_deps: + wget http://www.zlib.net/zlib-${ZLIBVERSION}.tar.gz &&\ + wget http://internap.dl.sourceforge.net/sourceforge/libpng/libpng-${PNGVERSION}.tar.bz2 &&\ + wget http://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPEVERSION}.tar.bz2&&\ + wget http://pypi.python.org/packages/source/b/bdist_mpkg/bdist_mpkg-0.4.3.tar.gz&&\ + tar xvfz bdist_mpkg-0.4.3.tar.gz &&\ + patch -p0 < data/bdist.patch + echo "You need to to install bdist_mpkg-0.4.3 now" + + + +zlib: + rm -rf zlib-${ZLIBVERSION} &&\ + tar xvfz zlib-${ZLIBVERSION}.tar.gz &&\ + cd zlib-${ZLIBVERSION} &&\ + ./configure &&\ + MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} CFLAGS=${CFLAGS_DEPS} LDFLAGS=${LDFLAGS_DEPS} make -j3 + +png: zlib + rm -rf libpng-${PNGVERSION} &&\ + tar xvfj libpng-${PNGVERSION}.tar.bz2 + cd libpng-${PNGVERSION} &&\ + ./configure --disable-dependency-tracking &&\ + MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} CFLAGS=${CFLAGS_DEPS} LDFLAGS=${LDFLAGS_DEPS} make -j3 &&\ + cp .libs/libpng.a . + +freetype: zlib + rm -rf ${FREETYPEVERSION} &&\ + tar xvfj freetype-${FREETYPEVERSION}.tar.bz2 &&\ + cd freetype-${FREETYPEVERSION} &&\ + ./configure &&\ + MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} CFLAGS=${CFLAGS_DEPS} LDFLAGS=${LDFLAGS_DEPS} make -j3 &&\ + cp objs/.libs/libfreetype.a . + +dependencies: + make zlib png freetype + +installers: + tar xvfz matplotlib-${MPLVERSION}.tar.gz && \ + cd ${MPLSRC} && \ + rm -rf build && \ + cp ../data/setup.cfg . &&\ + CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} bdist_mpkg &&\ + CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} python setupegg.py bdist_egg + + Added: trunk/matplotlib/release/osx/README.txt =================================================================== --- trunk/matplotlib/release/osx/README.txt (rev 0) +++ trunk/matplotlib/release/osx/README.txt 2008-12-14 16:43:20 UTC (rev 6602) @@ -0,0 +1,50 @@ +Building binary releases of OS X + +Included here is everything to build a binay package installer for OS +X + +Dir Contents +------------- + +* :file:`bdist_mkpg` - the distutils.extension to build Installer.app + mpkg installers. It is patched from the tarball with + file:`data/bdist.patch` because 0.4.3 is broken on OS X 10.5. + Instructions on how to patch and install are below + +* :file:`data` - some config files and patches needed for the build + +* :file:`*.tar.gz` - the bdist_mkpg, zlib, png, freetype and mpl + tarballs + +* :file:`Makefile` - all the build commands + +How to build +-------------- + +* OPTIONAL: edit :file:`Makefile` so that the *VERSION variables point + to the latest zlib, png, freetype + +* First fetch all the dependencies and patch bdist_mpkg for OSX 10.5. + You can do this automatically in one step with:: + + make fetch_deps + +* install the patched bdist_mpkg, that the fetch_deps step just created:: + + cd bdist_mpkg-0.4.3 + sudo python setup.py install + +* build the dependencies:: + + make dependencies + +* copy over the latest mpl *.tar.gz tarball to this directory, update + the MPLVERSION in the Makefile:: + + cp /path/to/mpl/matplotlib.0.98.5.tar.gz . + +* build the mkpg binary and egg + + make installers + + The mpkg and egg binaries will reside in :file:`matplotlib-VERSION/dist` Added: trunk/matplotlib/release/osx/data/bdist.patch =================================================================== --- trunk/matplotlib/release/osx/data/bdist.patch (rev 0) +++ trunk/matplotlib/release/osx/data/bdist.patch 2008-12-14 16:43:20 UTC (rev 6602) @@ -0,0 +1,25 @@ +diff -rNu bdist_mpkg-0.4.3/bdist_mpkg/tools.py bdist_mpkg-0.4.3.leopard/bdist_mpkg/tools.py +--- bdist_mpkg-0.4.3/bdist_mpkg/tools.py 2006-07-09 00:39:00.000000000 -0400 ++++ bdist_mpkg-0.4.3.leopard/bdist_mpkg/tools.py 2008-08-21 07:43:35.000000000 -0400 +@@ -79,15 +79,12 @@ + yield os.path.join(root, fn) + + def get_gid(name, _cache={}): +- if not _cache: +- for line in os.popen('/usr/bin/nidump group .'): +- fields = line.split(':') +- if len(fields) >= 3: +- _cache[fields[0]] = int(fields[2]) +- try: +- return _cache[name] +- except KeyError: +- raise ValueError('group %s not found' % (name,)) ++ for line in os.popen("dscl . -read /Groups/" + name + " PrimaryGroupID"): ++ fields = [f.strip() for f in line.split(':')] ++ if fields[0] == "PrimaryGroupID": ++ return fields[1] ++ ++ raise ValueError('group %s not found' % (name,)) + + def find_root(path, base='/'): + """ Added: trunk/matplotlib/release/osx/data/setup.cfg =================================================================== --- trunk/matplotlib/release/osx/data/setup.cfg (rev 0) +++ trunk/matplotlib/release/osx/data/setup.cfg 2008-12-14 16:43:20 UTC (rev 6602) @@ -0,0 +1,78 @@ +# 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 +# +# Uncomment to insert lots of diagnostic prints in extension code +#verbose = 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. 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 = True +dateutil = True + +[gui_support] +# Matplotlib supports multiple GUI toolkits, including Cocoa, +# GTK, Fltk, MacOSX, 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. 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 +#macosx = False + +[rc_options] +# User-configurable options +# +# Default backend, one of: Agg, Cairo, CocoaAgg, GTK, GTKAgg, GTKCairo, +# FltkAgg, MacOSX, Pdf, Ps, QtAgg, Qt4Agg, SVG, TkAgg, WX, WXAgg. +# +# The Agg, Ps, Pdf and SVG backends do not require external +# dependencies. Do not choose GTK, GTKAgg, GTKCairo, MacOSX, TkAgg or WXAgg +# if you have disabled the relevent extension modules. Agg will be used +# by default. +# +backend = TkAgg +# +# 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 Added: trunk/matplotlib/release/osx/matplotlib-0.98.5.tar.gz =================================================================== (Binary files differ) Property changes on: trunk/matplotlib/release/osx/matplotlib-0.98.5.tar.gz ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-12-15 14:21:19
|
Revision: 6610 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6610&view=rev Author: mdboom Date: 2008-12-15 14:21:15 +0000 (Mon, 15 Dec 2008) Log Message: ----------- Merged revisions 6589,6608-6609 via svnmerge from https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6589 | mmetz_bn | 2008-12-12 08:58:24 -0500 (Fri, 12 Dec 2008) | 1 line fix warning in hist for numpy 1.2 ........ r6608 | mdboom | 2008-12-15 09:16:27 -0500 (Mon, 15 Dec 2008) | 2 lines Fix gridlines not moving correctly during pan and zoom ........ r6609 | mdboom | 2008-12-15 09:18:03 -0500 (Mon, 15 Dec 2008) | 2 lines Turn off anti-aliasing when auto-snapping. ........ Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/transforms.py trunk/matplotlib/src/_backend_agg.cpp Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6587 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6609 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609 Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-12-15 14:18:03 UTC (rev 6609) +++ trunk/matplotlib/CHANGELOG 2008-12-15 14:21:15 UTC (rev 6610) @@ -1,3 +1,7 @@ +2008-12-15 Fix anti-aliasing when auto-snapping - MGD + +2008-12-15 Fix grid lines not moving correctly during pan and zoom - MGD + 2008-12-12 Preparations to eliminate maskedarray rcParams key: its use will now generate a warning. Similarly, importing the obsolote numerix.npyma will generate a warning. - EF Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609 Modified: trunk/matplotlib/lib/matplotlib/transforms.py =================================================================== --- trunk/matplotlib/lib/matplotlib/transforms.py 2008-12-15 14:18:03 UTC (rev 6609) +++ trunk/matplotlib/lib/matplotlib/transforms.py 2008-12-15 14:21:15 UTC (rev 6610) @@ -120,8 +120,7 @@ root = stack.pop() # Stop at subtrees that have already been invalidated if root._invalid != value or root.pass_through: - value |= root._invalid - root._invalid = value + root._invalid = self.INVALID stack.extend(root._parents.keys()) def set_children(self, *children): Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2008-12-15 14:18:03 UTC (rev 6609) +++ trunk/matplotlib/src/_backend_agg.cpp 2008-12-15 14:21:15 UTC (rev 6610) @@ -355,7 +355,7 @@ } template<class Path> -bool should_snap(const GCAgg& gc, Path& path, const agg::trans_affine& trans) { +bool should_snap(GCAgg& gc, Path& path, const agg::trans_affine& trans) { // If this contains only straight horizontal or vertical lines, it should be // quantized to the nearest pixels double x0, y0, x1, y1; @@ -393,6 +393,7 @@ } path.rewind(0); + gc.isaa = false; return true; case GCAgg::SNAP_FALSE: return false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-12-15 17:58:47
|
Revision: 6613 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6613&view=rev Author: mdboom Date: 2008-12-15 17:58:43 +0000 (Mon, 15 Dec 2008) Log Message: ----------- Make escaped $ work in non-usetex mode Modified Paths: -------------- trunk/matplotlib/doc/users/mathtext.rst trunk/matplotlib/doc/users/text_intro.rst trunk/matplotlib/doc/users/usetex.rst trunk/matplotlib/lib/matplotlib/offsetbox.py trunk/matplotlib/lib/matplotlib/text.py Modified: trunk/matplotlib/doc/users/mathtext.rst =================================================================== --- trunk/matplotlib/doc/users/mathtext.rst 2008-12-15 14:58:02 UTC (rev 6612) +++ trunk/matplotlib/doc/users/mathtext.rst 2008-12-15 17:58:43 UTC (rev 6613) @@ -3,17 +3,19 @@ Writing mathematical expressions ================================ -You can use TeX markup in any matplotlib text string. Note that you -do not need to have TeX installed, since matplotlib ships its own TeX -expression parser, layout engine and fonts. The layout engine is a -fairly direct adaptation of the layout algorithms in Donald Knuth's -TeX, so the quality is quite good (matplotlib also provides a -``usetex`` option for those who do want to call out to TeX to generate -their text (see :ref:`usetex-tutorial`). +You can use a subset TeX markup in any matplotlib text string by +placing it inside a pair of dollar signs ($). -Any text element can use math text. You need to use raw strings -(preceed the quotes with an ``'r'``), and surround the string text -with dollar signs, as in TeX. Regular text and mathtext can be +Note that you do not need to have TeX installed, since matplotlib +ships its own TeX expression parser, layout engine and fonts. The +layout engine is a fairly direct adaptation of the layout algorithms +in Donald Knuth's TeX, so the quality is quite good (matplotlib also +provides a ``usetex`` option for those who do want to call out to TeX +to generate their text (see :ref:`usetex-tutorial`). + +Any text element can use math text. You should use raw strings +(preceed the quotes with an ``'r'``), and surround the math text with +dollar signs ($), as in TeX. Regular text and mathtext can be interleaved within the same string. Mathtext can use the Computer Modern fonts (from (La)TeX), `STIX <http://www.aip.org/stixfonts/>`_ fonts (with are designed to blend well with Times) or a Unicode font @@ -35,6 +37,26 @@ produces ":math:`\alpha > \beta`". +.. note:: + Mathtext should be placed between a pair of dollar signs ($). To + make it easy to display monetary values, e.g. "$100.00", if a + single dollar sign is present in the entire string, it will be + displayed verbatim as a dollar sign. This is a small change from + regular TeX, where the dollar sign in non-math text would have to + be escaped ('\$'). + +.. note:: + While the syntax inside the pair of dollar signs ($) aims to be + TeX-like, the text outside does not. In particular, characters + such as:: + + # $ % & ~ _ ^ \ { } \( \) \[ \] + + have special meaning outside of math mode in TeX. Therefore, these + characters will behave differently depending on the rcParam + ``text.usetex`` flag. See the :ref:`usetex tutorial + <usetex-tutorial>` for more information. + Subscripts and superscripts --------------------------- Modified: trunk/matplotlib/doc/users/text_intro.rst =================================================================== --- trunk/matplotlib/doc/users/text_intro.rst 2008-12-15 14:58:02 UTC (rev 6612) +++ trunk/matplotlib/doc/users/text_intro.rst 2008-12-15 17:58:43 UTC (rev 6613) @@ -18,8 +18,8 @@ weight, text location and color, etc) with sensible defaults set in the rc file. And significantly for those interested in mathematical or scientific figures, matplotlib implements a large number of TeX -math symbols and commands, to support mathematical expressions -anywhere in your figure. +math symbols and commands, to support :ref:`mathematical expressions +<mathtext-tutorial>` anywhere in your figure. Basic text commands Modified: trunk/matplotlib/doc/users/usetex.rst =================================================================== --- trunk/matplotlib/doc/users/usetex.rst 2008-12-15 14:58:02 UTC (rev 6612) +++ trunk/matplotlib/doc/users/usetex.rst 2008-12-15 17:58:43 UTC (rev 6613) @@ -59,6 +59,14 @@ command ``\displaystyle``, as in `tex_demo.py`, will produce the same results. +.. note:: + Certain characters require special escaping in TeX, such as:: + + # $ % & ~ _ ^ \ { } \( \) \[ \] + + Therefore, these characters will behave differently depending on + the rcParam ``text.usetex`` flag. + .. _usetex-unicode: usetex with unicode Modified: trunk/matplotlib/lib/matplotlib/offsetbox.py =================================================================== --- trunk/matplotlib/lib/matplotlib/offsetbox.py 2008-12-15 14:58:02 UTC (rev 6612) +++ trunk/matplotlib/lib/matplotlib/offsetbox.py 2008-12-15 17:58:43 UTC (rev 6613) @@ -548,7 +548,7 @@ def get_extent(self, renderer): - ismath = self._text.is_math_text(self._text._text) + clean_line, ismath = self._text.is_math_text(self._text._text) _, h_, d_ = renderer.get_text_width_height_descent( "lp", self._text._fontproperties, ismath=False) @@ -558,30 +558,30 @@ line = info[0][0] # first line _, hh, dd = renderer.get_text_width_height_descent( - line, self._text._fontproperties, ismath=ismath) + clean_line, self._text._fontproperties, ismath=ismath) self._baseline_transform.clear() if len(info) > 1 and self._multilinebaseline: # multi line d = h-(hh-dd) # the baseline of the first line d_new = 0.5 * h - 0.5 * (h_ - d_) - + self._baseline_transform.translate(0, d - d_new) d = d_new - + else: # single line h_d = max(h_ - d_, h-dd) if self.get_minimumdescent(): ## to have a minimum descent, #i.e., "l" and "p" have same - ## descents. + ## descents. d = max(dd, d_) else: d = dd h = h_d + d - + return w, h, 0., d Modified: trunk/matplotlib/lib/matplotlib/text.py =================================================================== --- trunk/matplotlib/lib/matplotlib/text.py 2008-12-15 14:58:02 UTC (rev 6612) +++ trunk/matplotlib/lib/matplotlib/text.py 2008-12-15 17:58:43 UTC (rev 6613) @@ -248,8 +248,9 @@ baseline = None for i, line in enumerate(lines): + clean_line, ismath = self.is_math_text(line) w, h, d = renderer.get_text_width_height_descent( - line, self._fontproperties, ismath=self.is_math_text(line)) + clean_line, self._fontproperties, ismath=ismath) if baseline is None: baseline = h - d whs[i] = w, h @@ -480,8 +481,9 @@ y = y + posy if renderer.flipy(): y = canvash-y + clean_line, ismath = self.is_math_text(line) - renderer.draw_tex(gc, x, y, line, + renderer.draw_tex(gc, x, y, clean_line, self._fontproperties, angle) return @@ -490,10 +492,11 @@ y = y + posy if renderer.flipy(): y = canvash-y + clean_line, ismath = self.is_math_text(line) - renderer.draw_text(gc, x, y, line, + renderer.draw_text(gc, x, y, clean_line, self._fontproperties, angle, - ismath=self.is_math_text(line)) + ismath=ismath) def get_color(self): "Return the color of the text" @@ -875,16 +878,19 @@ """ Returns True if the given string *s* contains any mathtext. """ - if rcParams['text.usetex']: return 'TeX' - # Did we find an even number of non-escaped dollar signs? # If so, treat is as math text. dollar_count = s.count(r'$') - s.count(r'\$') - if dollar_count > 0 and dollar_count % 2 == 0: - return True + even_dollars = (dollar_count > 0 and dollar_count % 2 == 0) - return False + if rcParams['text.usetex']: + return s, 'TeX' + if even_dollars: + return s, True + else: + return s.replace(r'\$', '$'), False + def set_fontproperties(self, fp): """ Set the font properties that control the text. *fp* must be a This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-12-15 18:04:49
|
Revision: 6615 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6615&view=rev Author: mdboom Date: 2008-12-15 18:04:45 +0000 (Mon, 15 Dec 2008) Log Message: ----------- Merged revisions 6614 via svnmerge from https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6614 | mdboom | 2008-12-15 13:03:34 -0500 (Mon, 15 Dec 2008) | 1 line Backporting 6613: Making $ work in regular text ........ Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6609 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6614 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614 Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-12-15 18:06:55
|
Revision: 6617 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6617&view=rev Author: mdboom Date: 2008-12-15 18:06:52 +0000 (Mon, 15 Dec 2008) Log Message: ----------- Merged revisions 6616 via svnmerge from https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6616 | mdboom | 2008-12-15 13:06:13 -0500 (Mon, 15 Dec 2008) | 1 line Forgot to add to CHANGELOG ........ Modified Paths: -------------- trunk/matplotlib/CHANGELOG Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6614 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6616 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616 Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-12-15 18:06:13 UTC (rev 6616) +++ trunk/matplotlib/CHANGELOG 2008-12-15 18:06:52 UTC (rev 6617) @@ -1,3 +1,6 @@ +2008-12-15 Fix \$ in non-math text with usetex off. Document +differences between usetex on/off - MGD + 2008-12-15 Fix anti-aliasing when auto-snapping - MGD 2008-12-15 Fix grid lines not moving correctly during pan and zoom - MGD Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2008-12-15 19:52:32
|
Revision: 6620 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6620&view=rev Author: jdh2358 Date: 2008-12-15 19:52:29 +0000 (Mon, 15 Dec 2008) Log Message: ----------- Merged revisions 6618 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6618 | jdh2358 | 2008-12-15 11:42:23 -0800 (Mon, 15 Dec 2008) | 1 line removed deprecated files from manifest ........ Modified Paths: -------------- trunk/matplotlib/MANIFEST.in Property Changed: ---------------- trunk/matplotlib/ Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6616 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6619 Modified: trunk/matplotlib/MANIFEST.in =================================================================== --- trunk/matplotlib/MANIFEST.in 2008-12-15 19:46:34 UTC (rev 6619) +++ trunk/matplotlib/MANIFEST.in 2008-12-15 19:52:29 UTC (rev 6620) @@ -1,8 +1,8 @@ -include API_CHANGES CHANGELOG KNOWN_BUGS INSTALL NUMARRAY_ISSUES +include CHANGELOG KNOWN_BUGS INSTALL include INTERACTIVE TODO include Makefile MANIFEST.in MANIFEST include matplotlibrc.template matplotlibrc setup.cfg.template -include __init__.py setupext.py setup.py setupegg.py makeswig.py +include __init__.py setupext.py setup.py setupegg.py include examples/data/* include lib/mpl_toolkits include lib/matplotlib/mpl-data/matplotlib.conf @@ -20,5 +20,4 @@ recursive-include CXX *.cxx *.hxx *.c *.h recursive-include agg24 * 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: <jd...@us...> - 2008-12-15 20:48:38
|
Revision: 6624 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6624&view=rev Author: jdh2358 Date: 2008-12-15 20:48:34 +0000 (Mon, 15 Dec 2008) Log Message: ----------- Merged revisions 6621-6622 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6621 | jdh2358 | 2008-12-15 12:19:01 -0800 (Mon, 15 Dec 2008) | 1 line hack to prevent distutils from linking our files ........ r6622 | jdh2358 | 2008-12-15 12:45:20 -0800 (Mon, 15 Dec 2008) | 1 line hack to prevent distutils from creating links in our sdist ........ Modified Paths: -------------- trunk/matplotlib/MANIFEST.in trunk/matplotlib/setup.py Property Changed: ---------------- trunk/matplotlib/ Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6619 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6623 Modified: trunk/matplotlib/MANIFEST.in =================================================================== --- trunk/matplotlib/MANIFEST.in 2008-12-15 20:46:00 UTC (rev 6623) +++ trunk/matplotlib/MANIFEST.in 2008-12-15 20:48:34 UTC (rev 6624) @@ -1,7 +1,7 @@ include CHANGELOG KNOWN_BUGS INSTALL include INTERACTIVE TODO include Makefile MANIFEST.in MANIFEST -include matplotlibrc.template matplotlibrc setup.cfg.template +include matplotlibrc.template setup.cfg.template include __init__.py setupext.py setup.py setupegg.py include examples/data/* include lib/mpl_toolkits Modified: trunk/matplotlib/setup.py =================================================================== --- trunk/matplotlib/setup.py 2008-12-15 20:46:00 UTC (rev 6623) +++ trunk/matplotlib/setup.py 2008-12-15 20:48:34 UTC (rev 6624) @@ -6,6 +6,11 @@ The matplotlib build options can be modified with a setup.cfg file. See setup.cfg.template for more information. """ +# distutils is breaking our sdists for files in symlinked dirs. +# distutils will copy if os.link is not available, so this is a hack +# to force copying +import os +del os.link # 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 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-12-15 21:04:07
|
Revision: 6626 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6626&view=rev Author: mdboom Date: 2008-12-15 21:04:03 +0000 (Mon, 15 Dec 2008) Log Message: ----------- Merged revisions 6625 via svnmerge from https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6625 | mdboom | 2008-12-15 15:49:22 -0500 (Mon, 15 Dec 2008) | 2 lines Fix docstring formatting. ........ Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6623 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6625 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625 Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625 Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008-12-15 20:49:22 UTC (rev 6625) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008-12-15 21:04:03 UTC (rev 6626) @@ -3182,7 +3182,7 @@ Return value is a list of lines that were added. The following format string characters are accepted to control - the line style or marker + the line style or marker: ================ =============================== character description @@ -3216,7 +3216,7 @@ ================ =============================== - The following color abbreviations are supported:: + The following color abbreviations are supported: ========== ======== character color This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2008-12-16 16:19:26
|
Revision: 6630 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6630&view=rev Author: jdh2358 Date: 2008-12-16 16:19:21 +0000 (Tue, 16 Dec 2008) Log Message: ----------- Merged revisions 6627,6629 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6627 | jdh2358 | 2008-12-16 06:44:09 -0800 (Tue, 16 Dec 2008) | 1 line removed mpl_data link ........ r6629 | jdh2358 | 2008-12-16 08:13:07 -0800 (Tue, 16 Dec 2008) | 1 line applied Darren's sphinx patch, cleaned up some docstrings ........ Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/doc/README.txt trunk/matplotlib/doc/api/api_changes.rst trunk/matplotlib/doc/api/font_manager_api.rst trunk/matplotlib/doc/devel/documenting_mpl.rst trunk/matplotlib/doc/make.py trunk/matplotlib/doc/pyplots/plotmap.py trunk/matplotlib/doc/sphinxext/inheritance_diagram.py trunk/matplotlib/doc/sphinxext/mathmpl.py trunk/matplotlib/doc/sphinxext/only_directives.py trunk/matplotlib/doc/users/customizing.rst trunk/matplotlib/doc/users/navigation_toolbar.rst trunk/matplotlib/lib/matplotlib/collections.py trunk/matplotlib/lib/matplotlib/pyplot.py Property Changed: ---------------- trunk/matplotlib/ Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6625 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6629 Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-12-16 16:13:07 UTC (rev 6629) +++ trunk/matplotlib/CHANGELOG 2008-12-16 16:19:21 UTC (rev 6630) @@ -1,3 +1,10 @@ +2008-12-15 Removed mpl_data symlink in docs. On platforms that do not + support symlinks, these become copies, and the font files + are large, so the distro becomes unneccessarily bloaded. + Keeping the mpl_examples dir because relative links are + harder for the plot directive and the *.py files are not so + large. - JDH + 2008-12-15 Fix \$ in non-math text with usetex off. Document differences between usetex on/off - MGD Modified: trunk/matplotlib/doc/README.txt =================================================================== --- trunk/matplotlib/doc/README.txt 2008-12-16 16:13:07 UTC (rev 6629) +++ trunk/matplotlib/doc/README.txt 2008-12-16 16:19:21 UTC (rev 6630) @@ -27,9 +27,6 @@ * sphinxext - Sphinx extensions for the mpl docs -* mpl_data - a symbolic link to the matplotlib data for reference by - sphinx documentation - * mpl_examples - a link to the matplotlib examples in case any documentation wants to literal include them Modified: trunk/matplotlib/doc/api/api_changes.rst =================================================================== --- trunk/matplotlib/doc/api/api_changes.rst 2008-12-16 16:13:07 UTC (rev 6629) +++ trunk/matplotlib/doc/api/api_changes.rst 2008-12-16 16:19:21 UTC (rev 6630) @@ -260,7 +260,7 @@ `Axes.toggle_log_lineary()` has been removed. :mod:`matplotlib.artist` -~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~ ============================================================ ============================================================ Old method New method Modified: trunk/matplotlib/doc/api/font_manager_api.rst =================================================================== --- trunk/matplotlib/doc/api/font_manager_api.rst 2008-12-16 16:13:07 UTC (rev 6629) +++ trunk/matplotlib/doc/api/font_manager_api.rst 2008-12-16 16:19:21 UTC (rev 6630) @@ -11,7 +11,7 @@ :show-inheritance: :mod:`matplotlib.fontconfig_pattern` -==================================== +======================================== .. automodule:: matplotlib.fontconfig_pattern :members: Modified: trunk/matplotlib/doc/devel/documenting_mpl.rst =================================================================== --- trunk/matplotlib/doc/devel/documenting_mpl.rst 2008-12-16 16:13:07 UTC (rev 6629) +++ trunk/matplotlib/doc/devel/documenting_mpl.rst 2008-12-16 16:19:21 UTC (rev 6630) @@ -271,26 +271,41 @@ ========================== In the documentation, you may want to include to a document in the -matplotlib src, e.g. a license file, an image file from `mpl-data`, or an -example. When you include these files, include them using a symbolic -link from the documentation parent directory. This way, if we -relocate the mpl documentation directory, all of the internal pointers -to files will not have to change, just the top level symlinks. For -example, In the top level doc directory we have symlinks pointing to -the mpl `examples` and `mpl-data`:: +matplotlib src, e.g. a license file or an image file from `mpl-data`, +refer to it via a relative path from the document where the rst file +resides, eg, in :file:`users/navigation_toolbar.rst`, we refer to the +image icons with:: - home:~/mpl/doc2> ls -l mpl_* - mpl_data -> ../lib/matplotlib/mpl-data - mpl_examples -> ../examples + .. image:: ../../lib/matplotlib/mpl-data/images/subplots.png - In the `users` subdirectory, if I want to refer to a file in the mpl-data directory, I use the symlink directory. For example, from `customizing.rst`:: - .. literalinclude:: ../mpl_data/matplotlibrc + .. literalinclude:: ../../lib/matplotlib/mpl-data/matplotlibrc +On exception to this is when referring to the examples dir. Relative +paths are extremely confusing in the sphinx plot extensions, so +without getting into the dirty details, it is easier to simply include +a symlink to the files at the top doc level directory. This way, API +documents like :meth:`matplotlib.pyplot.plot` can refer to the +examples in a known location. +In the top level doc directory we have symlinks pointing to +the mpl `examples`:: + + home:~/mpl/doc> ls -l mpl_* + mpl_examples -> ../examples + +So we can include plots from the examples dir using the symlink:: + + .. plot:: mpl_examples/pylab_examples/simple_plot.py + + +We used to use a symlink for :file:`mpl-data` too, but the distro +becomes very large on platforms that do not support links (eg the font +files are duplicated and large) + .. _internal-section-refs: Internal section references Modified: trunk/matplotlib/doc/make.py =================================================================== --- trunk/matplotlib/doc/make.py 2008-12-16 16:13:07 UTC (rev 6629) +++ trunk/matplotlib/doc/make.py 2008-12-16 16:19:21 UTC (rev 6630) @@ -41,7 +41,7 @@ check_build() if not os.path.exists('examples/index.rst'): examples() - shutil.copy('mpl_data/matplotlibrc', '_static/matplotlibrc') + shutil.copy('../lib/matplotlib/mpl-data/matplotlibrc', '_static/matplotlibrc') #figs() if os.system('sphinx-build -b html -d build/doctrees . build/html'): raise SystemExit("Building HTML failed.") Modified: trunk/matplotlib/doc/pyplots/plotmap.py =================================================================== --- trunk/matplotlib/doc/pyplots/plotmap.py 2008-12-16 16:13:07 UTC (rev 6629) +++ trunk/matplotlib/doc/pyplots/plotmap.py 2008-12-16 16:19:21 UTC (rev 6630) @@ -11,7 +11,7 @@ # read in topo data (on a regular lat/lon grid) # longitudes go from 20 to 380. # you can get this data from matplolib svn matplotlib/htdocs/screenshots/data/ -datadir = '/home/jdhunter/python/svn/matplotlib/htdocs/screenshots/data/' +datadir = '/home/jdhunter/python/svn/matplotlib/trunk/htdocs/screenshots/data/' if not os.path.exists(datadir): raise SystemExit('You need to download the data with svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/htdocs/screenshots/data/" and set the datadir variable in %s'%__file__) Modified: trunk/matplotlib/doc/sphinxext/inheritance_diagram.py =================================================================== --- trunk/matplotlib/doc/sphinxext/inheritance_diagram.py 2008-12-16 16:13:07 UTC (rev 6629) +++ trunk/matplotlib/doc/sphinxext/inheritance_diagram.py 2008-12-16 16:19:21 UTC (rev 6630) @@ -39,8 +39,6 @@ from md5 import md5 from docutils.nodes import Body, Element -from docutils.writers.html4css1 import HTMLTranslator -from sphinx.latexwriter import LaTeXTranslator from docutils.parsers.rst import directives from sphinx.roles import xfileref_role @@ -409,12 +407,9 @@ inheritance_diagram_directive) def setup(app): - app.add_node(inheritance_diagram) - - HTMLTranslator.visit_inheritance_diagram = \ - visit_inheritance_diagram(html_output_graph) - HTMLTranslator.depart_inheritance_diagram = do_nothing - - LaTeXTranslator.visit_inheritance_diagram = \ - visit_inheritance_diagram(latex_output_graph) - LaTeXTranslator.depart_inheritance_diagram = do_nothing + app.add_node(inheritance_diagram, + html=(visit_inheritance_diagram(html_output_graph), + do_nothing)) + app.add_node(inheritance_diagram, + latex=(visit_inheritance_diagram(latex_output_graph), + do_nothing)) Modified: trunk/matplotlib/doc/sphinxext/mathmpl.py =================================================================== --- trunk/matplotlib/doc/sphinxext/mathmpl.py 2008-12-16 16:13:07 UTC (rev 6629) +++ trunk/matplotlib/doc/sphinxext/mathmpl.py 2008-12-16 16:19:21 UTC (rev 6630) @@ -6,8 +6,6 @@ from docutils import nodes from docutils.parsers.rst import directives -from docutils.writers.html4css1 import HTMLTranslator -from sphinx.latexwriter import LaTeXTranslator import warnings # Define LaTeX math node: @@ -69,8 +67,6 @@ self.body.append(latex2html(node, source)) def depart_latex_math_html(self, node): pass - HTMLTranslator.visit_latex_math = visit_latex_math_html - HTMLTranslator.depart_latex_math = depart_latex_math_html # Add visit/depart methods to LaTeX-Translator: def visit_latex_math_latex(self, node): @@ -83,9 +79,14 @@ '\\end{equation}']) def depart_latex_math_latex(self, node): pass - LaTeXTranslator.visit_latex_math = visit_latex_math_latex - LaTeXTranslator.depart_latex_math = depart_latex_math_latex + app.add_node(latex_math, html=(visit_latex_math_html, + depart_latex_math_html)) + app.add_node(latex_math, latex=(visit_latex_math_latex, + depart_latex_math_latex)) + app.add_role('math', math_role) + + from matplotlib import rcParams from matplotlib.mathtext import MathTextParser rcParams['mathtext.fontset'] = 'cm' Modified: trunk/matplotlib/doc/sphinxext/only_directives.py =================================================================== --- trunk/matplotlib/doc/sphinxext/only_directives.py 2008-12-16 16:13:07 UTC (rev 6629) +++ trunk/matplotlib/doc/sphinxext/only_directives.py 2008-12-16 16:19:21 UTC (rev 6630) @@ -4,8 +4,6 @@ # from docutils.nodes import Body, Element -from docutils.writers.html4css1 import HTMLTranslator -from sphinx.latexwriter import LaTeXTranslator from docutils.parsers.rst import directives class html_only(Body, Element): @@ -63,9 +61,6 @@ directives.register_directive('latexonly', LatexOnlyDirective) def setup(app): - app.add_node(html_only) - app.add_node(latex_only) - # Add visit/depart methods to HTML-Translator: def visit_perform(self, node): pass @@ -76,12 +71,7 @@ def depart_ignore(self, node): node.children = [] - HTMLTranslator.visit_html_only = visit_perform - HTMLTranslator.depart_html_only = depart_perform - HTMLTranslator.visit_latex_only = visit_ignore - HTMLTranslator.depart_latex_only = depart_ignore - - LaTeXTranslator.visit_html_only = visit_ignore - LaTeXTranslator.depart_html_only = depart_ignore - LaTeXTranslator.visit_latex_only = visit_perform - LaTeXTranslator.depart_latex_only = depart_perform + app.add_node(html_only, html=(visit_perform, depart_perform)) + app.add_node(html_only, latex=(visit_ignore, depart_ignore)) + app.add_node(latex_only, latex=(visit_perform, depart_perform)) + app.add_node(latex_only, html=(visit_ignore, depart_ignore)) Modified: trunk/matplotlib/doc/users/customizing.rst =================================================================== --- trunk/matplotlib/doc/users/customizing.rst 2008-12-16 16:13:07 UTC (rev 6629) +++ trunk/matplotlib/doc/users/customizing.rst 2008-12-16 16:19:21 UTC (rev 6630) @@ -67,4 +67,4 @@ `(download) <../_static/matplotlibrc>`__ -.. literalinclude:: ../mpl_data/matplotlibrc +.. literalinclude:: ../../lib/matplotlib/mpl-data/matplotlibrc Modified: trunk/matplotlib/doc/users/navigation_toolbar.rst =================================================================== --- trunk/matplotlib/doc/users/navigation_toolbar.rst 2008-12-16 16:13:07 UTC (rev 6629) +++ trunk/matplotlib/doc/users/navigation_toolbar.rst 2008-12-16 16:19:21 UTC (rev 6630) @@ -9,11 +9,11 @@ to navigate through the data set. Here is a description of each of the buttons at the bottom of the toolbar -.. image:: ../mpl_data/images/home.png +.. image:: ../../lib/matplotlib/mpl-data/images/home.png -.. image:: ../mpl_data/images/back.png +.. image:: ../../lib/matplotlib/mpl-data/images/back.png -.. image:: ../mpl_data/images/forward.png +.. image:: ../../lib/matplotlib/mpl-data/images/forward.png The ``Forward`` and ``Back`` buttons These are akin to the web browser forward and back buttons. They @@ -26,7 +26,7 @@ ``Back``, think web browser where data views are web pages. Use the pan and zoom to rectangle to define new views. -.. image:: ../mpl_data/images/move.png +.. image:: ../../lib/matplotlib/mpl-data/images/move.png The ``Pan/Zoom`` button This button has two modes: pan and zoom. Click the toolbar button @@ -50,7 +50,7 @@ mouse button. The radius scale can be zoomed in and out using the right mouse button. -.. image:: ../mpl_data/images/zoom_to_rect.png +.. image:: ../../lib/matplotlib/mpl-data/images/zoom_to_rect.png The ``Zoom-to-rectangle`` button Click this toolbar button to activate this mode. Put your mouse @@ -61,14 +61,14 @@ with the right button, which will place your entire axes in the region defined by the zoom out rectangle. -.. image:: ../mpl_data/images/subplots.png +.. image:: ../../lib/matplotlib/mpl-data/images/subplots.png The ``Subplot-configuration`` button Use this tool to configure the parameters of the subplot: the left, right, top, bottom, space between the rows and space between the columns. -.. image:: ../mpl_data/images/filesave.png +.. image:: ../../lib/matplotlib/mpl-data/images/filesave.png The ``Save`` button Click this button to launch a file save dialog. You can save @@ -84,14 +84,14 @@ ================================== ============================================== Home/Reset **h** or **r** or **home** Back **c** or **left arrow** or **backspace** -Forward **v** or **right arrow** -Pan/Zoom **p** -Zoom-to-rect **o** -Save **s** +Forward **v** or **right arrow** +Pan/Zoom **p** +Zoom-to-rect **o** +Save **s** Toggle fullscreen **f** Constrain pan/zoom to x axis hold **x** Constrain pan/zoom to y axis hold **y** -Preserve aspect ratio hold **CONTROL** +Preserve aspect ratio hold **CONTROL** Toggle grid **g** Toggle y axis scale (log/linear) **l** ================================== ============================================== Modified: trunk/matplotlib/lib/matplotlib/collections.py =================================================================== --- trunk/matplotlib/lib/matplotlib/collections.py 2008-12-16 16:13:07 UTC (rev 6629) +++ trunk/matplotlib/lib/matplotlib/collections.py 2008-12-16 16:19:21 UTC (rev 6630) @@ -720,7 +720,7 @@ over the regions in *x* where *where* is True. The bars range on the y-axis from *ymin* to *ymax* - A :class:`BrokenBarHCollection` is returned. kwargs are + A :class:`BrokenBarHCollection` is returned. *kwargs* are passed on to the collection. """ xranges = [] Modified: trunk/matplotlib/lib/matplotlib/pyplot.py =================================================================== --- trunk/matplotlib/lib/matplotlib/pyplot.py 2008-12-16 16:13:07 UTC (rev 6629) +++ trunk/matplotlib/lib/matplotlib/pyplot.py 2008-12-16 16:19:21 UTC (rev 6630) @@ -604,7 +604,7 @@ *axisbg*: The background color of the subplot, which can be any valid - color specifier. See :module:`matplotlib.colors` for more + color specifier. See :mod:`matplotlib.colors` for more information. *polar*: @@ -1149,62 +1149,62 @@ """ Plotting commands - ============== ================================================= - Command Description - ============== ================================================= - axes Create a new axes - axis Set or return the current axis limits - bar make a bar chart - boxplot make a box and whiskers chart - cla clear current axes - clabel label a contour plot - clf clear a figure window - close close a figure window - colorbar add a colorbar to the current figure - cohere make a plot of coherence - contour make a contour plot - contourf make a filled contour plot - csd make a plot of cross spectral density - draw force a redraw of the current figure - errorbar make an errorbar graph - figlegend add a legend to the figure - figimage add an image to the figure, w/o resampling - figtext add text in figure coords - figure create or change active figure - fill make filled polygons - fill_between make filled polygons - gca return the current axes - gcf return the current figure - gci get the current image, or None - getp get a handle graphics property - hist make a histogram - hold set the hold state on current axes - legend add a legend to the axes - loglog a log log plot - imread load image file into array - imshow plot image data - matshow display a matrix in a new figure preserving aspect - pcolor make a pseudocolor plot - plot make a line plot - plotfile plot data from a flat file - psd make a plot of power spectral density - quiver make a direction field (arrows) plot - rc control the default params - savefig save the current figure - scatter make a scatter plot - setp set a handle graphics property - semilogx log x axis - semilogy log y axis - show show the figures - specgram a spectrogram plot - stem make a stem plot - subplot make a subplot (numrows, numcols, axesnum) - table add a table to the axes - text add some text at location x,y to the current axes - title add a title to the current axes - xlabel add an xlabel to the current axes - ylabel add a ylabel to the current axes - ============== ================================================= + ============ ================================================= + Command Description + ========= ================================================= + axes Create a new axes + axis Set or return the current axis limits + bar make a bar chart + boxplot make a box and whiskers chart + cla clear current axes + clabel label a contour plot + clf clear a figure window + close close a figure window + colorbar add a colorbar to the current figure + cohere make a plot of coherence + contour make a contour plot + contourf make a filled contour plot + csd make a plot of cross spectral density + draw force a redraw of the current figure + errorbar make an errorbar graph + figlegend add a legend to the figure + figimage add an image to the figure, w/o resampling + figtext add text in figure coords + figure create or change active figure + fill make filled polygons + fill_between make filled polygons + gca return the current axes + gcf return the current figure + gci get the current image, or None + getp get a handle graphics property + hist make a histogram + hold set the hold state on current axes + legend add a legend to the axes + loglog a log log plot + imread load image file into array + imshow plot image data + matshow display a matrix in a new figure preserving aspect + pcolor make a pseudocolor plot + plot make a line plot + plotfile plot data from a flat file + psd make a plot of power spectral density + quiver make a direction field (arrows) plot + rc control the default params + savefig save the current figure + scatter make a scatter plot + setp set a handle graphics property + semilogx log x axis + semilogy log y axis + show show the figures + specgram a spectrogram plot + stem make a stem plot + subplot make a subplot (numrows, numcols, axesnum) + table add a table to the axes + text add some text at location x,y to the current axes + title add a title to the current axes + xlabel add an xlabel to the current axes + ylabel add a ylabel to the current axes + ============ ================================================= The following commands will set the default colormap accordingly: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2008-12-16 16:54:15
|
Revision: 6631 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6631&view=rev Author: jdh2358 Date: 2008-12-16 16:54:10 +0000 (Tue, 16 Dec 2008) Log Message: ----------- added markevery property to Line2D Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/doc/users/pyplot_tutorial.rst trunk/matplotlib/lib/matplotlib/lines.py trunk/matplotlib/unit/nose_tests.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-12-16 16:19:21 UTC (rev 6630) +++ trunk/matplotlib/CHANGELOG 2008-12-16 16:54:10 UTC (rev 6631) @@ -1,3 +1,6 @@ +2008-12-16 Added markevery property to Line2D to support subsampling + of markers - JDH + 2008-12-15 Removed mpl_data symlink in docs. On platforms that do not support symlinks, these become copies, and the font files are large, so the distro becomes unneccessarily bloaded. Modified: trunk/matplotlib/doc/users/pyplot_tutorial.rst =================================================================== --- trunk/matplotlib/doc/users/pyplot_tutorial.rst 2008-12-16 16:19:21 UTC (rev 6630) +++ trunk/matplotlib/doc/users/pyplot_tutorial.rst 2008-12-16 16:54:10 UTC (rev 6631) @@ -117,6 +117,7 @@ markeredgewidth or mew float value in points markerfacecolor or mfc any matplotlib color markersize or ms float +markevery None | integer | (startind, stride) picker used in interactive line selection pickradius the line pick selection radius solid_capstyle ['butt' | 'round' | 'projecting'] Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2008-12-16 16:19:21 UTC (rev 6630) +++ trunk/matplotlib/lib/matplotlib/lines.py 2008-12-16 16:54:10 UTC (rev 6631) @@ -177,6 +177,7 @@ solid_joinstyle = None, pickradius = 5, drawstyle = None, + markevery = None, **kwargs ): """ @@ -226,6 +227,7 @@ self.set_linewidth(linewidth) self.set_color(color) self.set_marker(marker) + self.set_markevery(markevery) self.set_antialiased(antialiased) self.set_markersize(markersize) self._dashSeq = None @@ -320,6 +322,32 @@ """ self.pickradius = d + + def set_markevery(self, every): + """ + Set the markevery property to subsample the plot when using + markers. Eg if ``markevery=5``, every 5-th marker will be + plotted. *every* can be + + None + Every point will be plotted + + an integer N + Every N-th marker will be plotted starting with marker 0 + + A length-2 tuple of integers + every=(start, N) will start at point start and plot every N-th marker + + + ACCEPTS: None | integer | (startind, stride) + + """ + self._markevery = every + + def get_markevery(self): + 'return the markevery setting' + return self._markevery + def set_picker(self,p): """Sets the event picker details for the line. @@ -472,6 +500,19 @@ funcname = self._markers.get(self._marker, '_draw_nothing') if funcname != '_draw_nothing': tpath, affine = self._transformed_path.get_transformed_points_and_affine() + + # subsample the markers if markevery is not None + markevery = self.get_markevery() + if markevery is not None: + if iterable(markevery): + startind, stride = markevery + else: + startind, stride = 0, markevery + if tpath.codes is not None: + tpath.codes = tpath.codes[startind::stride] + tpath.vertices = tpath.vertices[startind::stride] + + markerFunc = getattr(self, funcname) markerFunc(renderer, gc, tpath, affine.frozen()) Modified: trunk/matplotlib/unit/nose_tests.py =================================================================== --- trunk/matplotlib/unit/nose_tests.py 2008-12-16 16:19:21 UTC (rev 6630) +++ trunk/matplotlib/unit/nose_tests.py 2008-12-16 16:54:10 UTC (rev 6631) @@ -1,3 +1,5 @@ +import numpy as np + import nose, nose.tools as nt import numpy.testing as nptest @@ -3,5 +5,4 @@ import matplotlib matplotlib.use('Agg') -import numpy as np import matplotlib.pyplot as plt import matplotlib.axes as maxes @@ -11,7 +12,32 @@ fig = plt.figure() ax = maxes.Subplot(fig, 1, 1, 1) fig.add_subplot(ax) + plt.close(fig) +def test_markevery(): + x, y = np.random.rand(2, 100) + + # check marker only plot + fig = plt.figure() + ax = fig.add_subplot(111) + ax.plot(x, y, 'o') + ax.plot(x, y, 'd', markevery=None) + ax.plot(x, y, 's', markevery=10) + ax.plot(x, y, '+', markevery=(5, 20)) + fig.canvas.draw() + plt.close(fig) + + # check line/marker combos + fig = plt.figure() + ax = fig.add_subplot(111) + ax.plot(x, y, '-o') + ax.plot(x, y, '-d', markevery=None) + ax.plot(x, y, '-s', markevery=10) + ax.plot(x, y, '-+', markevery=(5, 20)) + fig.canvas.draw() + plt.close(fig) + if __name__=='__main__': nose.runmodule(argv=['-s','--with-doctest'], exit=False) - pass + + plt.show() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2008-12-16 19:01:55
|
Revision: 6634 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6634&view=rev Author: jdh2358 Date: 2008-12-16 19:01:45 +0000 (Tue, 16 Dec 2008) Log Message: ----------- Merged revisions 6633 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6633 | jdh2358 | 2008-12-16 11:00:38 -0800 (Tue, 16 Dec 2008) | 1 line fixed os.link problem for win32 ........ Modified Paths: -------------- trunk/matplotlib/setup.py Property Changed: ---------------- trunk/matplotlib/ Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6629 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6633 Modified: trunk/matplotlib/setup.py =================================================================== --- trunk/matplotlib/setup.py 2008-12-16 19:00:38 UTC (rev 6633) +++ trunk/matplotlib/setup.py 2008-12-16 19:01:45 UTC (rev 6634) @@ -10,7 +10,10 @@ # distutils will copy if os.link is not available, so this is a hack # to force copying import os -del os.link +try: + del os.link +except AttributeError: + pass # 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 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lee...@us...> - 2008-12-16 19:09:35
|
Revision: 6636 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6636&view=rev Author: leejjoon Date: 2008-12-16 19:09:30 +0000 (Tue, 16 Dec 2008) Log Message: ----------- ........ r6635 | leejjoon | 2008-12-16 14:02:39 -0500 (Tue, 16 Dec 2008) | 2 lines fixed dpi-dependent behavior of legend and text fancybox. ........ Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/legend.py trunk/matplotlib/lib/matplotlib/text.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-12-16 19:02:39 UTC (rev 6635) +++ trunk/matplotlib/CHANGELOG 2008-12-16 19:09:30 UTC (rev 6636) @@ -1,3 +1,6 @@ +2008-12-16 Fixed dpi-dependent behavior of Legend and fancybox in Text. + -JJL + 2008-12-16 Added markevery property to Line2D to support subsampling of markers - JDH Modified: trunk/matplotlib/lib/matplotlib/legend.py =================================================================== --- trunk/matplotlib/lib/matplotlib/legend.py 2008-12-16 19:02:39 UTC (rev 6635) +++ trunk/matplotlib/lib/matplotlib/legend.py 2008-12-16 19:09:30 UTC (rev 6636) @@ -207,6 +207,11 @@ reps = int(self.numpoints / len(self._scatteryoffsets)) + 1 self._scatteryoffsets = np.tile(self._scatteryoffsets, reps)[:self.scatterpoints] + # handles & labels (which can be iterators) need to be + # explicitly converted to list. + self._handles_labels = list(handles), list(labels) + + # _legend_box is an OffsetBox instance that contains all # legend items and will be initialized from _init_legend_box() # method. @@ -273,9 +278,9 @@ self._drawFrame = True - # populate the legend_box with legend items. - self._init_legend_box(handles, labels) - self._legend_box.set_figure(self.figure) + # init with null renderer + #self._init_legend_box(handles, labels, None) + #self._legend_box.set_figure(self.figure) def _set_artist_props(self, a): @@ -294,7 +299,7 @@ ox, oy = self._find_best_position(width, height) return ox+xdescent, oy+ydescent - def _findoffset_loc(self, width, height, xdescent, ydescent): + def _findoffset_loc(self, width, height, xdescent, ydescent, renderer): "Heper function to locate the legend using the location code" if iterable(self._loc) and len(self._loc)==2: @@ -304,7 +309,7 @@ x, y = bbox.x0 + bbox.width * fx, bbox.y0 + bbox.height * fy else: bbox = Bbox.from_bounds(0, 0, width, height) - x, y = self._get_anchored_bbox(self._loc, bbox, self.parent.bbox) + x, y = self._get_anchored_bbox(self._loc, bbox, self.parent.bbox, renderer) return x+xdescent, y+ydescent @@ -312,6 +317,11 @@ "Draw everything that belongs to the legend" if not self.get_visible(): return + # populate the legend_box with legend items. + handles, labels = self._handles_labels + self._init_legend_box(handles, labels, renderer) + self._legend_box.set_figure(self.figure) + renderer.open_group('legend') # find_offset function will be provided to _legend_box and @@ -320,12 +330,16 @@ if self._loc == 0: self._legend_box.set_offset(self._findoffset_best) else: - self._legend_box.set_offset(self._findoffset_loc) + def _findoffset_loc(width, height, xdescent, ydescent): + return self._findoffset_loc(width, height, xdescent, ydescent, renderer) + self._legend_box.set_offset(_findoffset_loc) + fontsize = renderer.points_to_pixels(self.fontsize) + # if mode == fill, set the width of the legend_box to the # width of the paret (minus pads) if self._mode in ["expand"]: - pad = 2*(self.borderaxespad+self.borderpad)*self.fontsize + pad = 2*(self.borderaxespad+self.borderpad)*fontsize self._legend_box.set_width(self.parent.bbox.width-pad) if self._drawFrame: @@ -334,6 +348,8 @@ self.legendPatch.set_bounds(bbox.x0, bbox.y0, bbox.width, bbox.height) + self.legendPatch.set_mutation_scale(fontsize) + if self.shadow: shadow = Shadow(self.legendPatch, 2, -2) shadow.draw(renderer) @@ -353,7 +369,7 @@ return self.fontsize/72.0*self.figure.dpi - def _init_legend_box(self, handles, labels): + def _init_legend_box(self, handles, labels, renderer=None): """ Initiallize the legend_box. The legend_box is an instance of the OffsetBox, which is packed with legend handles and @@ -361,6 +377,11 @@ drawing time. """ + if renderer is None: + fontsize = self.fontsize + else: + fontsize = renderer.points_to_pixels(self.fontsize) + # legend_box is a HPacker, horizontally packed with # columns. Each column is a VPacker, vertically packed with # legend items. Each legend item is HPacker packed with @@ -411,13 +432,13 @@ if npoints > 1: # we put some pad here to compensate the size of the # marker - xdata = np.linspace(0.3*self.fontsize, - (self.handlelength-0.3)*self.fontsize, + xdata = np.linspace(0.3*fontsize, + (self.handlelength-0.3)*fontsize, npoints) xdata_marker = xdata elif npoints == 1: - xdata = np.linspace(0, self.handlelength*self.fontsize, 2) - xdata_marker = [0.5*self.handlelength*self.fontsize] + xdata = np.linspace(0, self.handlelength*fontsize, 2) + xdata_marker = [0.5*self.handlelength*fontsize] if isinstance(handle, Line2D): ydata = ((height-descent)/2.)*np.ones(xdata.shape, float) @@ -445,7 +466,7 @@ elif isinstance(handle, Patch): p = Rectangle(xy=(0., 0.), - width = self.handlelength*self.fontsize, + width = self.handlelength*fontsize, height=(height-descent), ) p.update_from(handle) @@ -499,7 +520,7 @@ else: handle_list.append(None) - handlebox = DrawingArea(width=self.handlelength*self.fontsize, + handlebox = DrawingArea(width=self.handlelength*fontsize, height=height, xdescent=0., ydescent=descent) @@ -527,7 +548,7 @@ for i0, di in largecol+smallcol: # pack handleBox and labelBox into itemBox itemBoxes = [HPacker(pad=0, - sep=self.handletextpad*self.fontsize, + sep=self.handletextpad*fontsize, children=[h, t], align="baseline") for h, t in handle_label[i0:i0+di]] # minimumdescent=False for the text of the last row of the column @@ -535,7 +556,7 @@ # pack columnBox columnbox.append(VPacker(pad=0, - sep=self.labelspacing*self.fontsize, + sep=self.labelspacing*fontsize, align="baseline", children=itemBoxes)) @@ -544,9 +565,9 @@ else: mode = "fixed" - sep = self.columnspacing*self.fontsize + sep = self.columnspacing*fontsize - self._legend_box = HPacker(pad=self.borderpad*self.fontsize, + self._legend_box = HPacker(pad=self.borderpad*fontsize, sep=sep, align="baseline", mode=mode, children=columnbox) @@ -627,7 +648,7 @@ return self.legendPatch.get_window_extent() - def _get_anchored_bbox(self, loc, bbox, parentbbox): + def _get_anchored_bbox(self, loc, bbox, parentbbox, renderer): """ Place the *bbox* inside the *parentbbox* according to a given location code. Return the (x,y) coordinate of the bbox. @@ -655,8 +676,9 @@ C:"C"} c = anchor_coefs[loc] - - container = parentbbox.padded(-(self.borderaxespad) * self.fontsize) + + fontsize = renderer.points_to_pixels(self.fontsize) + container = parentbbox.padded(-(self.borderaxespad) * fontsize) anchored_box = bbox.anchored(c, container=container) return anchored_box.x0, anchored_box.y0 Modified: trunk/matplotlib/lib/matplotlib/text.py =================================================================== --- trunk/matplotlib/lib/matplotlib/text.py 2008-12-16 19:02:39 UTC (rev 6635) +++ trunk/matplotlib/lib/matplotlib/text.py 2008-12-16 19:09:30 UTC (rev 6636) @@ -395,7 +395,8 @@ tr = mtransforms.Affine2D().rotate(theta) tr = tr.translate(posx+x_box, posy+y_box) self._bbox_patch.set_transform(tr) - self._bbox_patch.set_mutation_scale(self.get_size()) + fontsize = renderer.points_to_pixels(self.get_size()) + self._bbox_patch.set_mutation_scale(fontsize) #self._bbox_patch.draw(renderer) else: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2008-12-16 20:03:12
|
Revision: 6638 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6638&view=rev Author: jdh2358 Date: 2008-12-16 20:03:07 +0000 (Tue, 16 Dec 2008) Log Message: ----------- fixed merge between 98 branch and trunk Modified Paths: -------------- trunk/matplotlib/CHANGELOG Property Changed: ---------------- trunk/matplotlib/ Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6633 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6637 Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-12-16 19:34:32 UTC (rev 6637) +++ trunk/matplotlib/CHANGELOG 2008-12-16 20:03:07 UTC (rev 6638) @@ -1,9 +1,8 @@ + 2008-12-16 Fixed dpi-dependent behavior of Legend and fancybox in Text. - -JJL 2008-12-16 Added markevery property to Line2D to support subsampling of markers - JDH - 2008-12-15 Removed mpl_data symlink in docs. On platforms that do not support symlinks, these become copies, and the font files are large, so the distro becomes unneccessarily bloaded. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lee...@us...> - 2008-12-17 00:55:55
|
Revision: 6641 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6641&view=rev Author: leejjoon Date: 2008-12-17 00:55:52 +0000 (Wed, 17 Dec 2008) Log Message: ----------- Merged revisions 6640 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6640 | leejjoon | 2008-12-16 19:50:56 -0500 (Tue, 16 Dec 2008) | 1 line Another attempt to fix dpi-dependent behavior of Legend ........ Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/legend.py trunk/matplotlib/lib/matplotlib/offsetbox.py Property Changed: ---------------- trunk/matplotlib/ Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6637 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6640 Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-12-17 00:50:56 UTC (rev 6640) +++ trunk/matplotlib/CHANGELOG 2008-12-17 00:55:52 UTC (rev 6641) @@ -1,3 +1,4 @@ +2008-12-16 Another attempt to fix dpi-dependent behavior of Legend. -JJL 2008-12-16 Fixed dpi-dependent behavior of Legend and fancybox in Text. Modified: trunk/matplotlib/lib/matplotlib/legend.py =================================================================== --- trunk/matplotlib/lib/matplotlib/legend.py 2008-12-17 00:50:56 UTC (rev 6640) +++ trunk/matplotlib/lib/matplotlib/legend.py 2008-12-17 00:55:52 UTC (rev 6641) @@ -34,7 +34,7 @@ from matplotlib.collections import LineCollection, RegularPolyCollection from matplotlib.transforms import Bbox -from matplotlib.offsetbox import HPacker, VPacker, TextArea, DrawingArea +from matplotlib.offsetbox import HPacker, VPacker, PackerBase, TextArea, DrawingArea class Legend(Artist): @@ -207,11 +207,6 @@ reps = int(self.numpoints / len(self._scatteryoffsets)) + 1 self._scatteryoffsets = np.tile(self._scatteryoffsets, reps)[:self.scatterpoints] - # handles & labels (which can be iterators) need to be - # explicitly converted to list. - self._handles_labels = list(handles), list(labels) - - # _legend_box is an OffsetBox instance that contains all # legend items and will be initialized from _init_legend_box() # method. @@ -277,12 +272,13 @@ self._set_artist_props(self.legendPatch) self._drawFrame = True - + # init with null renderer - #self._init_legend_box(handles, labels, None) - #self._legend_box.set_figure(self.figure) + self._init_legend_box(handles, labels) + self._last_fontsize_points = self.fontsize + def _set_artist_props(self, a): """ set the boilerplate props for artists added to axes @@ -294,9 +290,9 @@ a.set_transform(self.get_transform()) - def _findoffset_best(self, width, height, xdescent, ydescent): + def _findoffset_best(self, width, height, xdescent, ydescent, renderer): "Heper function to locate the legend at its best position" - ox, oy = self._find_best_position(width, height) + ox, oy = self._find_best_position(width, height, renderer) return ox+xdescent, oy+ydescent def _findoffset_loc(self, width, height, xdescent, ydescent, renderer): @@ -317,10 +313,7 @@ "Draw everything that belongs to the legend" if not self.get_visible(): return - # populate the legend_box with legend items. - handles, labels = self._handles_labels - self._init_legend_box(handles, labels, renderer) - self._legend_box.set_figure(self.figure) + self._update_legend_box(renderer) renderer.open_group('legend') @@ -328,12 +321,15 @@ # _legend_box will draw itself at the location of the return # value of the find_offset. if self._loc == 0: - self._legend_box.set_offset(self._findoffset_best) + _findoffset = self._findoffset_best else: - def _findoffset_loc(width, height, xdescent, ydescent): - return self._findoffset_loc(width, height, xdescent, ydescent, renderer) - self._legend_box.set_offset(_findoffset_loc) + _findoffset = self._findoffset_loc + def findoffset(width, height, xdescent, ydescent): + return _findoffset(width, height, xdescent, ydescent, renderer) + + self._legend_box.set_offset(findoffset) + fontsize = renderer.points_to_pixels(self.fontsize) # if mode == fill, set the width of the legend_box to the @@ -361,15 +357,18 @@ renderer.close_group('legend') - def _approx_text_height(self): + def _approx_text_height(self, renderer=None): """ Return the approximate height of the text. This is used to place the legend handle. """ - return self.fontsize/72.0*self.figure.dpi + if renderer is None: + return self.fontsize + else: + return renderer.points_to_pixels(self.fontsize) - def _init_legend_box(self, handles, labels, renderer=None): + def _init_legend_box(self, handles, labels): """ Initiallize the legend_box. The legend_box is an instance of the OffsetBox, which is packed with legend handles and @@ -377,10 +376,7 @@ drawing time. """ - if renderer is None: - fontsize = self.fontsize - else: - fontsize = renderer.points_to_pixels(self.fontsize) + fontsize = self.fontsize # legend_box is a HPacker, horizontally packed with # columns. Each column is a VPacker, vertically packed with @@ -415,10 +411,13 @@ height = self._approx_text_height() * 0.7 descent = 0. - # each handle needs to be drawn inside a box of - # (x, y, w, h) = (0, -descent, width, height). - # And their corrdinates should be given in the display coordinates. + # each handle needs to be drawn inside a box of (x, y, w, h) = + # (0, -descent, width, height). And their corrdinates should + # be given in the display coordinates. + # NOTE : the coordinates will be updated again in + # _update_legend_box() method. + # The transformation of each handle will be automatically set # to self.get_trasnform(). If the artist does not uses its # default trasnform (eg, Collections), you need to @@ -548,8 +547,8 @@ for i0, di in largecol+smallcol: # pack handleBox and labelBox into itemBox itemBoxes = [HPacker(pad=0, - sep=self.handletextpad*fontsize, - children=[h, t], align="baseline") + sep=self.handletextpad*fontsize, + children=[h, t], align="baseline") for h, t in handle_label[i0:i0+di]] # minimumdescent=False for the text of the last row of the column itemBoxes[-1].get_children()[1].set_minimumdescent(False) @@ -572,10 +571,100 @@ mode=mode, children=columnbox) + self._legend_box.set_figure(self.figure) + self.texts = text_list self.legendHandles = handle_list + + + def _update_legend_box(self, renderer): + """ + Update the dimension of the legend_box. This is required + becuase the paddings, the hadle size etc. depends on the dpi + of the renderer. + """ + + # fontsize in points. + fontsize = renderer.points_to_pixels(self.fontsize) + + if self._last_fontsize_points == fontsize: + # no update is needed + return + + # each handle needs to be drawn inside a box of + # (x, y, w, h) = (0, -descent, width, height). + # And their corrdinates should be given in the display coordinates. + + # The approximate height and descent of text. These values are + # only used for plotting the legend handle. + height = self._approx_text_height(renderer) * 0.7 + descent = 0. + + for handle in self.legendHandles: + if isinstance(handle, RegularPolyCollection): + npoints = self.scatterpoints + else: + npoints = self.numpoints + if npoints > 1: + # we put some pad here to compensate the size of the + # marker + xdata = np.linspace(0.3*fontsize, + (self.handlelength-0.3)*fontsize, + npoints) + xdata_marker = xdata + elif npoints == 1: + xdata = np.linspace(0, self.handlelength*fontsize, 2) + xdata_marker = [0.5*self.handlelength*fontsize] + + if isinstance(handle, Line2D): + legline = handle + ydata = ((height-descent)/2.)*np.ones(xdata.shape, float) + legline.set_data(xdata, ydata) + + legline_marker = legline._legmarker + legline_marker.set_data(xdata_marker, ydata[:len(xdata_marker)]) + + elif isinstance(handle, Patch): + p = handle + p.set_bounds(0., 0., + self.handlelength*fontsize, + (height-descent), + ) + + elif isinstance(handle, RegularPolyCollection): + + p = handle + ydata = height*self._scatteryoffsets + p.set_offsets(zip(xdata_marker,ydata)) + + + # correction factor + cor = fontsize / self._last_fontsize_points + + # helper function to iterate over all children + def all_children(parent): + yield parent + for c in parent.get_children(): + for cc in all_children(c): yield cc + + + #now update paddings + for box in all_children(self._legend_box): + if isinstance(box, PackerBase): + box.pad = box.pad * cor + box.sep = box.sep * cor + + elif isinstance(box, DrawingArea): + box.width = self.handlelength*fontsize + box.height = height + box.xdescent = 0. + box.ydescent=descent + + self._last_fontsize_points = fontsize + + def _auto_legend_data(self): """ Returns list of vertices and extents covered by the plot. @@ -683,7 +772,7 @@ return anchored_box.x0, anchored_box.y0 - def _find_best_position(self, width, height, consider=None): + def _find_best_position(self, width, height, renderer, consider=None): """ Determine the best location to place the legend. @@ -696,7 +785,7 @@ verts, bboxes, lines = self._auto_legend_data() bbox = Bbox.from_bounds(0, 0, width, height) - consider = [self._get_anchored_bbox(x, bbox, self.parent.bbox) for x in range(1, len(self.codes))] + consider = [self._get_anchored_bbox(x, bbox, self.parent.bbox, renderer) for x in range(1, len(self.codes))] #tx, ty = self.legendPatch.get_x(), self.legendPatch.get_y() Modified: trunk/matplotlib/lib/matplotlib/offsetbox.py =================================================================== --- trunk/matplotlib/lib/matplotlib/offsetbox.py 2008-12-17 00:50:56 UTC (rev 6640) +++ trunk/matplotlib/lib/matplotlib/offsetbox.py 2008-12-17 00:55:52 UTC (rev 6641) @@ -164,7 +164,7 @@ accepts float """ - self._width = width + self.width = width def set_height(self, height): """ @@ -172,7 +172,7 @@ accepts float """ - self._height = height + self.height = height def get_children(self): """ @@ -215,7 +215,31 @@ bbox_artist(self, renderer, fill=False, props=dict(pad=0.)) -class VPacker(OffsetBox): +class PackerBase(OffsetBox): + def __init__(self, pad=None, sep=None, width=None, height=None, + align=None, mode=None, + children=None): + """ + *pad* : boundary pad + *sep* : spacing between items + *width*, *height* : width and height of the container box. + calculated if None. + *align* : alignment of boxes + *mode* : packing mode + """ + super(PackerBase, self).__init__() + + self.height = height + self.width = width + self.sep = sep + self.pad = pad + self.mode = mode + self.align = align + + self._children = children + + +class VPacker(PackerBase): """ The VPacker has its children packed vertically. It automatically adjust the relative postisions of children in the drawing time. @@ -231,18 +255,12 @@ *align* : alignment of boxes *mode* : packing mode """ - super(VPacker, self).__init__() + super(VPacker, self).__init__(pad, sep, width, height, + align, mode, + children) - self._height = height - self._width = width - self._align = align - self._sep = sep - self._pad = pad - self._mode = mode - - self._children = children - + def get_extent_offsets(self, renderer): """ update offset of childrens and return the extents of the box @@ -254,12 +272,12 @@ wd_list = [(w, xd) for w, h, xd, yd in whd_list] width, xdescent, xoffsets = _get_aligned_offsets(wd_list, - self._width, - self._align) + self.width, + self.align) pack_list = [(h, yd) for w,h,xd,yd in whd_list] - height, yoffsets_ = _get_packed_offsets(pack_list, self._height, - self._sep, self._mode) + height, yoffsets_ = _get_packed_offsets(pack_list, self.height, + self.sep, self.mode) yoffsets = yoffsets_ + [yd for w,h,xd,yd in whd_list] ydescent = height - yoffsets[0] @@ -268,18 +286,17 @@ #w, h, xd, h_yd = whd_list[-1] yoffsets = yoffsets - ydescent - return width + 2*self._pad, height + 2*self._pad, \ - xdescent+self._pad, ydescent+self._pad, \ + return width + 2*self.pad, height + 2*self.pad, \ + xdescent+self.pad, ydescent+self.pad, \ zip(xoffsets, yoffsets) - -class HPacker(OffsetBox): +class HPacker(PackerBase): """ The HPacker has its children packed horizontally. It automatically adjust the relative postisions of children in the drawing time. """ - def __init__(self, pad=None, width=None, height=None, sep=None, + def __init__(self, pad=None, sep=None, width=None, height=None, align="baseline", mode="fixed", children=None): """ @@ -290,19 +307,10 @@ *align* : alignment of boxes *mode* : packing mode """ - super(HPacker, self).__init__() + super(HPacker, self).__init__(pad, sep, width, height, + align, mode, children) - self._height = height - self._width = width - self._align = align - - self._sep = sep - self._pad = pad - self._mode = mode - self._children = children - - def get_extent_offsets(self, renderer): """ update offset of childrens and return the extents of the box @@ -310,30 +318,30 @@ whd_list = [c.get_extent(renderer) for c in self.get_children()] - if self._height is None: + if self.height is None: height_descent = max([h-yd for w,h,xd,yd in whd_list]) ydescent = max([yd for w,h,xd,yd in whd_list]) height = height_descent + ydescent else: - height = self._height - 2*self._pad # width w/o pad + height = self.height - 2*self._pad # width w/o pad hd_list = [(h, yd) for w, h, xd, yd in whd_list] height, ydescent, yoffsets = _get_aligned_offsets(hd_list, - self._height, - self._align) + self.height, + self.align) pack_list = [(w, xd) for w,h,xd,yd in whd_list] - width, xoffsets_ = _get_packed_offsets(pack_list, self._width, - self._sep, self._mode) + width, xoffsets_ = _get_packed_offsets(pack_list, self.width, + self.sep, self.mode) xoffsets = xoffsets_ + [xd for w,h,xd,yd in whd_list] xdescent=whd_list[0][2] xoffsets = xoffsets - xdescent - return width + 2*self._pad, height + 2*self._pad, \ - xdescent + self._pad, ydescent + self._pad, \ + return width + 2*self.pad, height + 2*self.pad, \ + xdescent + self.pad, ydescent + self.pad, \ zip(xoffsets, yoffsets) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lee...@us...> - 2008-12-17 07:32:22
|
Revision: 6642 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6642&view=rev Author: leejjoon Date: 2008-12-17 07:32:18 +0000 (Wed, 17 Dec 2008) Log Message: ----------- added group id in Artist. added two svg filter example Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/artist.py trunk/matplotlib/lib/matplotlib/backend_bases.py trunk/matplotlib/lib/matplotlib/backends/backend_svg.py trunk/matplotlib/lib/matplotlib/lines.py trunk/matplotlib/lib/matplotlib/patches.py trunk/matplotlib/lib/matplotlib/text.py Added Paths: ----------- trunk/matplotlib/examples/misc/svg_filter_line.py trunk/matplotlib/examples/misc/svg_filter_pie.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-12-17 00:55:52 UTC (rev 6641) +++ trunk/matplotlib/CHANGELOG 2008-12-17 07:32:18 UTC (rev 6642) @@ -1,3 +1,6 @@ +2008-12-17 Add group id support in artist. Two examples which + demostrate svg filter are added. -JJL + 2008-12-16 Another attempt to fix dpi-dependent behavior of Legend. -JJL 2008-12-16 Fixed dpi-dependent behavior of Legend and fancybox in Text. Added: trunk/matplotlib/examples/misc/svg_filter_line.py =================================================================== --- trunk/matplotlib/examples/misc/svg_filter_line.py (rev 0) +++ trunk/matplotlib/examples/misc/svg_filter_line.py 2008-12-17 07:32:18 UTC (rev 6642) @@ -0,0 +1,85 @@ +""" +Demonstrate SVG filtering effects which might be used with mpl. + +Note that the filtering effects are only effective if your svg rederer +support it. +""" + +import matplotlib + +matplotlib.use("Svg") + +import matplotlib.pyplot as plt +import matplotlib.transforms as mtransforms + +fig1 = plt.figure() +ax = fig1.add_axes([0.1, 0.1, 0.8, 0.8]) + +# draw lines +l1, = ax.plot([0.1, 0.5, 0.9], [0.1, 0.9, 0.5], "bo-", + mec="b", lw=5, ms=10, label="Line 1") +l2, = ax.plot([0.1, 0.5, 0.9], [0.5, 0.2, 0.7], "rs-", + mec="r", lw=5, ms=10, color="r", label="Line 2") + + +for l in [l1, l2]: + + # draw shadows with same lines with slight offset and gray colors. + + xx = l.get_xdata() + yy = l.get_ydata() + shadow, = ax.plot(xx, yy) + shadow.update_from(l) + + # adjust color + shadow.set_color("0.2") + # adjust zorder of the shadow lines so that it is drawn below the + # original lines + shadow.set_zorder(l.get_zorder()-0.5) + + # offset transform + ot = mtransforms.offset_copy(l.get_transform(), fig1, + x=4.0, y=-6.0, units='points') + + shadow.set_transform(ot) + + # set the id for a later use + shadow.set_gid(l.get_label()+"_shadow") + + +ax.set_xlim(0., 1.) +ax.set_ylim(0., 1.) + +# save the figure as a string in the svg format. +from StringIO import StringIO +f = StringIO() +plt.savefig(f, format="svg") + + +import xml.etree.cElementTree as ET + +# filter definition for a gaussian blur +filter_def = """ + <defs xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'> + <filter id='dropshadow' height='1.2' width='1.2'> + <feGaussianBlur result='blur' stdDeviation='3'/> + </filter> + </defs> +""" + + +# read in the saved svg +tree, xmlid = ET.XMLID(f.getvalue()) + +# insert the filter definition in the svg dom tree. +tree.insert(0, ET.XML(filter_def)) + +for l in [l1, l2]: + # pick up the svg element with given id + shadow = xmlid[l.get_label()+"_shadow"] + # apply shdow filter + shadow.set("filter",'url(#dropshadow)') + +fn = "svg_filter_line.svg" +print "Saving '%s'" % fn +ET.ElementTree(tree).write(fn) Added: trunk/matplotlib/examples/misc/svg_filter_pie.py =================================================================== --- trunk/matplotlib/examples/misc/svg_filter_pie.py (rev 0) +++ trunk/matplotlib/examples/misc/svg_filter_pie.py 2008-12-17 07:32:18 UTC (rev 6642) @@ -0,0 +1,95 @@ +""" +Demonstrate SVG filtering effects which might be used with mpl. +The pie chart drawing code is borrowed from pie_demo.py + +Note that the filtering effects are only effective if your svg rederer +support it. +""" + + +import matplotlib +matplotlib.use("Svg") + +import matplotlib.pyplot as plt +from matplotlib.patches import Shadow + +# make a square figure and axes +fig1 = plt.figure(1, figsize=(6,6)) +ax = fig1.add_axes([0.1, 0.1, 0.8, 0.8]) + +labels = 'Frogs', 'Hogs', 'Dogs', 'Logs' +fracs = [15,30,45, 10] + +explode=(0, 0.05, 0, 0) + +# We want to draw the shadow for each pie but we will not use "shadow" +# option as it does'n save the references to the shadow patches. +pies = ax.pie(fracs, explode=explode, labels=labels, autopct='%1.1f%%') + +for w in pies[0]: + # set the id with the label. + w.set_gid(w.get_label()) + + # we don't want to draw the edge of the pie + w.set_ec("none") + +for w in pies[0]: + # create shadow patch + s = Shadow(w, -0.01, -0.01) + s.set_gid(w.get_gid()+"_shadow") + s.set_zorder(w.get_zorder() - 0.1) + ax.add_patch(s) + + +# save +from StringIO import StringIO +f = StringIO() +plt.savefig(f, format="svg") + +import xml.etree.cElementTree as ET + + +# filter definition for shadow using a gaussian blur +# and lighteneing effect. +# The lightnening filter is copied from http://www.w3.org/TR/SVG/filters.html + +# I tested it with Inkscape and Firefox3. "Gaussian blur" is supported +# in both, but the lightnening effect only in the inkscape. Also note +# that, inkscape's exporting also may not support it. + +filter_def = """ + <defs xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'> + <filter id='dropshadow' height='1.2' width='1.2'> + <feGaussianBlur result='blur' stdDeviation='2'/> + </filter> + + <filter id='MyFilter' filterUnits='objectBoundingBox' x='0' y='0' width='1' height='1'> + <feGaussianBlur in='SourceAlpha' stdDeviation='4%' result='blur'/> + <feOffset in='blur' dx='4%' dy='4%' result='offsetBlur'/> + <feSpecularLighting in='blur' surfaceScale='5' specularConstant='.75' + specularExponent='20' lighting-color='#bbbbbb' result='specOut'> + <fePointLight x='-5000%' y='-10000%' z='20000%'/> + </feSpecularLighting> + <feComposite in='specOut' in2='SourceAlpha' operator='in' result='specOut'/> + <feComposite in='SourceGraphic' in2='specOut' operator='arithmetic' + k1='0' k2='1' k3='1' k4='0'/> + </filter> + </defs> +""" + + +tree, xmlid = ET.XMLID(f.getvalue()) + +# insert the filter definition in the svg dom tree. +tree.insert(0, ET.XML(filter_def)) + +for i, pie_name in enumerate(labels): + pie = xmlid[pie_name] + pie.set("filter", 'url(#MyFilter)') + + shadow = xmlid[pie_name + "_shadow"] + shadow.set("filter",'url(#dropshadow)') + +fn = "svg_filter_pie.svg" +print "Saving '%s'" % fn +ET.ElementTree(tree).write(fn) Modified: trunk/matplotlib/lib/matplotlib/artist.py =================================================================== --- trunk/matplotlib/lib/matplotlib/artist.py 2008-12-17 00:55:52 UTC (rev 6641) +++ trunk/matplotlib/lib/matplotlib/artist.py 2008-12-17 07:32:18 UTC (rev 6642) @@ -52,6 +52,7 @@ self.axes = None self._remove_method = None self._url = None + self._gid = None self.x_isdata = True # False to avoid updating Axes.dataLim with x self.y_isdata = True # with y self._snap = None @@ -330,9 +331,26 @@ def set_url(self, url): """ Sets the url for the artist + + ACCEPTS: a url string """ self._url = url + + def get_gid(self): + """ + Returns the group id + """ + return self._gid + + def set_gid(self, gid): + """ + Sets the (group) id for the artist + + ACCEPTS: an id string + """ + self._gid = gid + def get_snap(self): """ Returns the snap setting which may be: Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backend_bases.py 2008-12-17 00:55:52 UTC (rev 6641) +++ trunk/matplotlib/lib/matplotlib/backend_bases.py 2008-12-17 07:32:18 UTC (rev 6642) @@ -52,10 +52,11 @@ def __init__(self): self._texmanager = None - def open_group(self, s): + def open_group(self, s, gid=None): """ - Open a grouping element with label *s*. Is only currently used by - :mod:`~matplotlib.backends.backend_svg` + Open a grouping element with label *s*. If *gid* is given, use + *gid* as the id of the group. Is only currently used by + :mod:`~matplotlib.backends.backend_svg`. """ pass Modified: trunk/matplotlib/lib/matplotlib/backends/backend_svg.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_svg.py 2008-12-17 00:55:52 UTC (rev 6641) +++ trunk/matplotlib/lib/matplotlib/backends/backend_svg.py 2008-12-17 07:32:18 UTC (rev 6642) @@ -147,9 +147,16 @@ self._clipd[path] = id return id - def open_group(self, s): - self._groupd[s] = self._groupd.get(s,0) + 1 - self._svgwriter.write('<g id="%s%d">\n' % (s, self._groupd[s])) + def open_group(self, s, gid=None): + """ + Open a grouping element with label *s*. If *gid* is given, use + *gid* as the id of the group. + """ + if gid: + self._svgwriter.write('<g id="%s">\n' % (gid)) + else: + self._groupd[s] = self._groupd.get(s,0) + 1 + self._svgwriter.write('<g id="%s%d">\n' % (s, self._groupd[s])) def close_group(self, s): self._svgwriter.write('</g>\n') Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2008-12-17 00:55:52 UTC (rev 6641) +++ trunk/matplotlib/lib/matplotlib/lines.py 2008-12-17 07:32:18 UTC (rev 6642) @@ -463,7 +463,7 @@ if self._invalid: self.recache() - renderer.open_group('line2d') + renderer.open_group('line2d', self.get_gid()) if not self._visible: return gc = renderer.new_gc() Modified: trunk/matplotlib/lib/matplotlib/patches.py =================================================================== --- trunk/matplotlib/lib/matplotlib/patches.py 2008-12-17 00:55:52 UTC (rev 6641) +++ trunk/matplotlib/lib/matplotlib/patches.py 2008-12-17 07:32:18 UTC (rev 6642) @@ -264,7 +264,8 @@ def draw(self, renderer): 'Draw the :class:`Patch` to the given *renderer*.' if not self.get_visible(): return - #renderer.open_group('patch') + + renderer.open_group('patch', self.get_gid()) gc = renderer.new_gc() if cbook.is_string_like(self._edgecolor) and self._edgecolor.lower()=='none': @@ -300,7 +301,7 @@ renderer.draw_path(gc, tpath, affine, rgbFace) - #renderer.close_group('patch') + renderer.close_group('patch') def get_path(self): """ Modified: trunk/matplotlib/lib/matplotlib/text.py =================================================================== --- trunk/matplotlib/lib/matplotlib/text.py 2008-12-17 00:55:52 UTC (rev 6641) +++ trunk/matplotlib/lib/matplotlib/text.py 2008-12-17 07:32:18 UTC (rev 6642) @@ -447,6 +447,8 @@ if not self.get_visible(): return if self._text=='': return + renderer.open_group('text', self.get_gid()) + bbox, info = self._get_layout(renderer) trans = self.get_transform() @@ -499,6 +501,8 @@ self._fontproperties, angle, ismath=ismath) + renderer.close_group('text') + def get_color(self): "Return the color of the text" return self._color This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2008-12-17 12:54:28
|
Revision: 6645 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6645&view=rev Author: jdh2358 Date: 2008-12-17 12:54:24 +0000 (Wed, 17 Dec 2008) Log Message: ----------- Merged revisions 6644 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6644 | jdh2358 | 2008-12-17 06:51:22 -0600 (Wed, 17 Dec 2008) | 1 line added Jouni's pdf image dpi patch; apply fix to figimage ........ Modified Paths: -------------- trunk/matplotlib/examples/pylab_examples/figimage_demo.py trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py trunk/matplotlib/lib/matplotlib/figure.py trunk/matplotlib/lib/matplotlib/image.py Property Changed: ---------------- trunk/matplotlib/ Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6640 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6644 Modified: trunk/matplotlib/examples/pylab_examples/figimage_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/figimage_demo.py 2008-12-17 12:51:22 UTC (rev 6644) +++ trunk/matplotlib/examples/pylab_examples/figimage_demo.py 2008-12-17 12:54:24 UTC (rev 6645) @@ -15,6 +15,11 @@ im1 = plt.figimage(Z, xo=50, yo=0, cmap=cm.jet, origin='lower') im2 = plt.figimage(Z, xo=100, yo=100, alpha=.8, cmap=cm.jet, origin='lower') +dpi = 200 +plt.savefig('figimage.png', dpi=dpi) +plt.savefig('figimage.pdf', dpi=dpi) +plt.savefig('figimage.svg', dpi=dpi) +plt.savefig('figimage.eps', dpi=dpi) plt.show() Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2008-12-17 12:51:22 UTC (rev 6644) +++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2008-12-17 12:54:24 UTC (rev 6645) @@ -1184,13 +1184,14 @@ truetype_font_cache = maxdict(50) afm_font_cache = maxdict(50) - def __init__(self, file, dpi): + def __init__(self, file, dpi, image_dpi): RendererBase.__init__(self) self.file = file self.gc = self.new_gc() self.file.used_characters = self.used_characters = {} self.mathtext_parser = MathTextParser("Pdf") self.dpi = dpi + self.image_dpi = image_dpi self.tex_font_map = None def finalize(self): @@ -1230,9 +1231,10 @@ stat_key, (realpath, set())) used_characters[1].update(charset) + def get_image_magnification(self): + return self.image_dpi/72.0 + def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None): - #print >>sys.stderr, "draw_image called" - # MGDTODO: Support clippath here gc = self.new_gc() if bbox is not None: @@ -1240,6 +1242,7 @@ self.check_gc(gc) h, w = im.get_size_out() + h, w = 72.0*h/self.image_dpi, 72.0*w/self.image_dpi imob = self.file.imageObject(im) self.file.output(Op.gsave, w, 0, 0, h, x, y, Op.concat_matrix, imob, Op.use_xobject, Op.grestore) @@ -1873,13 +1876,13 @@ return 'pdf' def print_pdf(self, filename, **kwargs): - dpi = 72 # there are 72 Postscript points to an inch - # TODO: use the dpi kwarg for images - self.figure.set_dpi(dpi) + ppi = 72 # Postscript points in an inch + image_dpi = kwargs.get('dpi', 72) # dpi to use for images + self.figure.set_dpi(ppi) width, height = self.figure.get_size_inches() - file = PdfFile(width, height, dpi, filename) + file = PdfFile(width, height, ppi, filename) renderer = MixedModeRenderer( - width, height, dpi, RendererPdf(file, dpi)) + width, height, ppi, RendererPdf(file, ppi, image_dpi)) self.figure.draw(renderer) renderer.finalize() file.close() Modified: trunk/matplotlib/lib/matplotlib/figure.py =================================================================== --- trunk/matplotlib/lib/matplotlib/figure.py 2008-12-17 12:51:22 UTC (rev 6644) +++ trunk/matplotlib/lib/matplotlib/figure.py 2008-12-17 12:54:24 UTC (rev 6645) @@ -755,7 +755,7 @@ # make a composite image blending alpha # list of (_image.Image, ox, oy) mag = renderer.get_image_magnification() - ims = [(im.make_image(mag), im.ox*mag, im.oy*mag) + ims = [(im.make_image(mag), im.ox, im.oy) for im in self.images] im = _image.from_images(self.bbox.height * mag, Modified: trunk/matplotlib/lib/matplotlib/image.py =================================================================== --- trunk/matplotlib/lib/matplotlib/image.py 2008-12-17 12:51:22 UTC (rev 6644) +++ trunk/matplotlib/lib/matplotlib/image.py 2008-12-17 12:54:24 UTC (rev 6645) @@ -630,6 +630,7 @@ self.ox = offsetx self.oy = offsety self.update(kwargs) + self.magnification = 1.0 def contains(self, mouseevent): """Test whether the mouse event occured within the image. @@ -659,22 +660,30 @@ -0.5+self.oy, numrows-0.5+self.oy) def make_image(self, magnification=1.0): - # had to introduce argument magnification to satisfy the unit test - # figimage_demo.py. I have no idea, how magnification should be used - # within the function. It should be !=1.0 only for non-default DPI< - # settings in the PS backend, as introduced by patch #1562394 - # Probably Nicholas Young should look over this code and see, how - # magnification should be handled correctly. if self._A is None: raise RuntimeError('You must first set the image array') x = self.to_rgba(self._A, self._alpha) - - im = _image.fromarray(x, 1) + self.magnification = magnification + # if magnification is not one, we need to resize + ismag = magnification!=1 + #if ismag: raise RuntimeError + if ismag: + isoutput = 0 + else: + isoutput = 1 + im = _image.fromarray(x, isoutput) fc = self.figure.get_facecolor() im.set_bg( *mcolors.colorConverter.to_rgba(fc, 0) ) im.is_grayscale = (self.cmap.name == "gray" and len(self._A.shape) == 2) + + if ismag: + numrows, numcols = self.get_size() + numrows *= magnification + numcols *= magnification + im.set_interpolation(_image.NEAREST) + im.resize(numcols, numrows) if self.origin=='upper': im.flipud_out() @@ -683,9 +692,8 @@ def draw(self, renderer, *args, **kwargs): if not self.get_visible(): return # todo: we should be able to do some cacheing here - im = self.make_image() - - renderer.draw_image(round(self.ox), round(self.oy), im, self.figure.bbox, + im = self.make_image(renderer.get_image_magnification()) + renderer.draw_image(round(self.ox/self.magnification), round(self.oy/self.magnification), im, self.figure.bbox, *self.get_transformed_clip_path_and_affine()) def write_png(self, fname): @@ -772,7 +780,7 @@ x.shape = im.size[1], im.size[0], 4 return x -def thumbnail(infile, thumbfile, scale=0.1, interpolation='bilinear', +def thumbnail(infile, thumbfile, scale=0.1, interpolation='bilinear', preview=False): """ make a thumbnail of image in *infile* with output filename This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2008-12-17 14:58:51
|
Revision: 6649 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6649&view=rev Author: jdh2358 Date: 2008-12-17 14:58:42 +0000 (Wed, 17 Dec 2008) Log Message: ----------- Merged revisions 6647 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6647 | jdh2358 | 2008-12-17 08:55:42 -0600 (Wed, 17 Dec 2008) | 1 line fix to figimage ........ Modified Paths: -------------- trunk/matplotlib/examples/pylab_examples/figimage_demo.py trunk/matplotlib/lib/matplotlib/image.py Property Changed: ---------------- trunk/matplotlib/ Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6644 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6648 Modified: trunk/matplotlib/examples/pylab_examples/figimage_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/figimage_demo.py 2008-12-17 14:57:28 UTC (rev 6648) +++ trunk/matplotlib/examples/pylab_examples/figimage_demo.py 2008-12-17 14:58:42 UTC (rev 6649) @@ -7,7 +7,7 @@ import matplotlib.pyplot as plt -fig = plt.figure(frameon=False) +fig = plt.figure() Z = np.arange(10000.0) Z.shape = 100,100 Z[:,50:] = 1. @@ -15,11 +15,13 @@ im1 = plt.figimage(Z, xo=50, yo=0, cmap=cm.jet, origin='lower') im2 = plt.figimage(Z, xo=100, yo=100, alpha=.8, cmap=cm.jet, origin='lower') -dpi = 200 -plt.savefig('figimage.png', dpi=dpi) -plt.savefig('figimage.pdf', dpi=dpi) -plt.savefig('figimage.svg', dpi=dpi) -plt.savefig('figimage.eps', dpi=dpi) + +if 0: + dpi = 72 + plt.savefig('figimage_%d.png'%dpi, dpi=dpi, facecolor='gray') + plt.savefig('figimage_%d.pdf'%dpi, dpi=dpi, facecolor='gray') + plt.savefig('figimage_%d.svg'%dpi, dpi=dpi, facecolor='gray') + plt.savefig('figimage_%d.eps'%dpi, dpi=dpi, facecolor='gray') plt.show() Modified: trunk/matplotlib/lib/matplotlib/image.py =================================================================== --- trunk/matplotlib/lib/matplotlib/image.py 2008-12-17 14:57:28 UTC (rev 6648) +++ trunk/matplotlib/lib/matplotlib/image.py 2008-12-17 14:58:42 UTC (rev 6649) @@ -693,7 +693,7 @@ if not self.get_visible(): return # todo: we should be able to do some cacheing here im = self.make_image(renderer.get_image_magnification()) - renderer.draw_image(round(self.ox/self.magnification), round(self.oy/self.magnification), im, self.figure.bbox, + renderer.draw_image(round(self.ox), round(self.oy), im, self.figure.bbox, *self.get_transformed_clip_path_and_affine()) def write_png(self, fname): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2008-12-17 16:00:47
|
Revision: 6651 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6651&view=rev Author: jdh2358 Date: 2008-12-17 16:00:44 +0000 (Wed, 17 Dec 2008) Log Message: ----------- Merged revisions 6650 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6650 | jdh2358 | 2008-12-17 07:59:31 -0800 (Wed, 17 Dec 2008) | 1 line added piwik analytics javascript tag to header ........ Modified Paths: -------------- trunk/matplotlib/doc/_templates/layout.html Property Changed: ---------------- trunk/matplotlib/ Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6648 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6650 Modified: trunk/matplotlib/doc/_templates/layout.html =================================================================== --- trunk/matplotlib/doc/_templates/layout.html 2008-12-17 15:59:31 UTC (rev 6650) +++ trunk/matplotlib/doc/_templates/layout.html 2008-12-17 16:00:44 UTC (rev 6651) @@ -1,5 +1,6 @@ {% extends "!layout.html" %} + {% block rootrellink %} <li><a href="{{ pathto('index') }}">matplotlib home</a>| </li> <li><a href="{{ pathto('search') }}">search</a>| </li> @@ -9,6 +10,20 @@ {% block relbar1 %} +<!-- Piwik --> +<script type="text/javascript"> +var pkBaseURL = (("https:" == document.location.protocol) ? "https://apps.sourceforge.net/piwik/matplotlib/" : "http://apps.sourceforge.net/piwik/matplotlib/"); +document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E")); +</script><script type="text/javascript"> +piwik_action_name = ''; +piwik_idsite = 1; +piwik_url = pkBaseURL + "piwik.php"; +piwik_log(piwik_action_name, piwik_idsite, piwik_url); +</script> +<object><noscript><p><img src="http://apps.sourceforge.net/piwik/matplotlib/piwik.php?idsite=1" alt="piwik"/></p></noscript></object> +<!-- End Piwik Tag --> + + <div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px"> <a href="{{ pathto('index') }}"><img src="{{ pathto("_static/logo2.png", 1) }}" border="0" alt="matplotlib"/></a> @@ -20,5 +35,3 @@ {% block sidebar1 %}{{ sidebar() }}{% endblock %} {% block sidebar2 %}{% endblock %} - - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-12-17 21:15:37
|
Revision: 6654 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6654&view=rev Author: mdboom Date: 2008-12-17 21:15:30 +0000 (Wed, 17 Dec 2008) Log Message: ----------- Merged revisions 6652 via svnmerge from https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6652 | mdboom | 2008-12-17 11:52:39 -0500 (Wed, 17 Dec 2008) | 2 lines Massive documentation build improvements. See e-mail on matplotlib-devel. ........ Modified Paths: -------------- trunk/matplotlib/doc/README.txt trunk/matplotlib/doc/conf.py trunk/matplotlib/doc/make.py trunk/matplotlib/doc/sphinxext/inheritance_diagram.py trunk/matplotlib/doc/sphinxext/mathmpl.py trunk/matplotlib/doc/sphinxext/only_directives.py trunk/matplotlib/doc/sphinxext/plot_directive.py Added Paths: ----------- trunk/matplotlib/doc/sphinxext/gen_gallery.py Removed Paths: ------------- trunk/matplotlib/doc/_templates/gallery.html trunk/matplotlib/doc/_templates/gen_gallery.py Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6650 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6653 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652 Modified: trunk/matplotlib/doc/README.txt =================================================================== --- trunk/matplotlib/doc/README.txt 2008-12-17 19:06:30 UTC (rev 6653) +++ trunk/matplotlib/doc/README.txt 2008-12-17 21:15:30 UTC (rev 6654) @@ -35,3 +35,7 @@ for the initial run (which builds the example gallery) to be done, then run "python make.py html" again. The top file of the results will be ./build/html/index.html + +To build a smaller version of the documentation (without +high-resolution PNGs and PDF examples), type "python make.py --small +html". Deleted: trunk/matplotlib/doc/_templates/gallery.html =================================================================== --- trunk/matplotlib/doc/_templates/gallery.html 2008-12-17 19:06:30 UTC (rev 6653) +++ trunk/matplotlib/doc/_templates/gallery.html 2008-12-17 21:15:30 UTC (rev 6654) @@ -1,526 +0,0 @@ -{% extends "layout.html" %} -{% set title = "Thumbnail gallery" %} - - -{% block body %} - -<h3>Click on any image to see full size image and source code</h3> -<br/> - -<a href="examples/api/barchart_demo.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/barchart_demo.png" border="0" alt="barchart_demo"/></a> - -<a href="examples/api/bbox_intersect.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/bbox_intersect.png" border="0" alt="bbox_intersect"/></a> - -<a href="examples/api/collections_demo.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/collections_demo.png" border="0" alt="collections_demo"/></a> - -<a href="examples/api/color_cycle.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/color_cycle.png" border="0" alt="color_cycle"/></a> - -<a href="examples/api/colorbar_only.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/colorbar_only.png" border="0" alt="colorbar_only"/></a> - -<a href="examples/api/custom_projection_example.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/custom_projection_example.png" border="0" alt="custom_projection_example"/></a> - -<a href="examples/api/custom_scale_example.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/custom_scale_example.png" border="0" alt="custom_scale_example"/></a> - -<a href="examples/api/date_demo.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/date_demo.png" border="0" alt="date_demo"/></a> - -<a href="examples/api/date_index_formatter.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/date_index_formatter_00.png" border="0" alt="date_index_formatter"/></a> - -<a href="examples/api/date_index_formatter.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/date_index_formatter_01.png" border="0" alt="date_index_formatter"/></a> - -<a href="examples/api/donut_demo.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/donut_demo.png" border="0" alt="donut_demo"/></a> - -<a href="examples/api/histogram_demo.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/histogram_demo.png" border="0" alt="histogram_demo"/></a> - -<a href="examples/api/image_zcoord.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/image_zcoord.png" border="0" alt="image_zcoord"/></a> - -<a href="examples/api/legend_demo.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/legend_demo.png" border="0" alt="legend_demo"/></a> - -<a href="examples/api/line_with_text.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/line_with_text.png" border="0" alt="line_with_text"/></a> - -<a href="examples/api/logo2.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/logo2.png" border="0" alt="logo2"/></a> - -<a href="examples/api/mathtext_asarray.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/mathtext_asarray.png" border="0" alt="mathtext_asarray"/></a> - -<a href="examples/api/patch_collection.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/patch_collection.png" border="0" alt="patch_collection"/></a> - -<a href="examples/api/path_patch_demo.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/path_patch_demo.png" border="0" alt="path_patch_demo"/></a> - -<a href="examples/api/quad_bezier.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/quad_bezier.png" border="0" alt="quad_bezier"/></a> - -<a href="examples/api/scatter_piecharts.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/scatter_piecharts.png" border="0" alt="scatter_piecharts"/></a> - -<a href="examples/api/span_regions.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/span_regions.png" border="0" alt="span_regions"/></a> - -<a href="examples/api/two_scales.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/two_scales.png" border="0" alt="two_scales"/></a> - -<a href="examples/api/unicode_minus.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/unicode_minus.png" border="0" alt="unicode_minus"/></a> - -<a href="examples/api/watermark_image.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/watermark_image.png" border="0" alt="watermark_image"/></a> - -<a href="examples/api/watermark_text.html"><img src="_static/plot_directive/mpl_examples/api/thumbnails/watermark_text.png" border="0" alt="watermark_text"/></a> - -<a href="examples/pylab_examples/accented_text.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/accented_text.png" border="0" alt="accented_text"/></a> - -<a href="examples/pylab_examples/agg_buffer_to_array.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/agg_buffer_to_array_00.png" border="0" alt="agg_buffer_to_array"/></a> - -<a href="examples/pylab_examples/agg_buffer_to_array.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/agg_buffer_to_array_01.png" border="0" alt="agg_buffer_to_array"/></a> - -<a href="examples/pylab_examples/alignment_test.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/alignment_test.png" border="0" alt="alignment_test"/></a> - -<a href="examples/pylab_examples/annotation_demo2.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/annotation_demo2_00.png" border="0" alt="annotation_demo2"/></a> - -<a href="examples/pylab_examples/annotation_demo2.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/annotation_demo2_01.png" border="0" alt="annotation_demo2"/></a> - -<a href="examples/pylab_examples/annotation_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/annotation_demo_00.png" border="0" alt="annotation_demo"/></a> - -<a href="examples/pylab_examples/annotation_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/annotation_demo_01.png" border="0" alt="annotation_demo"/></a> - -<a href="examples/pylab_examples/annotation_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/annotation_demo_02.png" border="0" alt="annotation_demo"/></a> - -<a href="examples/pylab_examples/anscombe.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/anscombe.png" border="0" alt="anscombe"/></a> - -<a href="examples/pylab_examples/arctest.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/arctest.png" border="0" alt="arctest"/></a> - -<a href="examples/pylab_examples/arrow_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/arrow_demo.png" border="0" alt="arrow_demo"/></a> - -<a href="examples/pylab_examples/axes_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/axes_demo.png" border="0" alt="axes_demo"/></a> - -<a href="examples/pylab_examples/axes_props.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/axes_props.png" border="0" alt="axes_props"/></a> - -<a href="examples/pylab_examples/axhspan_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/axhspan_demo.png" border="0" alt="axhspan_demo"/></a> - -<a href="examples/pylab_examples/axis_equal_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/axis_equal_demo.png" border="0" alt="axis_equal_demo"/></a> - -<a href="examples/pylab_examples/bar_stacked.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/bar_stacked.png" border="0" alt="bar_stacked"/></a> - -<a href="examples/pylab_examples/barb_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/barb_demo.png" border="0" alt="barb_demo"/></a> - -<a href="examples/pylab_examples/barchart_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/barchart_demo.png" border="0" alt="barchart_demo"/></a> - -<a href="examples/pylab_examples/barcode_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/barcode_demo.png" border="0" alt="barcode_demo"/></a> - -<a href="examples/pylab_examples/barh_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/barh_demo_00.png" border="0" alt="barh_demo"/></a> - -<a href="examples/pylab_examples/barh_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/barh_demo_01.png" border="0" alt="barh_demo"/></a> - -<a href="examples/pylab_examples/boxplot_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo_00.png" border="0" alt="boxplot_demo"/></a> - -<a href="examples/pylab_examples/boxplot_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo_01.png" border="0" alt="boxplot_demo"/></a> - -<a href="examples/pylab_examples/boxplot_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo_02.png" border="0" alt="boxplot_demo"/></a> - -<a href="examples/pylab_examples/boxplot_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo_03.png" border="0" alt="boxplot_demo"/></a> - -<a href="examples/pylab_examples/boxplot_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo_04.png" border="0" alt="boxplot_demo"/></a> - -<a href="examples/pylab_examples/boxplot_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo_05.png" border="0" alt="boxplot_demo"/></a> - -<a href="examples/pylab_examples/boxplot_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/boxplot_demo_06.png" border="0" alt="boxplot_demo"/></a> - -<a href="examples/pylab_examples/break.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/break.png" border="0" alt="break"/></a> - -<a href="examples/pylab_examples/broken_barh.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/broken_barh.png" border="0" alt="broken_barh"/></a> - -<a href="examples/pylab_examples/clippedline.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/clippedline.png" border="0" alt="clippedline"/></a> - -<a href="examples/pylab_examples/cohere_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/cohere_demo.png" border="0" alt="cohere_demo"/></a> - -<a href="examples/pylab_examples/color_by_yvalue.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/color_by_yvalue.png" border="0" alt="color_by_yvalue"/></a> - -<a href="examples/pylab_examples/color_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/color_demo.png" border="0" alt="color_demo"/></a> - -<a href="examples/pylab_examples/colorbar_tick_labelling_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/colorbar_tick_labelling_demo_00.png" border="0" alt="colorbar_tick_labelling_demo"/></a> - -<a href="examples/pylab_examples/colorbar_tick_labelling_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/colorbar_tick_labelling_demo_01.png" border="0" alt="colorbar_tick_labelling_demo"/></a> - -<a href="examples/pylab_examples/contour_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_demo_00.png" border="0" alt="contour_demo"/></a> - -<a href="examples/pylab_examples/contour_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_demo_01.png" border="0" alt="contour_demo"/></a> - -<a href="examples/pylab_examples/contour_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_demo_02.png" border="0" alt="contour_demo"/></a> - -<a href="examples/pylab_examples/contour_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_demo_03.png" border="0" alt="contour_demo"/></a> - -<a href="examples/pylab_examples/contour_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_demo_04.png" border="0" alt="contour_demo"/></a> - -<a href="examples/pylab_examples/contour_image.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_image.png" border="0" alt="contour_image"/></a> - -<a href="examples/pylab_examples/contour_label_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_label_demo_00.png" border="0" alt="contour_label_demo"/></a> - -<a href="examples/pylab_examples/contour_label_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_label_demo_01.png" border="0" alt="contour_label_demo"/></a> - -<a href="examples/pylab_examples/contourf_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/contourf_demo_00.png" border="0" alt="contourf_demo"/></a> - -<a href="examples/pylab_examples/contourf_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/contourf_demo_01.png" border="0" alt="contourf_demo"/></a> - -<a href="examples/pylab_examples/contourf_log.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/contourf_log.png" border="0" alt="contourf_log"/></a> - -<a href="examples/pylab_examples/coords_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/coords_demo.png" border="0" alt="coords_demo"/></a> - -<a href="examples/pylab_examples/coords_report.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/coords_report.png" border="0" alt="coords_report"/></a> - -<a href="examples/pylab_examples/csd_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/csd_demo.png" border="0" alt="csd_demo"/></a> - -<a href="examples/pylab_examples/custom_cmap.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/custom_cmap.png" border="0" alt="custom_cmap"/></a> - -<a href="examples/pylab_examples/custom_figure_class.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/custom_figure_class.png" border="0" alt="custom_figure_class"/></a> - -<a href="examples/pylab_examples/custom_ticker1.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/custom_ticker1.png" border="0" alt="custom_ticker1"/></a> - -<a href="examples/pylab_examples/customize_rc.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/customize_rc.png" border="0" alt="customize_rc"/></a> - -<a href="examples/pylab_examples/dannys_example.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/dannys_example.png" border="0" alt="dannys_example"/></a> - -<a href="examples/pylab_examples/dash_control.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/dash_control.png" border="0" alt="dash_control"/></a> - -<a href="examples/pylab_examples/dashpointlabel.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/dashpointlabel.png" border="0" alt="dashpointlabel"/></a> - -<a href="examples/pylab_examples/date_demo1.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/date_demo1.png" border="0" alt="date_demo1"/></a> - -<a href="examples/pylab_examples/date_demo2.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/date_demo2.png" border="0" alt="date_demo2"/></a> - -<a href="examples/pylab_examples/date_demo_convert.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/date_demo_convert.png" border="0" alt="date_demo_convert"/></a> - -<a href="examples/pylab_examples/date_demo_rrule.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/date_demo_rrule.png" border="0" alt="date_demo_rrule"/></a> - -<a href="examples/pylab_examples/date_index_formatter.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/date_index_formatter.png" border="0" alt="date_index_formatter"/></a> - -<a href="examples/pylab_examples/dolphin.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/dolphin.png" border="0" alt="dolphin"/></a> - -<a href="examples/pylab_examples/ellipse_collection.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/ellipse_collection.png" border="0" alt="ellipse_collection"/></a> - -<a href="examples/pylab_examples/ellipse_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/ellipse_demo.png" border="0" alt="ellipse_demo"/></a> - -<a href="examples/pylab_examples/ellipse_rotated.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/ellipse_rotated.png" border="0" alt="ellipse_rotated"/></a> - -<a href="examples/pylab_examples/equal_aspect_ratio.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/equal_aspect_ratio.png" border="0" alt="equal_aspect_ratio"/></a> - -<a href="examples/pylab_examples/errorbar_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/errorbar_demo_00.png" border="0" alt="errorbar_demo"/></a> - -<a href="examples/pylab_examples/errorbar_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/errorbar_demo_01.png" border="0" alt="errorbar_demo"/></a> - -<a href="examples/pylab_examples/errorbar_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/errorbar_demo_02.png" border="0" alt="errorbar_demo"/></a> - -<a href="examples/pylab_examples/errorbar_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/errorbar_demo_03.png" border="0" alt="errorbar_demo"/></a> - -<a href="examples/pylab_examples/errorbar_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/errorbar_demo_04.png" border="0" alt="errorbar_demo"/></a> - -<a href="examples/pylab_examples/errorbar_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/errorbar_demo_05.png" border="0" alt="errorbar_demo"/></a> - -<a href="examples/pylab_examples/errorbar_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/errorbar_demo_06.png" border="0" alt="errorbar_demo"/></a> - -<a href="examples/pylab_examples/errorbar_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/errorbar_demo_07.png" border="0" alt="errorbar_demo"/></a> - -<a href="examples/pylab_examples/errorbar_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/errorbar_demo_08.png" border="0" alt="errorbar_demo"/></a> - -<a href="examples/pylab_examples/errorbar_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/errorbar_demo_09.png" border="0" alt="errorbar_demo"/></a> - -<a href="examples/pylab_examples/errorbar_limits.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/errorbar_limits_00.png" border="0" alt="errorbar_limits"/></a> - -<a href="examples/pylab_examples/errorbar_limits.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/errorbar_limits_01.png" border="0" alt="errorbar_limits"/></a> - -<a href="examples/pylab_examples/fancyarrow_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/fancyarrow_demo.png" border="0" alt="fancyarrow_demo"/></a> - -<a href="examples/pylab_examples/fancybox_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/fancybox_demo.png" border="0" alt="fancybox_demo"/></a> - -<a href="examples/pylab_examples/fancybox_demo2.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/fancybox_demo2.png" border="0" alt="fancybox_demo2"/></a> - -<a href="examples/pylab_examples/fancytextbox_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/fancytextbox_demo.png" border="0" alt="fancytextbox_demo"/></a> - -<a href="examples/pylab_examples/figimage_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/figimage_demo.png" border="0" alt="figimage_demo"/></a> - -<a href="examples/pylab_examples/figlegend_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/figlegend_demo.png" border="0" alt="figlegend_demo"/></a> - -<a href="examples/pylab_examples/figure_title.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/figure_title.png" border="0" alt="figure_title"/></a> - -<a href="examples/pylab_examples/fill_between.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/fill_between_00.png" border="0" alt="fill_between"/></a> - -<a href="examples/pylab_examples/fill_between.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/fill_between_01.png" border="0" alt="fill_between"/></a> - -<a href="examples/pylab_examples/fill_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/fill_demo.png" border="0" alt="fill_demo"/></a> - -<a href="examples/pylab_examples/fill_demo2.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/fill_demo2.png" border="0" alt="fill_demo2"/></a> - -<a href="examples/pylab_examples/fill_spiral.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/fill_spiral.png" border="0" alt="fill_spiral"/></a> - -<a href="examples/pylab_examples/finance_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/finance_demo.png" border="0" alt="finance_demo"/></a> - -<a href="examples/pylab_examples/finance_work2.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/finance_work2.png" border="0" alt="finance_work2"/></a> - -<a href="examples/pylab_examples/findobj_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/findobj_demo.png" border="0" alt="findobj_demo"/></a> - -<a href="examples/pylab_examples/fonts_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/fonts_demo.png" border="0" alt="fonts_demo"/></a> - -<a href="examples/pylab_examples/fonts_demo_kw.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/fonts_demo_kw.png" border="0" alt="fonts_demo_kw"/></a> - -<a href="examples/pylab_examples/ganged_plots.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/ganged_plots.png" border="0" alt="ganged_plots"/></a> - -<a href="examples/pylab_examples/geo_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/geo_demo.png" border="0" alt="geo_demo"/></a> - -<a href="examples/pylab_examples/gradient_bar.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/gradient_bar.png" border="0" alt="gradient_bar"/></a> - -<a href="examples/pylab_examples/griddata_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/griddata_demo.png" border="0" alt="griddata_demo"/></a> - -<a href="examples/pylab_examples/hatch_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/hatch_demo.png" border="0" alt="hatch_demo"/></a> - -<a href="examples/pylab_examples/hexbin_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/hexbin_demo.png" border="0" alt="hexbin_demo"/></a> - -<a href="examples/pylab_examples/hexbin_demo2.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/hexbin_demo2.png" border="0" alt="hexbin_demo2"/></a> - -<a href="examples/pylab_examples/hist_colormapped.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/hist_colormapped.png" border="0" alt="hist_colormapped"/></a> - -<a href="examples/pylab_examples/histogram_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/histogram_demo.png" border="0" alt="histogram_demo"/></a> - -<a href="examples/pylab_examples/histogram_demo_extended.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/histogram_demo_extended_00.png" border="0" alt="histogram_demo_extended"/></a> - -<a href="examples/pylab_examples/histogram_demo_extended.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/histogram_demo_extended_01.png" border="0" alt="histogram_demo_extended"/></a> - -<a href="examples/pylab_examples/histogram_demo_extended.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/histogram_demo_extended_02.png" border="0" alt="histogram_demo_extended"/></a> - -<a href="examples/pylab_examples/histogram_demo_extended.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/histogram_demo_extended_03.png" border="0" alt="histogram_demo_extended"/></a> - -<a href="examples/pylab_examples/histogram_demo_extended.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/histogram_demo_extended_04.png" border="0" alt="histogram_demo_extended"/></a> - -<a href="examples/pylab_examples/histogram_demo_extended.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/histogram_demo_extended_05.png" border="0" alt="histogram_demo_extended"/></a> - -<a href="examples/pylab_examples/hline_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/hline_demo.png" border="0" alt="hline_demo"/></a> - -<a href="examples/pylab_examples/image_clip_path.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/image_clip_path.png" border="0" alt="image_clip_path"/></a> - -<a href="examples/pylab_examples/image_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/image_demo.png" border="0" alt="image_demo"/></a> - -<a href="examples/pylab_examples/image_demo2.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/image_demo2.png" border="0" alt="image_demo2"/></a> - -<a href="examples/pylab_examples/image_demo3.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/image_demo3.png" border="0" alt="image_demo3"/></a> - -<a href="examples/pylab_examples/image_interp.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/image_interp_00.png" border="0" alt="image_interp"/></a> - -<a href="examples/pylab_examples/image_interp.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/image_interp_01.png" border="0" alt="image_interp"/></a> - -<a href="examples/pylab_examples/image_interp.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/image_interp_02.png" border="0" alt="image_interp"/></a> - -<a href="examples/pylab_examples/image_masked.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/image_masked.png" border="0" alt="image_masked"/></a> - -<a href="examples/pylab_examples/image_nonuniform.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/image_nonuniform.png" border="0" alt="image_nonuniform"/></a> - -<a href="examples/pylab_examples/image_origin.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/image_origin.png" border="0" alt="image_origin"/></a> - -<a href="examples/pylab_examples/image_slices_viewer.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/image_slices_viewer.png" border="0" alt="image_slices_viewer"/></a> - -<a href="examples/pylab_examples/integral_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/integral_demo.png" border="0" alt="integral_demo"/></a> - -<a href="examples/pylab_examples/interp_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/interp_demo.png" border="0" alt="interp_demo"/></a> - -<a href="examples/pylab_examples/invert_axes.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/invert_axes.png" border="0" alt="invert_axes"/></a> - -<a href="examples/pylab_examples/layer_images.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/layer_images.png" border="0" alt="layer_images"/></a> - -<a href="examples/pylab_examples/legend_auto.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/legend_auto_00.png" border="0" alt="legend_auto"/></a> - -<a href="examples/pylab_examples/legend_auto.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/legend_auto_01.png" border="0" alt="legend_auto"/></a> - -<a href="examples/pylab_examples/legend_auto.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/legend_auto_02.png" border="0" alt="legend_auto"/></a> - -<a href="examples/pylab_examples/legend_auto.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/legend_auto_03.png" border="0" alt="legend_auto"/></a> - -<a href="examples/pylab_examples/legend_auto.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/legend_auto_04.png" border="0" alt="legend_auto"/></a> - -<a href="examples/pylab_examples/legend_auto.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/legend_auto_05.png" border="0" alt="legend_auto"/></a> - -<a href="examples/pylab_examples/legend_auto.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/legend_auto_06.png" border="0" alt="legend_auto"/></a> - -<a href="examples/pylab_examples/legend_auto.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/legend_auto_07.png" border="0" alt="legend_auto"/></a> - -<a href="examples/pylab_examples/legend_auto.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/legend_auto_08.png" border="0" alt="legend_auto"/></a> - -<a href="examples/pylab_examples/legend_auto.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/legend_auto_09.png" border="0" alt="legend_auto"/></a> - -<a href="examples/pylab_examples/legend_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/legend_demo.png" border="0" alt="legend_demo"/></a> - -<a href="examples/pylab_examples/legend_demo2.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/legend_demo2.png" border="0" alt="legend_demo2"/></a> - -<a href="examples/pylab_examples/legend_demo3.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/legend_demo3.png" border="0" alt="legend_demo3"/></a> - -<a href="examples/pylab_examples/legend_scatter.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/legend_scatter.png" border="0" alt="legend_scatter"/></a> - -<a href="examples/pylab_examples/line_collection.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/line_collection.png" border="0" alt="line_collection"/></a> - -<a href="examples/pylab_examples/line_collection2.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/line_collection2.png" border="0" alt="line_collection2"/></a> - -<a href="examples/pylab_examples/line_styles.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/line_styles.png" border="0" alt="line_styles"/></a> - -<a href="examples/pylab_examples/load_converter.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/load_converter.png" border="0" alt="load_converter"/></a> - -<a href="examples/pylab_examples/loadrec.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/loadrec.png" border="0" alt="loadrec"/></a> - -<a href="examples/pylab_examples/log_bar.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/log_bar.png" border="0" alt="log_bar"/></a> - -<a href="examples/pylab_examples/log_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/log_demo.png" border="0" alt="log_demo"/></a> - -<a href="examples/pylab_examples/log_test.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/log_test.png" border="0" alt="log_test"/></a> - -<a href="examples/pylab_examples/logo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/logo.png" border="0" alt="logo"/></a> - -<a href="examples/pylab_examples/major_minor_demo1.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/major_minor_demo1.png" border="0" alt="major_minor_demo1"/></a> - -<a href="examples/pylab_examples/major_minor_demo2.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/major_minor_demo2.png" border="0" alt="major_minor_demo2"/></a> - -<a href="examples/pylab_examples/manual_axis.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/manual_axis.png" border="0" alt="manual_axis"/></a> - -<a href="examples/pylab_examples/masked_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/masked_demo.png" border="0" alt="masked_demo"/></a> - -<a href="examples/pylab_examples/mathtext_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/mathtext_demo.png" border="0" alt="mathtext_demo"/></a> - -<a href="examples/pylab_examples/matshow.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/matshow_00.png" border="0" alt="matshow"/></a> - -<a href="examples/pylab_examples/matshow.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/matshow_01.png" border="0" alt="matshow"/></a> - -<a href="examples/pylab_examples/matshow.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/matshow_04.png" border="0" alt="matshow"/></a> - -<a href="examples/pylab_examples/mri_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/mri_demo.png" border="0" alt="mri_demo"/></a> - -<a href="examples/pylab_examples/mri_with_eeg.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/mri_with_eeg.png" border="0" alt="mri_with_eeg"/></a> - -<a href="examples/pylab_examples/multi_image.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/multi_image.png" border="0" alt="multi_image"/></a> - -<a href="examples/pylab_examples/multiline.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/multiline.png" border="0" alt="multiline"/></a> - -<a href="examples/pylab_examples/multiple_figs_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/multiple_figs_demo_00.png" border="0" alt="multiple_figs_demo"/></a> - -<a href="examples/pylab_examples/multiple_figs_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/multiple_figs_demo_01.png" border="0" alt="multiple_figs_demo"/></a> - -<a href="examples/pylab_examples/nan_test.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/nan_test.png" border="0" alt="nan_test"/></a> - -<a href="examples/pylab_examples/newscalarformatter_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/newscalarformatter_demo_00.png" border="0" alt="newscalarformatter_demo"/></a> - -<a href="examples/pylab_examples/newscalarformatter_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/newscalarformatter_demo_01.png" border="0" alt="newscalarformatter_demo"/></a> - -<a href="examples/pylab_examples/newscalarformatter_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/newscalarformatter_demo_02.png" border="0" alt="newscalarformatter_demo"/></a> - -<a href="examples/pylab_examples/newscalarformatter_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/newscalarformatter_demo_03.png" border="0" alt="newscalarformatter_demo"/></a> - -<a href="examples/pylab_examples/pcolor_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/pcolor_demo.png" border="0" alt="pcolor_demo"/></a> - -<a href="examples/pylab_examples/pcolor_demo2.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/pcolor_demo2.png" border="0" alt="pcolor_demo2"/></a> - -<a href="examples/pylab_examples/pcolor_log.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/pcolor_log.png" border="0" alt="pcolor_log"/></a> - -<a href="examples/pylab_examples/pcolor_small.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/pcolor_small.png" border="0" alt="pcolor_small"/></a> - -<a href="examples/pylab_examples/pie_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/pie_demo.png" border="0" alt="pie_demo"/></a> - -<a href="examples/pylab_examples/plotfile_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/plotfile_demo_00.png" border="0" alt="plotfile_demo"/></a> - -<a href="examples/pylab_examples/plotfile_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/plotfile_demo_01.png" border="0" alt="plotfile_demo"/></a> - -<a href="examples/pylab_examples/plotfile_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/plotfile_demo_02.png" border="0" alt="plotfile_demo"/></a> - -<a href="examples/pylab_examples/plotfile_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/plotfile_demo_03.png" border="0" alt="plotfile_demo"/></a> - -<a href="examples/pylab_examples/plotfile_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/plotfile_demo_04.png" border="0" alt="plotfile_demo"/></a> - -<a href="examples/pylab_examples/polar_bar.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/polar_bar.png" border="0" alt="polar_bar"/></a> - -<a href="examples/pylab_examples/polar_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/polar_demo.png" border="0" alt="polar_demo"/></a> - -<a href="examples/pylab_examples/polar_legend.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/polar_legend.png" border="0" alt="polar_legend"/></a> - -<a href="examples/pylab_examples/polar_scatter.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/polar_scatter.png" border="0" alt="polar_scatter"/></a> - -<a href="examples/pylab_examples/poormans_contour.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/poormans_contour.png" border="0" alt="poormans_contour"/></a> - -<a href="examples/pylab_examples/psd_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/psd_demo.png" border="0" alt="psd_demo"/></a> - -<a href="examples/pylab_examples/psd_demo2.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/psd_demo2.png" border="0" alt="psd_demo2"/></a> - -<a href="examples/pylab_examples/psd_demo3.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/psd_demo3.png" border="0" alt="psd_demo3"/></a> - -<a href="examples/pylab_examples/pythonic_matplotlib.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/pythonic_matplotlib.png" border="0" alt="pythonic_matplotlib"/></a> - -<a href="examples/pylab_examples/quadmesh_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/quadmesh_demo.png" border="0" alt="quadmesh_demo"/></a> - -<a href="examples/pylab_examples/quiver_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/quiver_demo_00.png" border="0" alt="quiver_demo"/></a> - -<a href="examples/pylab_examples/quiver_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/quiver_demo_01.png" border="0" alt="quiver_demo"/></a> - -<a href="examples/pylab_examples/quiver_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/quiver_demo_02.png" border="0" alt="quiver_demo"/></a> - -<a href="examples/pylab_examples/quiver_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/quiver_demo_03.png" border="0" alt="quiver_demo"/></a> - -<a href="examples/pylab_examples/quiver_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/quiver_demo_04.png" border="0" alt="quiver_demo"/></a> - -<a href="examples/pylab_examples/quiver_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/quiver_demo_05.png" border="0" alt="quiver_demo"/></a> - -<a href="examples/pylab_examples/scatter_custom_symbol.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/scatter_custom_symbol.png" border="0" alt="scatter_custom_symbol"/></a> - -<a href="examples/pylab_examples/scatter_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/scatter_demo.png" border="0" alt="scatter_demo"/></a> - -<a href="examples/pylab_examples/scatter_demo2.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/scatter_demo2.png" border="0" alt="scatter_demo2"/></a> - -<a href="examples/pylab_examples/scatter_masked.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/scatter_masked.png" border="0" alt="scatter_masked"/></a> - -<a href="examples/pylab_examples/scatter_star_poly.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/scatter_star_poly.png" border="0" alt="scatter_star_poly"/></a> - -<a href="examples/pylab_examples/set_and_get.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/set_and_get.png" border="0" alt="set_and_get"/></a> - -<a href="examples/pylab_examples/shared_axis_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/shared_axis_demo.png" border="0" alt="shared_axis_demo"/></a> - -<a href="examples/pylab_examples/simple_plot.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/simple_plot.png" border="0" alt="simple_plot"/></a> - -<a href="examples/pylab_examples/simplification_clipping_test.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/simplification_clipping_test.png" border="0" alt="simplification_clipping_test"/></a> - -<a href="examples/pylab_examples/specgram_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/specgram_demo.png" border="0" alt="specgram_demo"/></a> - -<a href="examples/pylab_examples/spy_demos.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/spy_demos.png" border="0" alt="spy_demos"/></a> - -<a href="examples/pylab_examples/stem_plot.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/stem_plot.png" border="0" alt="stem_plot"/></a> - -<a href="examples/pylab_examples/step_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/step_demo.png" border="0" alt="step_demo"/></a> - -<a href="examples/pylab_examples/stix_fonts_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/stix_fonts_demo.png" border="0" alt="stix_fonts_demo"/></a> - -<a href="examples/pylab_examples/subplot_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/subplot_demo.png" border="0" alt="subplot_demo"/></a> - -<a href="examples/pylab_examples/subplot_toolbar.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/subplot_toolbar_00.png" border="0" alt="subplot_toolbar"/></a> - -<a href="examples/pylab_examples/subplot_toolbar.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/subplot_toolbar_01.png" border="0" alt="subplot_toolbar"/></a> - -<a href="examples/pylab_examples/subplots_adjust.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/subplots_adjust.png" border="0" alt="subplots_adjust"/></a> - -<a href="examples/pylab_examples/symlog_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/symlog_demo.png" border="0" alt="symlog_demo"/></a> - -<a href="examples/pylab_examples/table_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/table_demo.png" border="0" alt="table_demo"/></a> - -<a href="examples/pylab_examples/tex_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/tex_demo.png" border="0" alt="tex_demo"/></a> - -<a href="examples/pylab_examples/text_handles.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/text_handles.png" border="0" alt="text_handles"/></a> - -<a href="examples/pylab_examples/text_rotation.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/text_rotation.png" border="0" alt="text_rotation"/></a> - -<a href="examples/pylab_examples/text_rotation_relative_to_line.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/text_rotation_relative_to_line.png" border="0" alt="text_rotation_relative_to_line"/></a> - -<a href="examples/pylab_examples/text_themes.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/text_themes.png" border="0" alt="text_themes"/></a> - -<a href="examples/pylab_examples/to_numeric.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/to_numeric.png" border="0" alt="to_numeric"/></a> - -<a href="examples/pylab_examples/toggle_images.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/toggle_images.png" border="0" alt="toggle_images"/></a> - -<a href="examples/pylab_examples/transoffset.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/transoffset.png" border="0" alt="transoffset"/></a> - -<a href="examples/pylab_examples/unicode_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/unicode_demo.png" border="0" alt="unicode_demo"/></a> - -<a href="examples/pylab_examples/usetex_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/usetex_demo.png" border="0" alt="usetex_demo"/></a> - -<a href="examples/pylab_examples/vertical_ticklabels.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/vertical_ticklabels.png" border="0" alt="vertical_ticklabels"/></a> - -<a href="examples/pylab_examples/vline_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/vline_demo.png" border="0" alt="vline_demo"/></a> - -<a href="examples/pylab_examples/xcorr_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/xcorr_demo.png" border="0" alt="xcorr_demo"/></a> - -<a href="examples/pylab_examples/zorder_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/zorder_demo_00.png" border="0" alt="zorder_demo"/></a> - -<a href="examples/pylab_examples/zorder_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/zorder_demo_01.png" border="0" alt="zorder_demo"/></a> - -<a href="examples/widgets/slider_demo.html"><img src="_static/plot_directive/mpl_examples/widgets/thumbnails/slider_demo.png" border="0" alt="slider_demo"/></a> - -{% endblock %} Deleted: trunk/matplotlib/doc/_templates/gen_gallery.py =================================================================== --- trunk/matplotlib/doc/_templates/gen_gallery.py 2008-12-17 19:06:30 UTC (rev 6653) +++ trunk/matplotlib/doc/_templates/gen_gallery.py 2008-12-17 21:15:30 UTC (rev 6654) @@ -1,91 +0,0 @@ -# generate a thumbnail gallery of examples -template = """\ -{%% extends "layout.html" %%} -{%% set title = "Thumbnail gallery" %%} - - -{%% block body %%} - -<h3>Click on any image to see full size image and source code</h3> -<br/> - -%s -{%% endblock %%} -""" - -import os, glob, re - -multiimage = re.compile('(.*)_\d\d') - -pwd = os.getcwd() -os.chdir('..') - -rootdir = '_static/plot_directive/mpl_examples' - -# images we want to skip for the gallery because they are an unusual -# size that doesn't layout well in a table, or because they may be -# redundant with other images or uninteresting -skips = set([ - 'mathtext_examples', - 'matshow_02', - 'matshow_03', - 'matplotlib_icon', - ]) -data = [] -for subdir in ('api', 'pylab_examples', 'widgets'): - thisdir = os.path.join(rootdir,subdir) - if not os.path.exists(thisdir): - raise RuntimeError('Cannot find %s'%thisdir) - thumbdir = os.path.join(thisdir, 'thumbnails') - if not os.path.exists(thumbdir): - raise RuntimeError('Cannot find thumbnail dir %s'%thumbdir) - #print thumbdir - - # we search for pdfs here because there is one pdf for each - # successful image build (2 pngs since one is high res) and the - # mapping between py files and images is 1->many - for pdffile in sorted(glob.glob(os.path.join(thisdir, '*.pdf'))): - basepath, filename = os.path.split(pdffile) - basename, ext = os.path.splitext(filename) - print 'generating', subdir, basename - - if basename in skips: - print ' skipping', basename - continue - pngfile = os.path.join(thisdir, '%s.png'%basename) - thumbfile = os.path.join(thumbdir, '%s.png'%basename) - if not os.path.exists(pngfile): - pngfile = None - if not os.path.exists(thumbfile): - thumbfile = None - - m = multiimage.match(basename) - if m is None: - pyfile = '%s.py'%basename - else: - basename = m.group(1) - pyfile = '%s.py'%basename - - print ' ', pyfile, filename, basename, ext - - print ' ', pyfile, pngfile, thumbfile - data.append((subdir, thisdir, pyfile, basename, pngfile, thumbfile)) - -link_template = """\ -<a href="%s"><img src="%s" border="0" alt="%s"/></a> -""" - - -rows = [] -for (subdir, thisdir, pyfile, basename, pngfile, thumbfile) in data: - if thumbfile is not None: - link = 'examples/%s/%s.html'%(subdir, basename) - rows.append(link_template%(link, thumbfile, basename)) - - - -os.chdir(pwd) -fh = file('gallery.html', 'w') -fh.write(template%'\n'.join(rows)) -fh.close() - Modified: trunk/matplotlib/doc/conf.py =================================================================== --- trunk/matplotlib/doc/conf.py 2008-12-17 19:06:30 UTC (rev 6653) +++ trunk/matplotlib/doc/conf.py 2008-12-17 21:15:30 UTC (rev 6654) @@ -28,7 +28,8 @@ # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['mathmpl', 'math_symbol_table', 'sphinx.ext.autodoc', - 'only_directives', 'plot_directive', 'inheritance_diagram'] + 'only_directives', 'plot_directive', 'inheritance_diagram', + 'gen_gallery'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -75,7 +76,11 @@ # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' +# Plot directive configuration +# ---------------------------- +plot_formats = ['png', 'hires.png', 'pdf'] + # Options for HTML output # ----------------------- Modified: trunk/matplotlib/doc/make.py =================================================================== --- trunk/matplotlib/doc/make.py 2008-12-17 19:06:30 UTC (rev 6653) +++ trunk/matplotlib/doc/make.py 2008-12-17 21:15:30 UTC (rev 6654) @@ -32,18 +32,17 @@ os.system('cd examples; svn-clean; python gen_rst.py') #pass -def gallery(): - 'make the thumbnail gallery' - os.system('cd _templates; python gen_gallery.py') - - def html(): check_build() if not os.path.exists('examples/index.rst'): examples() shutil.copy('../lib/matplotlib/mpl-data/matplotlibrc', '_static/matplotlibrc') #figs() - if os.system('sphinx-build -b html -d build/doctrees . build/html'): + if small_docs: + options = "-D plot_formats=\"['png']\"" + else: + options = '' + if os.system('sphinx-build %s -b html -d build/doctrees . build/html' % options): raise SystemExit("Building HTML failed.") figures_dest_path = 'build/html/pyplots' @@ -51,10 +50,6 @@ shutil.rmtree(figures_dest_path) shutil.copytree('pyplots', figures_dest_path) - # rebuild the gallery - gallery() - print 'Just rebuilt gallery, you may need to make html again' - def latex(): check_build() #figs() @@ -96,12 +91,16 @@ 'sf' : sf, 'sfpdf' : sfpdf, 'examples' : examples, - 'gallery' : gallery, 'all' : all, } if len(sys.argv)>1: + if '--small' in sys.argv[1:]: + small_docs = True + sys.argv.remove('--small') + else: + small_docs = False for arg in sys.argv[1:]: func = funcd.get(arg) if func is None: Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652 Copied: trunk/matplotlib/doc/sphinxext/gen_gallery.py (from rev 6652, branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py) =================================================================== --- trunk/matplotlib/doc/sphinxext/gen_gallery.py (rev 0) +++ trunk/matplotlib/doc/sphinxext/gen_gallery.py 2008-12-17 21:15:30 UTC (rev 6654) @@ -0,0 +1,99 @@ +# generate a thumbnail gallery of examples +template = """\ +{%% extends "layout.html" %%} +{%% set title = "Thumbnail gallery" %%} + + +{%% block body %%} + +<h3>Click on any image to see full size image and source code</h3> +<br/> + +%s +{%% endblock %%} +""" + +import os, glob, re, sys, warnings +import matplotlib.image as image + +multiimage = re.compile('(.*)_\d\d') + +def gen_gallery(app, doctree): + if app.builder.name != 'html': + return + + outdir = app.builder.outdir + rootdir = 'plot_directive/mpl_examples' + + # images we want to skip for the gallery because they are an unusual + # size that doesn't layout well in a table, or because they may be + # redundant with other images or uninteresting + skips = set([ + 'mathtext_examples', + 'matshow_02', + 'matshow_03', + 'matplotlib_icon', + ]) + + print + print "generating gallery: ", + data = [] + for subdir in ('api', 'pylab_examples', 'widgets'): + origdir = os.path.join('build', rootdir, subdir) + thumbdir = os.path.join(outdir, rootdir, subdir, 'thumbnails') + if not os.path.exists(thumbdir): + os.makedirs(thumbdir) + print subdir, + + for filename in sorted(glob.glob(os.path.join(origdir, '*.png'))): + if filename.endswith("hires.png"): + continue + + path, filename = os.path.split(filename) + basename, ext = os.path.splitext(filename) + if basename in skips: + sys.stdout.write('[skipping %s]' % basename) + sys.stdout.flush() + continue + + # Create thumbnails based on images in tmpdir, and place + # them within the build tree + image.thumbnail( + str(os.path.join(origdir, filename)), + str(os.path.join(thumbdir, filename)), + scale=0.3) + + m = multiimage.match(basename) + if m is None: + pyfile = '%s.py'%basename + else: + basename = m.group(1) + pyfile = '%s.py'%basename + + data.append((subdir, basename, + os.path.join(rootdir, subdir, 'thumbnails', filename))) + + sys.stdout.write(".") + sys.stdout.flush() + print + + link_template = """\ + <a href="%s"><img src="%s" border="0" alt="%s"/></a> + """ + + if len(data) == 0: + warnings.warn("No thumbnails were found") + + rows = [] + for (subdir, basename, thumbfile) in data: + if thumbfile is not None: + link = 'examples/%s/%s.html'%(subdir, basename) + rows.append(link_template%(link, thumbfile, basename)) + + fh = file(os.path.join(app.builder.srcdir, '_templates', 'gallery.html'), + 'w') + fh.write(template%'\n'.join(rows)) + fh.close() + +def setup(app): + app.connect('env-updated', gen_gallery) Modified: trunk/matplotlib/doc/sphinxext/inheritance_diagram.py =================================================================== --- trunk/matplotlib/doc/sphinxext/inheritance_diagram.py 2008-12-17 19:06:30 UTC (rev 6653) +++ trunk/matplotlib/doc/sphinxext/inheritance_diagram.py 2008-12-17 21:15:30 UTC (rev 6654) @@ -272,12 +272,16 @@ """ pass -def inheritance_diagram_directive_run(class_names, options, state): +def inheritance_diagram_directive(name, arguments, options, content, lineno, + content_offset, block_text, state, + state_machine): """ Run when the inheritance_diagram directive is first encountered. """ node = inheritance_diagram() + class_names = arguments + # Create a graph starting with the list of classes graph = InheritanceGraph(class_names) @@ -310,16 +314,13 @@ graph_hash = get_graph_hash(node) name = "inheritance%s" % graph_hash - png_path = os.path.join('_static', name + ".png") + path = '_images' + dest_path = os.path.join(setup.app.builder.outdir, path) + if not os.path.exists(dest_path): + os.makedirs(dest_path) + png_path = os.path.join(dest_path, name + ".png") + path = setup.app.builder.imgpath - path = '_static' - source = self.document.attributes['source'] - count = source.split('/doc/')[-1].count('/'... [truncated message content] |
From: <lee...@us...> - 2008-12-18 09:02:15
|
Revision: 6659 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6659&view=rev Author: leejjoon Date: 2008-12-18 09:02:11 +0000 (Thu, 18 Dec 2008) Log Message: ----------- Merged revisions 6658 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6658 | leejjoon | 2008-12-18 03:55:50 -0500 (Thu, 18 Dec 2008) | 1 line fix dpi-dependent behavior of text bbox & annotate arrow ........ Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/text.py Property Changed: ---------------- trunk/matplotlib/ Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6653 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6658 Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-12-18 08:55:50 UTC (rev 6658) +++ trunk/matplotlib/CHANGELOG 2008-12-18 09:02:11 UTC (rev 6659) @@ -1,3 +1,6 @@ +2008-12-17 fix dpi-dependent behavior of text bbox and arrow in annotate + -JJL + 2008-12-17 Add group id support in artist. Two examples which demostrate svg filter are added. -JJL Modified: trunk/matplotlib/lib/matplotlib/text.py =================================================================== --- trunk/matplotlib/lib/matplotlib/text.py 2008-12-18 08:55:50 UTC (rev 6658) +++ trunk/matplotlib/lib/matplotlib/text.py 2008-12-18 09:02:11 UTC (rev 6659) @@ -367,7 +367,8 @@ def update_bbox_position_size(self, renderer): - """ Update the location and the size of the bbox. This method + """ + Update the location and the size of the bbox. This method should be used when the position and size of the bbox needs to be updated before actually drawing the bbox. """ @@ -395,8 +396,8 @@ tr = mtransforms.Affine2D().rotate(theta) tr = tr.translate(posx+x_box, posy+y_box) self._bbox_patch.set_transform(tr) - fontsize = renderer.points_to_pixels(self.get_size()) - self._bbox_patch.set_mutation_scale(fontsize) + fontsize_in_pixel = renderer.points_to_pixels(self.get_size()) + self._bbox_patch.set_mutation_scale(fontsize_in_pixel) #self._bbox_patch.draw(renderer) else: @@ -434,7 +435,8 @@ tr = mtransforms.Affine2D().rotate(theta) tr = tr.translate(posx+x_box, posy+y_box) self._bbox_patch.set_transform(tr) - self._bbox_patch.set_mutation_scale(self.get_size()) + fontsize_in_pixel = renderer.points_to_pixels(self.get_size()) + self._bbox_patch.set_mutation_scale(fontsize_in_pixel) self._bbox_patch.draw(renderer) @@ -1563,6 +1565,7 @@ self.arrow_patch.set_positions((ox0, oy0), (ox1,oy1)) mutation_scale = d.pop("mutation_scale", self.get_size()) + mutation_scale = renderer.points_to_pixels(mutation_scale) self.arrow_patch.set_mutation_scale(mutation_scale) if self._bbox_patch: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-12-18 13:47:23
|
Revision: 6663 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6663&view=rev Author: mdboom Date: 2008-12-18 13:47:19 +0000 (Thu, 18 Dec 2008) Log Message: ----------- Merged revisions 6660-6662 via svnmerge from https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6660 | jdh2358 | 2008-12-18 07:10:51 -0500 (Thu, 18 Dec 2008) | 1 line applied maxosx backend update ........ r6661 | mdboom | 2008-12-18 08:41:35 -0500 (Thu, 18 Dec 2008) | 2 lines Fix bug where a line with NULL data limits prevents subsequent data limits from calculating correctly ........ r6662 | mdboom | 2008-12-18 08:42:13 -0500 (Thu, 18 Dec 2008) | 2 lines Fix docstring typo. ........ Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/doc/_templates/index.html trunk/matplotlib/doc/api/font_manager_api.rst trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py trunk/matplotlib/src/_macosx.m trunk/matplotlib/src/_path.cpp Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README trunk/matplotlib/doc/sphinxext/gen_gallery.py Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6658 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6662 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662 Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-12-18 13:42:13 UTC (rev 6662) +++ trunk/matplotlib/CHANGELOG 2008-12-18 13:47:19 UTC (rev 6663) @@ -1,3 +1,11 @@ +2008-12-18 Fix bug where a line with NULL data limits prevents + subsequent data limits from calculating correctly - MGD + +2008-12-17 Major documentation generator changes - MGD + +2008-12-17 Applied macosx backend patch with support for path + collections, quadmesh, etc... - JDH + 2008-12-17 fix dpi-dependent behavior of text bbox and arrow in annotate -JJL Modified: trunk/matplotlib/doc/_templates/index.html =================================================================== --- trunk/matplotlib/doc/_templates/index.html 2008-12-18 13:42:13 UTC (rev 6662) +++ trunk/matplotlib/doc/_templates/index.html 2008-12-18 13:47:19 UTC (rev 6663) @@ -1,5 +1,5 @@ {% extends "layout.html" %} -{% set title = 'Overview' %} +{% set title = 'matplotlib: python plotting' %} {% block body %} Modified: trunk/matplotlib/doc/api/font_manager_api.rst =================================================================== --- trunk/matplotlib/doc/api/font_manager_api.rst 2008-12-18 13:42:13 UTC (rev 6662) +++ trunk/matplotlib/doc/api/font_manager_api.rst 2008-12-18 13:47:19 UTC (rev 6663) @@ -11,7 +11,7 @@ :show-inheritance: :mod:`matplotlib.fontconfig_pattern` -======================================== +==================================== .. automodule:: matplotlib.fontconfig_pattern :members: Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662 Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 + /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662 Modified: trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py 2008-12-18 13:42:13 UTC (rev 6662) +++ trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py 2008-12-18 13:47:19 UTC (rev 6663) @@ -10,6 +10,7 @@ from matplotlib.figure import Figure from matplotlib.path import Path from matplotlib.mathtext import MathTextParser +from matplotlib.colors import colorConverter @@ -48,34 +49,47 @@ self.width, self.height = width, height def draw_path(self, gc, path, transform, rgbFace=None): - path = transform.transform_path(path) - for points, code in path.iter_segments(): - if code == Path.MOVETO: - gc.moveto(points) - elif code == Path.LINETO: - gc.lineto(points) - elif code == Path.CURVE3: - gc.curve3(points) - elif code == Path.CURVE4: - gc.curve4(points) - elif code == Path.CLOSEPOLY: - gc.closepoly() if rgbFace is not None: rgbFace = tuple(rgbFace) - gc.stroke(rgbFace) + if gc!=self.gc: + n = self.gc.level() - gc.level() + for i in range(n): self.gc.restore() + self.gc = gc + gc.draw_path(path, transform, rgbFace) + def draw_markers(self, gc, marker_path, marker_trans, path, trans, rgbFace=None): + if rgbFace is not None: + rgbFace = tuple(rgbFace) + if gc!=self.gc: + n = self.gc.level() - gc.level() + for i in range(n): self.gc.restore() + self.gc = gc + gc.draw_markers(marker_path, marker_trans, path, trans, rgbFace) + + def draw_path_collection(self, *args): + gc = self.gc + args = args[:13] + gc.draw_path_collection(*args) + + def draw_quad_mesh(self, *args): + gc = self.gc + gc.draw_quad_mesh(*args) + def new_gc(self): self.gc.reset() return self.gc def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None): - self.gc.set_clip_rectangle(bbox) im.flipud_out() nrows, ncols, data = im.as_rgba_str() - self.gc.draw_image(x, y, nrows, ncols, data) + self.gc.draw_image(x, y, nrows, ncols, data, bbox, clippath, clippath_trans) im.flipud_out() def draw_tex(self, gc, x, y, s, prop, angle): + if gc!=self.gc: + n = self.gc.level() - gc.level() + for i in range(n): self.gc.restore() + self.gc = gc # todo, handle props, angle, origins size = prop.get_size_in_points() texmanager = self.get_texmanager() @@ -88,12 +102,20 @@ gc.draw_mathtext(x, y, angle, Z) def _draw_mathtext(self, gc, x, y, s, prop, angle): + if gc!=self.gc: + n = self.gc.level() - gc.level() + for i in range(n): self.gc.restore() + self.gc = gc size = prop.get_size_in_points() ox, oy, width, height, descent, image, used_characters = \ self.mathtext_parser.parse(s, self.dpi, prop) gc.draw_mathtext(x, y, angle, 255 - image.as_array()) def draw_text(self, gc, x, y, s, prop, angle, ismath=False): + if gc!=self.gc: + n = self.gc.level() - gc.level() + for i in range(n): self.gc.restore() + self.gc = gc if ismath: self._draw_mathtext(gc, x, y, s, prop, angle) else: @@ -143,6 +165,11 @@ GraphicsContextBase.__init__(self) _macosx.GraphicsContext.__init__(self) + def set_foreground(self, fg, isRGB=False): + if not isRGB: + fg = colorConverter.to_rgb(fg) + _macosx.GraphicsContext.set_foreground(self, fg) + def set_clip_rectangle(self, box): GraphicsContextBase.set_clip_rectangle(self, box) if not box: return @@ -152,20 +179,8 @@ GraphicsContextBase.set_clip_path(self, path) if not path: return path = path.get_fully_transformed_path() - for points, code in path.iter_segments(): - if code == Path.MOVETO: - self.moveto(points) - elif code == Path.LINETO: - self.lineto(points) - elif code == Path.CURVE3: - self.curve3(points) - elif code == Path.CURVE4: - self.curve4(points) - elif code == Path.CLOSEPOLY: - self.closepoly() - self.clip_path() + _macosx.GraphicsContext.set_clip_path(self, path) - ######################################################################## # # The following functions and classes are for pylab and implement Modified: trunk/matplotlib/src/_macosx.m =================================================================== --- trunk/matplotlib/src/_macosx.m 2008-12-18 13:42:13 UTC (rev 6662) +++ trunk/matplotlib/src/_macosx.m 2008-12-18 13:47:19 UTC (rev 6663) @@ -4,15 +4,33 @@ #include <Python.h> #include "numpy/arrayobject.h" -static int nwin = 0; +static int nwin = 0; /* The number of open windows */ +static int ngc = 0; /* The number of graphics contexts in use */ -/* Varius NSApplicationDefined event subtypes */ +/* For drawing Unicode strings with ATSUI */ +static ATSUStyle style = NULL; +static ATSUTextLayout layout = NULL; + +/* CGFloat was defined in Mac OS X 10.5 */ +#ifndef CGFloat +#define CGFloat float +#endif + + +/* Various NSApplicationDefined event subtypes */ #define STDIN_READY 0 #define SIGINT_CALLED 1 #define STOP_EVENT_LOOP 2 #define WINDOW_CLOSING 3 +/* Path definitions */ +#define STOP 0 +#define MOVETO 1 +#define LINETO 2 +#define CURVE3 3 +#define CURVE4 4 +#define CLOSEPOLY 5 /* -------------------------- Helper function ---------------------------- */ static void stdin_ready(CFReadStreamRef readStream, CFStreamEventType eventType, void* context) @@ -147,8 +165,44 @@ return 1; } -static char show__doc__[] = "Show all the figures and enter the main loop.\nThis function does not return until all Matplotlib windows are closed,\nand is normally not needed in interactive sessions."; +static int _init_atsui(void) +{ + OSStatus status; + status = ATSUCreateStyle(&style); + if (status!=noErr) + { + PyErr_SetString(PyExc_RuntimeError, "ATSUCreateStyle failed"); + return 0; + } + + status = ATSUCreateTextLayout(&layout); + if (status!=noErr) + { + status = ATSUDisposeStyle(style); + if (status!=noErr) + PyErr_WarnEx(PyExc_RuntimeWarning, "ATSUDisposeStyle failed", 1); + PyErr_SetString(PyExc_RuntimeError, "ATSUCreateTextLayout failed"); + return 0; + } + + + return 1; +} + +static void _dealloc_atsui(void) +{ + OSStatus status; + + status = ATSUDisposeStyle(style); + if (status!=noErr) + PyErr_WarnEx(PyExc_RuntimeWarning, "ATSUDisposeStyle failed", 1); + + status = ATSUDisposeTextLayout(layout); + if (status!=noErr) + PyErr_WarnEx(PyExc_RuntimeWarning, "ATSUDisposeTextLayout failed", 1); +} + /* ---------------------------- Cocoa classes ---------------------------- */ @@ -220,76 +274,38 @@ typedef struct { PyObject_HEAD CGContextRef cr; - PyObject* converter; /* Convert color specifications to r,g,b triples */ CGPatternRef pattern; /* For drawing hatches */ - ATSUStyle style; /* For drawing Unicode strings with ATSUI */ - ATSUTextLayout layout; /* For drawing Unicode strings with ATSUI */ } GraphicsContext; static PyObject* GraphicsContext_new(PyTypeObject* type, PyObject *args, PyObject *kwds) { - OSStatus status; - GraphicsContext* self = (GraphicsContext*)type->tp_alloc(type, 0); if (!self) return NULL; self->cr = NULL; - PyObject* module = PyImport_AddModule("matplotlib.colors"); - if (!module) return NULL; - PyObject* dict = PyObject_GetAttrString(module, "__dict__"); - if (!dict) return NULL; - PyObject* colorConverter = PyDict_GetItemString(dict, "colorConverter"); - Py_DECREF(dict); - if (!colorConverter) - { - PyErr_SetString(PyExc_KeyError, - "failed to find colorConverter in matplotlib.colors"); - return NULL; - } - self->converter = PyObject_GetAttrString(colorConverter, "to_rgb"); - if (!self->converter) return NULL; - self->pattern = NULL; - status = ATSUCreateStyle(&self->style); - if (status!=noErr) + if (ngc==0) { - Py_DECREF(self->converter); - PyErr_SetString(PyExc_RuntimeError, "ATSUCreateStyle failed"); - return NULL; + int ok = _init_atsui(); + if (!ok) + { + return NULL; + } } + ngc++; - status = ATSUCreateTextLayout(&self->layout); - if (status!=noErr) - { - Py_DECREF(self->converter); - status = ATSUDisposeStyle(self->style); - if (status!=noErr) - PyErr_WarnEx(PyExc_RuntimeWarning, "ATSUDisposeStyle failed", 1); - PyErr_SetString(PyExc_RuntimeError, "ATSUCreateTextLayout failed"); - return NULL; - } - return (PyObject*) self; } static void GraphicsContext_dealloc(GraphicsContext *self) { - Py_DECREF(self->converter); + CGPatternRelease(self->pattern); - if (self->pattern) CGPatternRelease(self->pattern); + ngc--; + if (ngc==0) _dealloc_atsui(); - OSStatus status; - - status = ATSUDisposeStyle(self->style); - if (status!=noErr) - PyErr_WarnEx(PyExc_RuntimeWarning, "ATSUDisposeStyle failed", 1); - - status = ATSUDisposeTextLayout(self->layout); - if (status!=noErr) - PyErr_WarnEx(PyExc_RuntimeWarning, "ATSUDisposeTextLayout failed", 1); - self->ob_type->tp_free((PyObject*)self); } @@ -308,6 +324,13 @@ PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); return NULL; } + + if (self->pattern) + { + CGPatternRelease(self->pattern); + self->pattern = NULL; + } + CGContextRestoreGState(cr); CGContextSaveGState(cr); Py_INCREF(Py_None); @@ -400,7 +423,7 @@ } static PyObject* -GraphicsContext_clip_path (GraphicsContext* self) +GraphicsContext_set_clip_path (GraphicsContext* self, PyObject* args) { CGContextRef cr = self->cr; if (!cr) @@ -408,29 +431,216 @@ PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); return NULL; } - CGContextRestoreGState(cr); - CGContextSaveGState(cr); - CGContextClip(cr); - Py_INCREF(Py_None); - return Py_None; -} +#ifdef BUH + CGContextRestoreGState(cr); /* FIXME */ + CGContextSaveGState(cr); /* FIXME */ +#endif -static PyObject* -GraphicsContext_set_dashes (GraphicsContext* self, PyObject* args) -{ - float phase = 0.0; - PyObject* offset; - PyObject* dashes; + PyObject* path; - if (!PyArg_ParseTuple(args, "OO", &offset, &dashes)) return NULL; + if(!PyArg_ParseTuple(args, "O", &path)) return NULL; - CGContextRef cr = self->cr; - if (!cr) + PyObject* vertices = PyObject_GetAttrString(path, "vertices"); + if (vertices==NULL) { - PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); + PyErr_SetString(PyExc_AttributeError, "path has no vertices"); return NULL; } + Py_DECREF(vertices); /* Don't keep a reference here */ + PyObject* codes = PyObject_GetAttrString(path, "codes"); + if (codes==NULL) + { + PyErr_SetString(PyExc_AttributeError, "path has no codes"); + return NULL; + } + Py_DECREF(codes); /* Don't keep a reference here */ + + PyArrayObject* coordinates; + coordinates = (PyArrayObject*)PyArray_FromObject(vertices, + NPY_DOUBLE, 2, 2); + if (!coordinates) + { + PyErr_SetString(PyExc_ValueError, "failed to convert vertices array"); + return NULL; + } + + if (PyArray_NDIM(coordinates) != 2 || PyArray_DIM(coordinates, 1) != 2) + { + Py_DECREF(coordinates); + PyErr_SetString(PyExc_ValueError, "invalid vertices array"); + return NULL; + } + + npy_intp n = PyArray_DIM(coordinates, 0); + + if (n==0) /* Nothing to do here */ + { + Py_DECREF(coordinates); + return NULL; + } + + PyArrayObject* codelist = NULL; + if (codes != Py_None) + { + codelist = (PyArrayObject*)PyArray_FromObject(codes, + NPY_UINT8, 1, 1); + if (!codelist) + { + Py_DECREF(coordinates); + PyErr_SetString(PyExc_ValueError, "invalid codes array"); + return NULL; + } + } + + CGFloat x, y; + + if (codelist==NULL) + { + npy_intp i; + npy_uint8 code = MOVETO; + for (i = 0; i < n; i++) + { + x = (CGFloat)(*(double*)PyArray_GETPTR2(coordinates, i, 0)); + y = (CGFloat)(*(double*)PyArray_GETPTR2(coordinates, i, 1)); + if (isnan(x) || isnan(y)) + { + code = MOVETO; + } + else + { + switch (code) + { + case MOVETO: + CGContextMoveToPoint(cr, x, y); + break; + case LINETO: + CGContextAddLineToPoint(cr, x, y); + break; + } + code = LINETO; + } + } + } + else + { + npy_intp i = 0; + BOOL was_nan = false; + npy_uint8 code; + CGFloat x1, y1, x2, y2, x3, y3; + while (i < n) + { + code = *(npy_uint8*)PyArray_GETPTR1(codelist, i); + if (code == CLOSEPOLY) + { + CGContextClosePath(cr); + i++; + } + else if (code == STOP) + { + break; + } + else if (was_nan) + { + if (code==CURVE3) i++; + else if (code==CURVE4) i+=2; + x1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 0)); + y1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 1)); + i++; + if (isnan(x1) || isnan(y1)) + { + was_nan = true; + } + else + { + CGContextMoveToPoint(cr, x1, y1); + was_nan = false; + } + } + else if (code==MOVETO) + { + x1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 0)); + y1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 1)); + i++; + if (isnan(x1) || isnan(y1)) + { + was_nan = true; + } + else + { + CGContextMoveToPoint(cr, x1, y1); + was_nan = false; + } + } + else if (code==LINETO) + { + x1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 0)); + y1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 1)); + i++; + if (isnan(x1) || isnan(y1)) + { + was_nan = true; + } + else + { + CGContextAddLineToPoint(cr, x1, y1); + was_nan = false; + } + } + else if (code==CURVE3) + { + x1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 0)); + y1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 1)); + i++; + x2 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 0)); + y2 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 1)); + i++; + if (isnan(x1) || isnan(y1) || isnan(x2) || isnan(y2)) + { + was_nan = true; + } + else + { + CGContextAddQuadCurveToPoint(cr, x1, y1, x2, y2); + was_nan = false; + } + } + else if (code==CURVE4) + { + x1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 0)); + y1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 1)); + i++; + x2 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 0)); + y2 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 1)); + i++; + x3 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 0)); + y3 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 1)); + i++; + if (isnan(x1) || isnan(y1) || isnan(x2) || isnan(y2) || isnan(x3) || isnan(y3)) + { + was_nan = true; + } + else + { + CGContextAddCurveToPoint(cr, x1, y1, x2, y2, x3, y3); + was_nan = false; + } + } + } + Py_DECREF(codelist); + } + + Py_DECREF(coordinates); + + CGContextClip(cr); + Py_INCREF(Py_None); + return Py_None; +} + +static BOOL +_set_dashes(CGContextRef cr, PyObject* offset, PyObject* dashes) +{ + float phase = 0.0; if (offset!=Py_None) { if (PyFloat_Check(offset)) phase = PyFloat_AsDouble(offset); @@ -439,7 +649,7 @@ { PyErr_SetString(PyExc_TypeError, "offset should be a floating point value"); - return NULL; + return false; } } @@ -451,7 +661,7 @@ { PyErr_SetString(PyExc_TypeError, "dashes should be a tuple or a list"); - return NULL; + return false; } int n = PyTuple_GET_SIZE(dashes); int i; @@ -460,7 +670,7 @@ { PyErr_SetString(PyExc_MemoryError, "Failed to store dashes"); Py_DECREF(dashes); - return NULL; + return false; } for (i = 0; i < n; i++) { @@ -476,7 +686,7 @@ { free(lengths); PyErr_SetString(PyExc_TypeError, "Failed to read dashes"); - return NULL; + return false; } CGContextSetLineDash(cr, phase, lengths, n); free(lengths); @@ -484,29 +694,40 @@ else CGContextSetLineDash(cr, phase, NULL, 0); - Py_INCREF(Py_None); - return Py_None; + return true; } static PyObject* -GraphicsContext_set_foreground(GraphicsContext* self, PyObject* args, PyObject* keywords) -{ float r, g, b; - PyObject* fg; - int isRGB = 0; - static char* kwlist[] = {"fg", "isRGB", NULL}; - if(!PyArg_ParseTupleAndKeywords(args, keywords, "O|i", kwlist, - &fg, &isRGB)) return NULL; - if (isRGB) +GraphicsContext_set_dashes (GraphicsContext* self, PyObject* args) +{ + PyObject* offset; + PyObject* dashes; + + if (!PyArg_ParseTuple(args, "OO", &offset, &dashes)) return NULL; + + CGContextRef cr = self->cr; + if (!cr) { - if(!PyArg_ParseTuple(fg, "fff", &r, &g, &b)) return NULL; + PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); + return NULL; } + + BOOL ok = _set_dashes(cr, offset, dashes); + if (ok) + { + Py_INCREF(Py_None); + return Py_None; + } else - { fg = PyObject_CallFunctionObjArgs(self->converter, fg, NULL); - if(!fg) return NULL; - if(!PyArg_ParseTuple(fg, "fff", &r, &g, &b)) return NULL; - Py_DECREF(fg); - } + return NULL; +} +static PyObject* +GraphicsContext_set_foreground(GraphicsContext* self, PyObject* args) +{ + float r, g, b; + if(!PyArg_ParseTuple(args, "(fff)", &r, &g, &b)) return NULL; + CGContextRef cr = self->cr; if (!cr) { @@ -538,7 +759,7 @@ return Py_None; } -static void drawHatch (void *info, CGContextRef cr) +static void _draw_hatch (void *info, CGContextRef cr) { int i; @@ -603,12 +824,20 @@ Py_DECREF(string); } +static void _release_hatch(void* info) +{ + PyObject* hatches = info; + Py_DECREF(hatches); +} + static PyObject* GraphicsContext_set_hatch(GraphicsContext* self, PyObject* args) { PyObject* hatches; const float size = 12.0; - static const CGPatternCallbacks callbacks = {0, &drawHatch, NULL}; + static const CGPatternCallbacks callbacks = {0, + &_draw_hatch, + &_release_hatch}; CGContextRef cr = self->cr; if (!cr) @@ -687,122 +916,828 @@ return Py_None; } -static PyObject* -GraphicsContext_moveto(GraphicsContext* self, PyObject* args) -{ - float x; - float y; - - if(!PyArg_ParseTuple(args, "(ff)", &x, &y)) return NULL; - - CGContextRef cr = self->cr; - if (!cr) +static int +_convert_affine_transform(PyObject* object, CGAffineTransform* transform) +/* Reads a Numpy affine transformation matrix and returns + * a CGAffineTransform. + */ +{ + PyArrayObject* matrix = NULL; + if (object==Py_None) { - PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); - return NULL; + PyErr_SetString(PyExc_ValueError, + "Found affine transformation matrix equal to None"); + return 0; } - CGContextMoveToPoint(cr, x, y); + matrix = (PyArrayObject*) PyArray_FromObject(object, NPY_DOUBLE, 2, 2); + if (!matrix) + { + PyErr_SetString(PyExc_ValueError, + "Invalid affine transformation matrix"); + return 0; + } + if (PyArray_NDIM(matrix) != 2 || PyArray_DIM(matrix, 0) != 3 || PyArray_DIM(matrix, 1) != 3) + { + Py_DECREF(matrix); + PyErr_SetString(PyExc_ValueError, + "Affine transformation matrix has invalid dimensions"); + return 0; + } - Py_INCREF(Py_None); - return Py_None; + size_t stride0 = (size_t)PyArray_STRIDE(matrix, 0); + size_t stride1 = (size_t)PyArray_STRIDE(matrix, 1); + char* row0 = PyArray_BYTES(matrix); + char* row1 = row0 + stride0; + + double a = *(double*)(row0); + row0 += stride1; + double c = *(double*)(row0); + row0 += stride1; + double e = *(double*)(row0); + double b = *(double*)(row1); + row1 += stride1; + double d = *(double*)(row1); + row1 += stride1; + double f = *(double*)(row1); + *transform = CGAffineTransformMake(a, b, c, d, e, f); + + Py_DECREF(matrix); + return 1; } -static PyObject* -GraphicsContext_lineto(GraphicsContext* self, PyObject* args) +static int +_draw_path(CGContextRef cr, PyObject* path, CGAffineTransform affine) { - float x; - float y; + CGPoint point; - if(!PyArg_ParseTuple(args, "(ff)", &x, &y)) return NULL; + PyObject* vertices = PyObject_GetAttrString(path, "vertices"); + if (vertices==NULL) + { + PyErr_SetString(PyExc_AttributeError, "path has no vertices"); + return -1; + } + Py_DECREF(vertices); /* Don't keep a reference here */ - CGContextRef cr = self->cr; - if (!cr) + PyObject* codes = PyObject_GetAttrString(path, "codes"); + if (codes==NULL) { - PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); - return NULL; + PyErr_SetString(PyExc_AttributeError, "path has no codes"); + return -1; } - CGContextAddLineToPoint(cr, x, y); + Py_DECREF(codes); /* Don't keep a reference here */ - Py_INCREF(Py_None); - return Py_None; + PyArrayObject* coordinates; + coordinates = (PyArrayObject*)PyArray_FromObject(vertices, + NPY_DOUBLE, 2, 2); + if (!coordinates) + { + PyErr_SetString(PyExc_ValueError, "failed to convert vertices array"); + return -1; + } + + if (PyArray_NDIM(coordinates) != 2 || PyArray_DIM(coordinates, 1) != 2) + { + Py_DECREF(coordinates); + PyErr_SetString(PyExc_ValueError, "invalid vertices array"); + return -1; + } + + npy_intp n = PyArray_DIM(coordinates, 0); + + if (n==0) /* Nothing to do here */ + { + Py_DECREF(coordinates); + return 0; + } + + PyArrayObject* codelist = NULL; + if (codes != Py_None) + { + codelist = (PyArrayObject*)PyArray_FromObject(codes, + NPY_UINT8, 1, 1); + if (!codelist) + { + Py_DECREF(coordinates); + PyErr_SetString(PyExc_ValueError, "invalid codes array"); + return -1; + } + } + + if (codelist==NULL) + { + npy_intp i; + npy_uint8 code = MOVETO; + for (i = 0; i < n; i++) + { + point.x = (CGFloat)(*(double*)PyArray_GETPTR2(coordinates, i, 0)); + point.y = (CGFloat)(*(double*)PyArray_GETPTR2(coordinates, i, 1)); + if (isnan(point.x) || isnan(point.y)) + { + code = MOVETO; + } + else + { + point = CGPointApplyAffineTransform(point, affine); + switch (code) + { + case MOVETO: + CGContextMoveToPoint(cr, point.x, point.y); + break; + case LINETO: + CGContextAddLineToPoint(cr, point.x, point.y); + break; + } + code = LINETO; + } + } + } + else + { + npy_intp i = 0; + BOOL was_nan = false; + npy_uint8 code; + CGFloat x1, y1, x2, y2, x3, y3; + while (i < n) + { + code = *(npy_uint8*)PyArray_GETPTR1(codelist, i); + if (code == CLOSEPOLY) + { + CGContextClosePath(cr); + i++; + } + else if (code == STOP) + { + break; + } + else if (was_nan) + { + if (code==CURVE3) i++; + else if (code==CURVE4) i+=2; + x1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 0)); + y1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 1)); + i++; + if (isnan(x1) || isnan(y1)) + { + was_nan = true; + } + else + { + point.x = x1; + point.y = y1; + point = CGPointApplyAffineTransform(point, affine); + CGContextMoveToPoint(cr, point.x, point.y); + was_nan = false; + } + } + else if (code==MOVETO) + { + x1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 0)); + y1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 1)); + i++; + if (isnan(x1) || isnan(y1)) + { + was_nan = true; + } + else + { + point.x = x1; + point.y = y1; + point = CGPointApplyAffineTransform(point, affine); + CGContextMoveToPoint(cr, point.x, point.y); + was_nan = false; + } + } + else if (code==LINETO) + { + x1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 0)); + y1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 1)); + i++; + if (isnan(x1) || isnan(y1)) + { + was_nan = true; + } + else + { + point.x = x1; + point.y = y1; + point = CGPointApplyAffineTransform(point, affine); + CGContextAddLineToPoint(cr, point.x, point.y); + was_nan = false; + } + } + else if (code==CURVE3) + { + x1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 0)); + y1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 1)); + i++; + x2 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 0)); + y2 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 1)); + i++; + if (isnan(x1) || isnan(y1) || isnan(x2) || isnan(y2)) + { + was_nan = true; + } + else + { + point.x = x1; + point.y = y1; + point = CGPointApplyAffineTransform(point, affine); + x1 = point.x; + y1 = point.y; + point.x = x2; + point.y = y2; + point = CGPointApplyAffineTransform(point, affine); + x2 = point.x; + y2 = point.y; + CGContextAddQuadCurveToPoint(cr, x1, y1, x2, y2); + was_nan = false; + } + } + else if (code==CURVE4) + { + x1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 0)); + y1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 1)); + i++; + x2 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 0)); + y2 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 1)); + i++; + x3 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 0)); + y3 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 1)); + i++; + if (isnan(x1) || isnan(y1) || isnan(x2) || isnan(y2) || isnan(x3) || isnan(y3)) + { + was_nan = true; + } + else + { + point.x = x1; + point.y = y1; + point = CGPointApplyAffineTransform(point, affine); + x1 = point.x; + y1 = point.y; + point.x = x2; + point.y = y2; + point = CGPointApplyAffineTransform(point, affine); + x2 = point.x; + y2 = point.y; + point.x = x3; + point.y = y3; + point = CGPointApplyAffineTransform(point, affine); + x3 = point.x; + y3 = point.y; + CGContextAddCurveToPoint(cr, x1, y1, x2, y2, x3, y3); + was_nan = false; + } + } + } + } + + Py_DECREF(coordinates); + Py_XDECREF(codelist); + return n; } static PyObject* -GraphicsContext_curve3(GraphicsContext* self, PyObject* args) -{ - float cpx; - float cpy; - float x; - float y; +GraphicsContext_draw_path (GraphicsContext* self, PyObject* args) +{ + PyObject* path; + PyObject* transform; + PyObject* rgbFace; + int ok; + CGContextRef cr = self->cr; + if (!cr) { PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); return NULL; } - if(!PyArg_ParseTuple(args, "(ffff)", &cpx, - &cpy, - &x, - &y)) return NULL; + if(!PyArg_ParseTuple(args, "OO|O", + &path, + &transform, + &rgbFace)) return NULL; - CGContextAddQuadCurveToPoint(cr, cpx, cpy, x, y); + if(rgbFace==Py_None) rgbFace = NULL; + CGAffineTransform affine; + ok = _convert_affine_transform(transform, &affine); + if (!ok) return NULL; + + int n = _draw_path(cr, path, affine); + if (n==-1) return NULL; + + if (n > 0) + { + if(rgbFace) + { + float r, g, b; + ok = PyArg_ParseTuple(rgbFace, "fff", &r, &g, &b); + if (!ok) + { + return NULL; + } + CGContextSaveGState(cr); + if(self->pattern) + { + float components[4]; + components[0] = r; + components[1] = g; + components[2] = b; + components[3] = 1.0; + CGContextSetFillPattern(cr, self->pattern, components); + CGPatternRelease(self->pattern); + self->pattern = nil; + } + else CGContextSetRGBFillColor(cr, r, g, b, 1.0); + CGContextDrawPath(cr, kCGPathFillStroke); + CGContextRestoreGState(cr); + } + else CGContextStrokePath(cr); + } + Py_INCREF(Py_None); return Py_None; } static PyObject* -GraphicsContext_curve4 (GraphicsContext* self, PyObject* args) +GraphicsContext_draw_markers (GraphicsContext* self, PyObject* args) { - float cp1x; - float cp1y; - float cp2x; - float cp2y; - float x; - float y; + PyObject* marker_path; + PyObject* marker_transform; + PyObject* path; + PyObject* transform; + PyObject* rgbFace; + int ok; + float r, g, b; + CGContextRef cr = self->cr; + if (!cr) { PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); return NULL; } - if(!PyArg_ParseTuple(args, "(ffffff)", &cp1x, - &cp1y, - &cp2x, - &cp2y, - &x, - &y)) return NULL; + if(!PyArg_ParseTuple(args, "OOOO|O", + &marker_path, + &marker_transform, + &path, + &transform, + &rgbFace)) return NULL; - CGContextAddCurveToPoint(cr, cp1x, cp1y, cp2x, cp2y, x, y); + if(rgbFace==Py_None) rgbFace = NULL; + if (rgbFace) + { + ok = PyArg_ParseTuple(rgbFace, "fff", &r, &g, &b); + if (!ok) + { + return NULL; + } + if(self->pattern) + { + float components[4]; + components[0] = r; + components[1] = g; + components[2] = b; + components[3] = 1.0; + CGContextSetFillPattern(cr, self->pattern, components); + CGPatternRelease(self->pattern); + self->pattern = nil; + } + else CGContextSetRGBFillColor(cr, r, g, b, 1.0); + } + + CGAffineTransform affine; + ok = _convert_affine_transform(transform, &affine); + if (!ok) return NULL; + + CGAffineTransform marker_affine; + ok = _convert_affine_transform(marker_transform, &marker_affine); + if (!ok) return NULL; + + PyObject* vertices = PyObject_GetAttrString(path, "vertices"); + if (vertices==NULL) + { + PyErr_SetString(PyExc_AttributeError, "path has no vertices"); + return NULL; + } + Py_DECREF(vertices); /* Don't keep a reference here */ + + PyArrayObject* coordinates; + coordinates = (PyArrayObject*)PyArray_FromObject(vertices, + NPY_DOUBLE, 2, 2); + if (!coordinates) + { + PyErr_SetString(PyExc_ValueError, "failed to convert vertices array"); + return NULL; + } + + if (PyArray_NDIM(coordinates) != 2 || PyArray_DIM(coordinates, 1) != 2) + { + Py_DECREF(coordinates); + PyErr_SetString(PyExc_ValueError, "invalid vertices array"); + return NULL; + } + + npy_intp i; + npy_intp n = PyArray_DIM(coordinates, 0); + CGPoint point; + CGAffineTransform t; + int m = 0; + for (i = 0; i < n; i++) + { + point.x = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 0)); + point.y = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 1)); + point = CGPointApplyAffineTransform(point, affine); + t = marker_affine; + t.tx += point.x; + t.ty += point.y; + m = _draw_path(cr, marker_path, t); + + if (m > 0) + { + if(rgbFace) CGContextDrawPath(cr, kCGPathFillStroke); + else CGContextStrokePath(cr); + } + } + + Py_DECREF(coordinates); + Py_INCREF(Py_None); return Py_None; } +static BOOL _clip(CGContextRef cr, PyObject* object) +{ + if (object == Py_None) return true; + + PyArrayObject* array = NULL; + array = (PyArrayObject*) PyArray_FromObject(object, PyArray_DOUBLE, 2, 2); + if (!array) + { + PyErr_SetString(PyExc_ValueError, "failed to read clipping bounding box"); + return false; + } + + if (PyArray_NDIM(array)!=2 || PyArray_DIM(array, 0)!=2 || PyArray_DIM(array, 1)!=2) + { + Py_DECREF(array); + PyErr_SetString(PyExc_ValueError, "clipping bounding box should be a 2x2 array"); + return false; + } + + const double l = *(double*)PyArray_GETPTR2(array, 0, 0); + const double b = *(double*)PyArray_GETPTR2(array, 0, 1); + const double r = *(double*)PyArray_GETPTR2(array, 1, 0); + const double t = *(double*)PyArray_GETPTR2(array, 1, 1); + + Py_DECREF(array); + + CGRect rect; + rect.origin.x = (CGFloat) l; + rect.origin.y = (CGFloat) b; + rect.size.width = (CGFloat) (r-l); + rect.size.height = (CGFloat) (t-b); + + CGContextClipToRect(cr, rect); + + return true; +} + + static PyObject* -GraphicsContext_closepoly (GraphicsContext* self) +GraphicsContext_draw_path_collection (GraphicsContext* self, PyObject* args) { + PyObject* master_transform_obj; + PyObject* cliprect; + PyObject* clippath; + PyObject* clippath_transform; + PyObject* paths; + PyObject* transforms_obj; + PyObject* offsets_obj; + PyObject* offset_transform_obj; + PyObject* facecolors_obj; + PyObject* edgecolors_obj; + PyObject* linewidths; + PyObject* linestyles; + PyObject* antialiaseds; + CGContextRef cr = self->cr; + if (!cr) { PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); return NULL; } - CGContextClosePath(cr); + if(!PyArg_ParseTuple(args, "OOOOOOOOOOOOO", &master_transform_obj, + &cliprect, + &clippath, + &clippath_transform, + &paths, + &transforms_obj, + &offsets_obj, + &offset_transform_obj, + &facecolors_obj, + &edgecolors_obj, + &linewidths, + &linestyles, + &antialiaseds)) + return NULL; + CGContextSaveGState(cr); + + CGAffineTransform transform; + CGAffineTransform master_transform; + CGAffineTransform offset_transform; + CGAffineTransform* transforms = NULL; + + if (!_convert_affine_transform(master_transform_obj, &master_transform)) return NULL; + if (!_convert_affine_transform(offset_transform_obj, &offset_transform)) return NULL; + + if (!_clip(cr, cliprect)) return NULL; + if (clippath!=Py_None) + { + if (!_convert_affine_transform(clippath_transform, &transform)) return NULL; + int n = _draw_path(cr, clippath, transform); + if (n==-1) return NULL; + else if (n > 0) CGContextClip(cr); + } + + PyArrayObject* offsets = NULL; + PyArrayObject* facecolors = NULL; + PyArrayObject* edgecolors = NULL; + + /* ------------------- Check offsets array ---------------------------- */ + + offsets = (PyArrayObject*)PyArray_FromObject(offsets_obj, NPY_DOUBLE, 0, 2); + if (!offsets || + (PyArray_NDIM(offsets)==2 && PyArray_DIM(offsets, 1)!=2) || + (PyArray_NDIM(offsets)==1 && PyArray_DIM(offsets, 0)!=0)) + { + PyErr_SetString(PyExc_ValueError, "Offsets array must be Nx2"); + goto error; + } + + /* ------------------- Check facecolors array ------------------------- */ + + facecolors = (PyArrayObject*)PyArray_FromObject(facecolors_obj, + NPY_DOUBLE, 1, 2); + if (!facecolors || + (PyArray_NDIM(facecolors)==1 && PyArray_DIM(facecolors, 0)!=0) || + (PyArray_NDIM(facecolors)==2 && PyArray_DIM(facecolors, 1)!=4)) + { + PyErr_SetString(PyExc_ValueError, "Facecolors must by a Nx4 numpy array or empty"); + goto error; + } + + /* ------------------- Check edgecolors array ------------------------- */ + + edgecolors = (PyArrayObject*)PyArray_FromObject(edgecolors_obj, + NPY_DOUBLE, 1, 2); + if (!edgecolors || + (PyArray_NDIM(edgecolors)==1 && PyArray_DIM(edgecolors, 0)!=0) || + (PyArray_NDIM(edgecolors)==2 && PyArray_DIM(edgecolors, 1)!=4)) + { + PyErr_SetString(PyExc_ValueError, "Edgecolors must by a Nx4 numpy array or empty"); + goto error; + } + + /* ------------------- Check the other arguments ---------------------- */ + + if (!PySequence_Check(paths)) + { + PyErr_SetString(PyExc_ValueError, "paths must be a sequence object"); + goto error; + } + if (!PySequence_Check(transforms_obj)) + { + PyErr_SetString(PyExc_ValueError, "transforms must be a sequence object"); + goto error; + } + if (!PySequence_Check(linewidths)) + { + PyErr_SetString(PyExc_ValueError, "linewidths must be a sequence object"); + goto error; + } + if (!PySequence_Check(linestyles)) + { + PyErr_SetString(PyExc_ValueError, "linestyles must be a sequence object"); + goto error; + } + if (!PySequence_Check(antialiaseds)) + { + PyErr_SetString(PyExc_ValueError, "antialiaseds must be a sequence object"); + goto error; + } + + size_t Npaths = (size_t) PySequence_Size(paths); + size_t Noffsets = (size_t) PyArray_DIM(offsets, 0); + size_t N = Npaths > Noffsets ? Npaths : Noffsets; + size_t Ntransforms = (size_t) PySequence_Size(transforms_obj); + size_t Nfacecolors = (size_t) PyArray_DIM(facecolors, 0); + size_t Nedgecolors = (size_t) PyArray_DIM(edgecolors, 0); + size_t Nlinewidths = (size_t) PySequence_Size(linewidths); + size_t Nlinestyles = (size_t) PySequence_Size(linestyles); + size_t Naa = (size_t) PySequence_Size(antialiaseds); + if (N < Ntransforms) Ntransforms = N; + if (N < Nlinestyles) Nlinestyles = N; + if ((Nfacecolors == 0 && Nedgecolors == 0) || Npaths == 0) + { + goto success; + } + + size_t i = 0; + + /* Convert all of the transforms up front */ + if (Ntransforms > 0) + { + transforms = malloc(Ntransforms*sizeof(CGAffineTransform)); + if (!transforms) goto error; + for (i = 0; i < Ntransforms; i++) + { + PyObject* transform_obj = PySequence_ITEM(transforms_obj, i); + if(!_convert_affine_transform(transform_obj, &transforms[i])) goto error; + transforms[i] = CGAffineTransformConcat(transforms[i], master_transform); + } + } + + CGPoint offset; + PyObject* path; + + /* Preset graphics context properties if possible */ + if (Naa==1) + { + switch(PyObject_IsTrue(PySequence_ITEM(antialiaseds, 0))) + { + case 1: CGContextSetShouldAntialias(cr, true); break; + case 0: CGContextSetShouldAntialias(cr, false); break; + case -1: + { + PyErr_SetString(PyExc_ValueError, + "Failed to read antialiaseds array"); + goto error; + } + } + } + + if (Nlinewidths==1) + { + double linewidth = PyFloat_AsDouble(PySequence_ITEM(linewidths, 0)); + CGContextSetLineWidth(cr, (CGFloat)linewidth); + } + else if (Nlinewidths==0) + CGContextSetLineWidth(cr, 0.0); + + if (Nlinestyles==1) + { + PyObject* offset; + PyObject* dashes; + PyObject* linestyle = PySequence_ITEM(linestyles, 0); + if (!PyArg_ParseTuple(linestyle, "OO", &offset, &dashes)) goto error; + if (!_set_dashes(cr, offset, dashes)) goto error; + } + + if (Nedgecolors==1) + { + const double r = *(double*)PyArray_GETPTR2(edgecolors, 0, 0); + const double g = *(double*)PyArray_GETPTR2(edgecolors, 0, 1); + const double b = *(double*)PyArray_GETPTR2(edgecolors, 0, 2); + const double a = *(double*)PyArray_GETPTR2(edgecolors, 0, 3); + CGContextSetRGBStrokeColor(cr, r, g, b, a); + } + + if (Nfacecolors==1) + { + const double r = *(double*)PyArray_GETPTR2(facecolors, 0, 0); + const double g = *(double*)PyArray_GETPTR2(facecolors, 0, 1); + const double b = *(double*)PyArray_GETPTR2(facecolors, 0, 2); + const double a = *(double*)PyArray_GETPTR2(facecolors, 0, 3); + CGContextSetRGBFillColor(cr, r, g, b, a); + } + + for (i = 0; i < N; i++) + { + + if (Ntransforms) + { + transform = transforms[i % Ntransforms]; + } + else + { + transform = master_transform; + } + + if (Noffsets) + { + offset.x = (CGFloat) (*(double*)PyArray_GETPTR2(offsets, i % Noffsets, 0)); + offset.y = (CGFloat) (*(double*)PyArray_GETPTR2(offsets, i % Noffsets, 1)); + offset = CGPointApplyAffineTransform(offset, offset_transform); + transform.tx += offset.x; + transform.ty += offset.y; + } + + if (Naa > 1) + { + switch(PyObject_IsTrue(PySequence_ITEM(antialiaseds, i % Naa))) + { + case 1: CGContextSetShouldAntialias(cr, true); break; + case 0: CGContextSetShouldAntialias(cr, false); break; + case -1: + { + PyErr_SetString(PyExc_ValueError, + "Failed to read antialiaseds array"); + goto error; + } + } + } + + path = PySequence_ITEM(paths, i % Npaths); + int n = _draw_path(cr, path, transform); + if (n==-1) goto error; + else if (n==0) continue; + + if (Nlinewidths > 1) + { + double linewidth = PyFloat_AsDouble(PySequence_ITEM(linewidths, i % Nlinewidths)); + CGContextSetLineWidth(cr, (CGFloat)linewidth); + } + + if (Nlinestyles > 1) + { + PyObject* offset; + PyObject* dashes; + PyObject* linestyle = PySequence_ITEM(linestyles, i % Nlinestyles); + if (!PyArg_ParseTuple(linestyle, "OO", &offset, &dashes)) goto error; + if (!_set_dashes(cr, offset, dashes)) goto error; + } + + if (Nedgecolors > 1) + { + npy_intp fi = i % Nedgecolors; + const double r = *(double*)PyArray_GETPTR2(edgecolors, fi, 0); + const double g = *(double*)PyArray_GETPTR2(edgecolors, fi, 1); + const double b = *(double*)PyArray_GETPTR2(edgecolors, fi, 2); + const double a = *(double*)PyArray_GETPTR2(edgecolors, fi, 3); + CGContextSetRGBStrokeColor(cr, r, g, b, a); + } + + if (Nfacecolors > 1) + { + npy_intp fi = i % Nfacecolors; + const double r = *(double*)PyArray_GETPTR2(facecolors, fi, 0); + const double g = *(double*)PyArray_GETPTR2(facecolors, fi, 1); + const double b = *(double*)PyArray_GETPTR2(facecolors, fi, 2); + const double a = *(double*)PyArray_GETPTR2(facecolors, fi, 3); + CGContextSetRGBFillColor(cr, r, g, b, a); + CGContextDrawPath(cr, kCGPathFillStroke); + } + else if (Nfacecolors==1) + CGContextDrawPath(cr, kCGPathFillStroke); + else + CGContextStrokePath(cr); + } + +success: + CGContextRestoreGState(cr); + if (transforms) free(transforms); + Py_DECREF(offsets); + Py_DECREF(facecolors); + Py_DECREF(edgecolors); + Py_INCREF(Py_None); return Py_None; + +error: + CGContextRestoreGState(cr); + if (transforms) free(transforms); + Py_XDECREF(offsets); + Py_XDECREF(facecolors); + Py_XDECREF(edgecolors); + + return NULL; } static PyObject* -GraphicsContext_stroke (GraphicsContext* self, PyObject* args) +GraphicsContext_draw_quad_mesh (GraphicsContext* self, PyObject* args) { - PyObject* color; + PyObject* master_transform_obj; + PyObject* cliprect; + PyObject* clippath; + PyObject* clippath_transform; + int meshWidth; + int meshHeight; + PyObject* vertices; + PyObject* offsets_obj; + PyObject* offset_transform_obj; + PyObject* facecolors_obj; + int antialiased; + int showedges; + CGContextRef cr = self->cr; if (!cr) @@ -811,35 +1746,219 @@ return NULL; } - if(!PyArg_ParseTuple(args, "O", &color)) return NULL; + if(!PyArg_ParseTuple(args, "OOOOiiOOOOii", + &master_transform_obj, + &cliprect, + &clippath, + &clippath_transform, + &meshWidth, + &meshHeight, + &vertices, + &offsets_obj, + &offset_transform_obj, + &facecolors_obj, + &antialiased, + &showedges)) return NULL; - if(color!=Py_None) + PyArrayObject* offsets = NULL; + PyArrayObject* facecolors = NULL; + + CGAffineTransform transform; + CGAffineTransform master_transform; + CGAffineTransform offset_transform; + + if (!_convert_affine_transform(master_transform_obj, &master_transform)) + return NULL; + if (!_convert_affine_transform(offset_transform_obj, &offset_transform)) + return NULL; + + /* clipping */ + + if (!_clip(cr, cliprect)) return NULL; + if (clippath!=Py_None) { - float r, g, b; - if(!PyArg_ParseTuple(color, "fff", &r, &g, &b)) return NULL; - if(self->pattern) + if (!_convert_affine_transform(clippath_transform, &transform)) + return NULL; + int n = _draw_path(cr, clippath, transform); + if (n==-1) return NULL; + else if (n > 0) CGContextClip(cr); + } + + PyArrayObject* coordinates; + coordinates = (PyArrayObject*)PyArray_FromObject(vertices, + NPY_DOUBLE, 3, 3); + if (!coordinates || + PyArray_NDIM(coordinates) != 3 || PyArray_DIM(coordinates, 2) != 2) + { + PyErr_SetString(PyExc_ValueError, "Invalid coordinates array"); + goto error; + } + + /* ------------------- Check offsets array ---------------------------- */ + + offsets = (PyArrayObject*)PyArray_FromObject(offsets_obj, NPY_DOUBLE, 0, 2); + if (!offsets || + (PyArray_NDIM(offsets)==2 && PyArray_DIM(offsets, 1)!=2) || + (PyArray_NDIM(offsets)==1 && PyArray_DIM(offsets, 0)!=0)) + { + PyErr_SetString(PyExc_ValueError, "Offsets array must be Nx2"); + goto error; + } + + /* ------------------- Check facecolors array ------------------------- */ + + facecolors = (PyArrayObject*)PyArray_FromObject(facecolors_obj, + NPY_DOUBLE, 1, 2); + if (!facecolors || + (PyArray_NDIM(facecolors)==1 && PyArray_DIM(facecolors, 0)!=0) || + (PyArray_NDIM(facecolors)==2 && PyArray_DIM(facecolors, 1)!=4)) + { + PyErr_SetString(PyExc_ValueError, "Facecolors must by a Nx4 numpy array or empty"); + goto error; + } + + /* ------------------- Check the other arguments ---------------------- */ + + size_t Noffsets = (size_t) PyArray_DIM(offsets, 0); + size_t Npaths = meshWidth * meshHeight; + size_t Nfacecolors = (size_t) PyArray_DIM(facecolors, 0); + if ((Nfacecolors == 0 && !showedges) || Npaths == 0) + { + /* Nothing to do here */ + goto success; + } + + size_t i = 0; + size_t iw = 0; + size_t ih = 0; + + CGPoint offset; + + /* Preset graphics context properties if possible */ + if (antialiased) CGContextSetShouldAntialias(cr, true); + else CGContextSetShouldAntialias(cr, false); + + CGContextSetLineWidth(cr, 0.0); + + if (Nfacecolors==1) + { + const double r = *(double*)PyArray_GETPTR2(facecolors, 0, 0); + const double g = *(double*)PyArray_GETPTR2(facecolors, 0, 1); + const double b = *(double*)PyArray_GETPTR2(facecolors, 0, 2); + const double a = *(double*)PyArray_GETPTR2(facecolors, 0, 3); + CGContextSetRGBFillColor(cr, r, g, b, a); + if (antialiased && !showedges) { - float components[4]; - components[0] = r; - components[1] = g; - components[2] = b; - components[3] = 1.0; - CGContextSetFillPattern(cr, self->pattern, components); - CGPatternRelease (self->pattern); - self->pattern = nil; + CGContextSetRGBStrokeColor(cr, r, g, b, a); } - else CGContextSetRGBFillColor(cr, r, g, b, 1.0); - CGContextDrawPath(cr, kCGPathFillStroke); } - else CGContextStrokePath(cr); + if (showedges) + { + CGContextSetRGBStrokeColor(cr, 0, 0, 0, 1); + } + + for (ih = 0; ih < meshHeight; ih++) + { + for (iw = 0; iw < meshWidth; iw++, i++) + { + + transform = master_transform; + + if (Noffsets) + { + offset.x = (CGFloat) (*(double*)PyArray_GETPTR2(offsets, i % Noffsets, 0)); + offset.y = (CGFloat) (*(double*)PyArray_GETPTR2(offsets, i % Noffsets, 1)); + offset = CGPointApplyAffineTransform(offset, offset_transform); + transform.tx += offset.x; + transform.ty += offset.y; + } + + CGPoint p; + CGPoint points[4]; + + p.x = (CGFloat)(*(double*)PyArray_GETPTR3(coordinates, ih, iw, 0)); + p.y = (CGFloat)(*(double*)PyArray_GETPTR3(coordinates, ih, iw, 1)); + if (isnan(p.x) || isnan(p.y)) continue; + points[0] = CGPointApplyAffineTransform(p, transform); + + p.x = (CGFloat)(*(double*)PyArray_GETPTR3(coordinates, ih, iw+1, 0)); + p.y = (CGFloat)(*(double*)PyArray_GETPTR3(coordinates, ih, iw+1, 1)); + if (isnan(p.x) || isnan(p.y)) continue; + points[1] = CGPointApplyAffineTransform(p, transform); + + p.x = (CGFloat)(*(double*)PyArray_GETPTR3(coordinates, ih+1, iw+1, 0)); + p.y = (CGFloat)(*(double*)PyArray_GETPTR3(coordinates, ih+1, iw+1, 1)); + if (isnan(p.x) || isnan(p.y)) continue; + points[2] = CGPointApplyAffineTransform(p, transform); + + p.x = (CGFloat)(*(double*)PyArray_GETPTR3(coordinates, ih+1, iw, 0)); + p.y = (CGFloat)(*(double*)PyArray_GETPTR3(coordinates, ih+1, iw, 1)); + if (isnan(p.x) || isnan(p.y)) continue; + points[3] = CGPointApplyAffineTransform(p, transf... [truncated message content] |
From: <lee...@us...> - 2008-12-18 15:38:43
|
Revision: 6664 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6664&view=rev Author: leejjoon Date: 2008-12-18 15:38:33 +0000 (Thu, 18 Dec 2008) Log Message: ----------- add new arrow style (a line + filled triangles) Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/examples/pylab_examples/fancyarrow_demo.py trunk/matplotlib/examples/pylab_examples/fancybox_demo2.py trunk/matplotlib/lib/matplotlib/bezier.py trunk/matplotlib/lib/matplotlib/patches.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-12-18 13:47:19 UTC (rev 6663) +++ trunk/matplotlib/CHANGELOG 2008-12-18 15:38:33 UTC (rev 6664) @@ -1,3 +1,5 @@ +2008-12-18 add new arrow style, a line + filled triangles. -JJL + 2008-12-18 Fix bug where a line with NULL data limits prevents subsequent data limits from calculating correctly - MGD Modified: trunk/matplotlib/examples/pylab_examples/fancyarrow_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/fancyarrow_demo.py 2008-12-18 13:47:19 UTC (rev 6663) +++ trunk/matplotlib/examples/pylab_examples/fancyarrow_demo.py 2008-12-18 15:38:33 UTC (rev 6664) @@ -3,23 +3,26 @@ styles = mpatches.ArrowStyle.get_styles() -figheight = (len(styles)+.5) -fig1 = plt.figure(1, (4, figheight)) -fontsize = 0.3 * fig1.dpi +ncol=2 +nrow = len(styles) // ncol + 1 +figheight = (nrow+0.5) +fig1 = plt.figure(1, (4.*ncol/1.5, figheight/1.5)) +fontsize = 0.2 * 70 ax = fig1.add_axes([0, 0, 1, 1], frameon=False, aspect=1.) -ax.set_xlim(0, 4) +ax.set_xlim(0, 4*ncol) ax.set_ylim(0, figheight) for i, (stylename, styleclass) in enumerate(sorted(styles.items())): - y = (float(len(styles)) -0.25 - i) # /figheight - p = mpatches.Circle((3.2, y), 0.2, fc="w") + x = 3.2 + (i//nrow)*4 + y = (figheight - 0.7 - i%nrow) # /figheight + p = mpatches.Circle((x, y), 0.2, fc="w") ax.add_patch(p) - ax.annotate(stylename, (3.2, y), - (2., y), + ax.annotate(stylename, (x, y), + (x-1.2, y), #xycoords="figure fraction", textcoords="figure fraction", ha="right", va="center", size=fontsize, Modified: trunk/matplotlib/examples/pylab_examples/fancybox_demo2.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/fancybox_demo2.py 2008-12-18 13:47:19 UTC (rev 6663) +++ trunk/matplotlib/examples/pylab_examples/fancybox_demo2.py 2008-12-18 15:38:33 UTC (rev 6664) @@ -4,8 +4,8 @@ styles = mpatch.BoxStyle.get_styles() figheight = (len(styles)+.5) -fig1 = plt.figure(1, (4, figheight)) -fontsize = 0.4 * fig1.dpi +fig1 = plt.figure(1, (4/1.5, figheight/1.5)) +fontsize = 0.3 * 72 for i, (stylename, styleclass) in enumerate(styles.items()): fig1.text(0.5, (float(len(styles)) - 0.5 - i)/figheight, stylename, @@ -15,3 +15,4 @@ bbox=dict(boxstyle=stylename, fc="w", ec="k")) plt.draw() plt.show() + Modified: trunk/matplotlib/lib/matplotlib/bezier.py =================================================================== --- trunk/matplotlib/lib/matplotlib/bezier.py 2008-12-18 13:47:19 UTC (rev 6663) +++ trunk/matplotlib/lib/matplotlib/bezier.py 2008-12-18 15:38:33 UTC (rev 6664) @@ -468,6 +468,38 @@ +def make_path_regular(p): + """ + fill in the codes if None. + """ + c = p.codes + if c is None: + c = np.empty(p.vertices.shape, "i") + c.fill(Path.LINETO) + c[0] = Path.MOVETO + + return Path(p.vertices, c) + else: + return p + +def concatenate_paths(paths): + """ + concatenate list of paths into a single path. + """ + + vertices = [] + codes = [] + for p in paths: + p = make_path_regular(p) + vertices.append(p.vertices) + codes.append(p.codes) + + _path = Path(np.concatenate(vertices), + np.concatenate(codes)) + return _path + + + if 0: path = Path([(0, 0), (1, 0), (2, 2)], [Path.MOVETO, Path.CURVE3, Path.CURVE3]) @@ -476,3 +508,4 @@ ax = gca() + Modified: trunk/matplotlib/lib/matplotlib/patches.py =================================================================== --- trunk/matplotlib/lib/matplotlib/patches.py 2008-12-18 13:47:19 UTC (rev 6663) +++ trunk/matplotlib/lib/matplotlib/patches.py 2008-12-18 15:38:33 UTC (rev 6664) @@ -2176,6 +2176,7 @@ from matplotlib.bezier import get_intersection, inside_circle, get_parallels from matplotlib.bezier import make_wedged_bezier2 from matplotlib.bezier import split_path_inout, get_cos_sin +from matplotlib.bezier import make_path_regular, concatenate_paths class ConnectionStyle(_Style): @@ -2627,12 +2628,15 @@ def transmute(self, path, mutation_size, linewidth): """ The transmute method is a very core of the ArrowStyle - class and must be overriden in the subclasses. It receives the - path object along which the arrow will be drawn, and the - mutation_size, with which the amount arrow head and etc. will - be scaled. It returns a Path instance. The linewidth may be - used to adjust the the path so that it does not pass beyond - the given points. + class and must be overriden in the subclasses. It receives + the path object along which the arrow will be drawn, and + the mutation_size, with which the amount arrow head and + etc. will be scaled. The linewidth may be used to adjust + the the path so that it does not pass beyond the given + points. It returns a tuple of a Path instance and a + boolean. The boolean value indicate whether the path can + be filled or not. The return value can also be a list of paths + and list of booleans of a same length. """ raise NotImplementedError('Derived must override') @@ -2646,6 +2650,8 @@ and take care of the aspect ratio. """ + path = make_path_regular(path) + if aspect_ratio is not None: # Squeeze the given height by the aspect_ratio @@ -2654,12 +2660,19 @@ vertices[:,1] = vertices[:,1] / aspect_ratio path_shrinked = Path(vertices, codes) # call transmute method with squeezed height. - path_mutated, closed = self.transmute(path_shrinked, linewidth, - mutation_size) - vertices, codes = path_mutated.vertices, path_mutated.codes - # Restore the height - vertices[:,1] = vertices[:,1] * aspect_ratio - return Path(vertices, codes), closed + path_mutated, fillable = self.transmute(path_shrinked, + linewidth, + mutation_size) + if cbook.iterable(fillable): + path_list = [] + for p in zip(path_mutated): + v, c = p.vertices, p.codes + # Restore the height + v[:,1] = v[:,1] * aspect_ratio + path_list.append(Path(v, c)) + return path_list, fillable + else: + return path_mutated, fillable else: return self.transmute(path, mutation_size, linewidth) @@ -2669,21 +2682,24 @@ """ A simple arrow which will work with any path instance. The returned path is simply concatenation of the original path + at - most two paths representing the arrow at the begin point and the - at the end point. The returned path is not closed and only meant - to be stroked. + most two paths representing the arrow head at the begin point and the + at the end point. The arrow heads can be either open or closed. """ def __init__(self, beginarrow=None, endarrow=None, + fillbegin=False, fillend=False, head_length=.2, head_width=.1): """ The arrows are drawn if *beginarrow* and/or *endarrow* are - true. *head_length* and *head_width* determines the size of - the arrow relative to the *mutation scale*. + true. *head_length* and *head_width* determines the size + of the arrow relative to the *mutation scale*. The + arrowhead at the begin (or end) is closed if fillbegin (or + fillend) is True. """ self.beginarrow, self.endarrow = beginarrow, endarrow self.head_length, self.head_width = \ head_length, head_width + self.fillbegin, self.fillend = fillbegin, fillend super(ArrowStyle._Curve, self).__init__() @@ -2783,18 +2799,35 @@ # this simple code will not work if ddx, ddy is greater than # separation bettern vertices. - vertices = np.concatenate([verticesA + [(x0+ddxA, y0+ddyA)], - path.vertices[1:-1], - [(x3+ddxB, y3+ddyB)] + verticesB]) - codes = np.concatenate([codesA, - path.codes, - codesB]) + _path = [Path(np.concatenate([[(x0+ddxA, y0+ddyA)], + path.vertices[1:-1], + [(x3+ddxB, y3+ddyB)]]), + path.codes)] + _fillable = [False] + + if self.beginarrow: + if self.fillbegin: + p = np.concatenate([verticesA, [verticesA[0], verticesA[0]], ]) + c = np.concatenate([codesA, [Path.LINETO, Path.CLOSEPOLY]]) + _path.append(Path(p, c)) + _fillable.append(True) + else: + _path.append(Path(verticesA, codesA)) + _fillable.append(False) + + if self.endarrow: + if self.fillend: + _fillable.append(True) + p = np.concatenate([verticesB, [verticesB[0], verticesB[0]], ]) + c = np.concatenate([codesB, [Path.LINETO, Path.CLOSEPOLY]]) + _path.append(Path(p, c)) + else: + _fillable.append(False) + _path.append(Path(verticesB, codesB)) + + return _path, _fillable - p = Path(vertices, codes) - return p, False - - class Curve(_Curve): """ A simple curve without any arrow head. @@ -2872,6 +2905,73 @@ _style_list["<->"] = CurveAB + + class CurveFilledA(_Curve): + """ + An arrow with filled triangle head at the begin. + """ + + def __init__(self, head_length=.4, head_width=.2): + """ + *head_length* + length of the arrow head + + *head_width* + width of the arrow head + """ + + super(ArrowStyle.CurveFilledA, self).__init__( \ + beginarrow=True, endarrow=False, + fillbegin=True, fillend=False, + head_length=head_length, head_width=head_width ) + + _style_list["<|-"] = CurveFilledA + + + class CurveFilledB(_Curve): + """ + An arrow with filled triangle head at the end. + """ + + def __init__(self, head_length=.4, head_width=.2): + """ + *head_length* + length of the arrow head + + *head_width* + width of the arrow head + """ + + super(ArrowStyle.CurveFilledB, self).__init__( \ + beginarrow=False, endarrow=True, + fillbegin=False, fillend=True, + head_length=head_length, head_width=head_width ) + + _style_list["-|>"] = CurveFilledB + + + class CurveFilledAB(_Curve): + """ + An arrow with filled triangle heads both at the begin and the end point. + """ + + def __init__(self, head_length=.4, head_width=.2): + """ + *head_length* + length of the arrow head + + *head_width* + width of the arrow head + """ + + super(ArrowStyle.CurveFilledAB, self).__init__( \ + beginarrow=True, endarrow=True, + fillbegin=True, fillend=True, + head_length=head_length, head_width=head_width ) + + _style_list["<|-|>"] = CurveFilledAB + + class _Bracket(_Base): def __init__(self, bracketA=None, bracketB=None, @@ -3201,6 +3301,7 @@ + class FancyArrowPatch(Patch): """ A fancy arrow patch. It draws an arrow using the :class:ArrowStyle. @@ -3423,9 +3524,14 @@ get_path_in_displaycoord() medthod to retrieve the arrow path in the disaply coord. """ - _path = self.get_path_in_displaycoord() + _path, fillable = self.get_path_in_displaycoord() + + if cbook.iterable(fillable): + _path = concatenate_paths(_path) + return self.get_transform().inverted().transform_path(_path) + def get_path_in_displaycoord(self): """ Return the mutated path of the arrow in the display coord @@ -3445,16 +3551,16 @@ - _path, closed = self.get_arrowstyle()(_path, - self.get_mutation_scale(), - self.get_linewidth(), - self.get_mutation_aspect() - ) + _path, fillable = self.get_arrowstyle()(_path, + self.get_mutation_scale(), + self.get_linewidth(), + self.get_mutation_aspect() + ) - if not closed: - self.fill = False + #if not fillable: + # self.fill = False - return _path + return _path, fillable @@ -3463,12 +3569,7 @@ #renderer.open_group('patch') gc = renderer.new_gc() - fill_orig = self.fill - path = self.get_path_in_displaycoord() - affine = transforms.IdentityTransform() - - if cbook.is_string_like(self._edgecolor) and self._edgecolor.lower()=='none': gc.set_linewidth(0) else: @@ -3494,8 +3595,22 @@ gc.set_hatch(self._hatch ) - renderer.draw_path(gc, path, affine, rgbFace) + path, fillable = self.get_path_in_displaycoord() - self.fill = fill_orig + if not cbook.iterable(fillable): + path = [path] + fillable = [fillable] + - #renderer.close_group('patch') + affine = transforms.IdentityTransform() + + renderer.open_group('patch', self.get_gid()) + + for p, f in zip(path, fillable): + if f: + renderer.draw_path(gc, p, affine, rgbFace) + else: + renderer.draw_path(gc, p, affine, None) + + + renderer.close_group('patch') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2008-12-18 17:32:26
|
Revision: 6669 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6669&view=rev Author: jdh2358 Date: 2008-12-18 17:32:22 +0000 (Thu, 18 Dec 2008) Log Message: ----------- Merged revisions 6665-6668 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6665 | jdh2358 | 2008-12-18 08:29:51 -0800 (Thu, 18 Dec 2008) | 1 line removed some configobj and traits detritus ........ r6666 | jdh2358 | 2008-12-18 08:31:44 -0800 (Thu, 18 Dec 2008) | 1 line tagging release 0.98.5.2 ........ r6667 | jdh2358 | 2008-12-18 09:02:41 -0800 (Thu, 18 Dec 2008) | 1 line removed mpl_data ........ r6668 | jdh2358 | 2008-12-18 09:03:47 -0800 (Thu, 18 Dec 2008) | 1 line retagging for 98.5.2 ........ Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/doc/api/api_changes.rst trunk/matplotlib/setup.py trunk/matplotlib/setupext.py Removed Paths: ------------- trunk/matplotlib/doc/mpl_data Property Changed: ---------------- trunk/matplotlib/ Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6662 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6668 Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-12-18 17:03:47 UTC (rev 6668) +++ trunk/matplotlib/CHANGELOG 2008-12-18 17:32:22 UTC (rev 6669) @@ -1,5 +1,10 @@ 2008-12-18 add new arrow style, a line + filled triangles. -JJL +================================================================== +2008-12-18 Released 0.98.5.2 from v0_98_5_maint at r6667 + +2008-12-18 Removed configobj, experimental traits and doc/mpl_data link - JDH + 2008-12-18 Fix bug where a line with NULL data limits prevents subsequent data limits from calculating correctly - MGD Modified: trunk/matplotlib/doc/api/api_changes.rst =================================================================== --- trunk/matplotlib/doc/api/api_changes.rst 2008-12-18 17:03:47 UTC (rev 6668) +++ trunk/matplotlib/doc/api/api_changes.rst 2008-12-18 17:32:22 UTC (rev 6669) @@ -15,6 +15,7 @@ Changes for 0.98.x ================== +* Removed the configobj and experiemtnal traits rc support * Modified :func:`matplotlib.mlab.psd`, :func:`matplotlib.mlab.csd`, :func:`matplotlib.mlab.cohere`, and :func:`matplotlib.mlab.specgram` Deleted: trunk/matplotlib/doc/mpl_data =================================================================== --- trunk/matplotlib/doc/mpl_data 2008-12-18 17:03:47 UTC (rev 6668) +++ trunk/matplotlib/doc/mpl_data 2008-12-18 17:32:22 UTC (rev 6669) @@ -1 +0,0 @@ -link ../lib/matplotlib/mpl-data/ \ No newline at end of file Modified: trunk/matplotlib/setup.py =================================================================== --- trunk/matplotlib/setup.py 2008-12-18 17:03:47 UTC (rev 6668) +++ trunk/matplotlib/setup.py 2008-12-18 17:32:22 UTC (rev 6669) @@ -35,12 +35,12 @@ from distutils.core import setup from setupext import build_agg, build_gtkagg, build_tkagg, build_wxagg,\ build_macosx, build_ft2font, build_image, build_windowing, build_path, \ - build_contour, build_delaunay, build_nxutils, build_traits, build_gdk, \ + build_contour, build_delaunay, build_nxutils, build_gdk, \ 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_macosx, check_for_numpy, \ - check_for_qt, check_for_qt4, check_for_cairo, check_for_traits, \ - check_provide_pytz, check_provide_dateutil, check_for_configobj, \ + check_for_qt, check_for_qt4, check_for_cairo, \ + check_provide_pytz, check_provide_dateutil,\ check_for_dvipng, check_for_ghostscript, check_for_latex, \ check_for_pdftops, check_for_datetime, options, build_png #import distutils.sysconfig @@ -217,15 +217,7 @@ check_for_latex() check_for_pdftops() -# TODO: comment out for mpl release: print_raw("") -print_raw("EXPERIMENTAL CONFIG PACKAGE DEPENDENCIES") -has_configobj = check_for_configobj() -has_traits = check_for_traits() -if has_configobj and has_traits: - packages.append('matplotlib.config') - -print_raw("") print_raw("[Edit setup.cfg to suppress the above messages]") print_line() Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2008-12-18 17:03:47 UTC (rev 6668) +++ trunk/matplotlib/setupext.py 2008-12-18 17:32:22 UTC (rev 6669) @@ -83,7 +83,6 @@ BUILT_CONTOUR = False BUILT_DELAUNAY = False BUILT_NXUTILS = False -BUILT_TRAITS = False BUILT_CONTOUR = False BUILT_GDK = False BUILT_PATH = False @@ -434,36 +433,6 @@ print_status("dateutil", "present, version unknown") return False -def check_for_configobj(): - try: - import configobj - except ImportError: - print_status("configobj", "no") - return False - else: - print_status("configobj", configobj.__version__) - return True - -def check_for_traits(): - try: - from enthought import traits - try: - from enthought.traits import version - except: - print_status("enthought.traits", "unknown and incompatible version: < 2.0") - return False - else: - # traits 2 and 3 store their version strings in different places: - try: - version = version.version - except AttributeError: - version = version.__version__ - print_status("enthought.traits", version) - return True - except ImportError: - print_status("enthought.traits", "no") - return False - def check_for_dvipng(): try: stdin, stdout = run_child_process('dvipng -version') @@ -1316,24 +1285,7 @@ BUILT_IMAGE = True -def build_traits(ext_modules, packages): - global BUILT_TRAITS - if BUILT_TRAITS: - return # only build it if you you haven't already - ctraits = Extension('enthought.traits.ctraits', - ['lib/enthought/traits/ctraits.c']) - ext_modules.append(ctraits) - packages.extend(['enthought', - 'enthought/etsconfig', - 'enthought/traits', - 'enthought/traits/ui', - 'enthought/traits/ui/extras', - 'enthought/traits/ui/null', - 'enthought/traits/ui/tk', - ]) - BUILT_TRAITS = True - def build_delaunay(ext_modules, packages): global BUILT_DELAUNAY if BUILT_DELAUNAY: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-12-18 19:10:43
|
Revision: 6674 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6674&view=rev Author: mdboom Date: 2008-12-18 19:10:38 +0000 (Thu, 18 Dec 2008) Log Message: ----------- Merged revisions 6672-6673 via svnmerge from https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6672 | mdboom | 2008-12-18 14:07:08 -0500 (Thu, 18 Dec 2008) | 2 lines Fix how example files are added to the build. Saves about 1MB in html output. ........ r6673 | mdboom | 2008-12-18 14:08:45 -0500 (Thu, 18 Dec 2008) | 1 line removing examples from svn ........ Modified Paths: -------------- trunk/matplotlib/doc/conf.py trunk/matplotlib/doc/make.py trunk/matplotlib/doc/sphinxext/plot_directive.py trunk/matplotlib/lib/matplotlib/pyplot.py Added Paths: ----------- trunk/matplotlib/doc/sphinxext/gen_rst.py Removed Paths: ------------- trunk/matplotlib/doc/examples/ Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README trunk/matplotlib/doc/sphinxext/gen_gallery.py Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6668 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6673 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673 Modified: trunk/matplotlib/doc/conf.py =================================================================== --- trunk/matplotlib/doc/conf.py 2008-12-18 19:08:45 UTC (rev 6673) +++ trunk/matplotlib/doc/conf.py 2008-12-18 19:10:38 UTC (rev 6674) @@ -29,7 +29,7 @@ # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['mathmpl', 'math_symbol_table', 'sphinx.ext.autodoc', 'only_directives', 'plot_directive', 'inheritance_diagram', - 'gen_gallery'] + 'gen_gallery', 'gen_rst'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] Modified: trunk/matplotlib/doc/make.py =================================================================== --- trunk/matplotlib/doc/make.py 2008-12-18 19:08:45 UTC (rev 6673) +++ trunk/matplotlib/doc/make.py 2008-12-18 19:10:38 UTC (rev 6674) @@ -34,15 +34,12 @@ def html(): check_build() - if not os.path.exists('examples/index.rst'): - examples() shutil.copy('../lib/matplotlib/mpl-data/matplotlibrc', '_static/matplotlibrc') - #figs() if small_docs: options = "-D plot_formats=\"['png']\"" else: options = '' - if os.system('sphinx-build %s -b html -d build/doctrees . build/html' % options): + if os.system('sphinx-build %s -P -b html -d build/doctrees . build/html' % options): raise SystemExit("Building HTML failed.") figures_dest_path = 'build/html/pyplots' Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673 Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662 + /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673 Copied: trunk/matplotlib/doc/sphinxext/gen_rst.py (from rev 6673, branches/v0_98_5_maint/doc/sphinxext/gen_rst.py) =================================================================== --- trunk/matplotlib/doc/sphinxext/gen_rst.py (rev 0) +++ trunk/matplotlib/doc/sphinxext/gen_rst.py 2008-12-18 19:10:38 UTC (rev 6674) @@ -0,0 +1,155 @@ +""" +generate the rst files for the examples by iterating over the pylab examples +""" +import os, glob + +import os +import re +import sys +fileList = [] + +def out_of_date(original, derived): + """ + Returns True if derivative is out-of-date wrt original, + both of which are full file paths. + + TODO: this check isn't adequate in some cases. Eg, if we discover + a bug when building the examples, the original and derived will be + unchanged but we still want to force a rebuild. + """ + return (not os.path.exists(derived) or + os.stat(derived).st_mtime < os.stat(original).st_mtime) + +noplot_regex = re.compile(r"#\s*-\*-\s*noplot\s*-\*-") + +def generate_example_rst(app): + rootdir = os.path.join(app.builder.srcdir, 'mpl_examples') + exampledir = os.path.join(app.builder.srcdir, 'examples') + if not os.path.exists(exampledir): + os.makedirs(exampledir) + + datad = {} + for root, subFolders, files in os.walk(rootdir): + for fname in files: + if ( fname.startswith('.') or fname.startswith('#') or fname.startswith('_') or + fname.find('.svn')>=0 or not fname.endswith('.py') ): + continue + + fullpath = os.path.join(root,fname) + contents = file(fullpath).read() + # indent + relpath = os.path.split(root)[-1] + datad.setdefault(relpath, []).append((fullpath, fname, contents)) + + subdirs = datad.keys() + subdirs.sort() + + fhindex = file(os.path.join(exampledir, 'index.rst'), 'w') + fhindex.write("""\ +.. _examples-index: + +#################### +Matplotlib Examples +#################### + +.. htmlonly:: + + :Release: |version| + :Date: |today| + +.. toctree:: + :maxdepth: 2 + +""") + + for subdir in subdirs: + rstdir = os.path.join(exampledir, subdir) + if not os.path.exists(rstdir): + os.makedirs(rstdir) + + outputdir = os.path.join(app.builder.outdir, 'examples') + if not os.path.exists(outputdir): + os.makedirs(outputdir) + + outputdir = os.path.join(outputdir, subdir) + if not os.path.exists(outputdir): + os.makedirs(outputdir) + + subdirIndexFile = os.path.join(rstdir, 'index.rst') + fhsubdirIndex = file(subdirIndexFile, 'w') + fhindex.write(' %s/index.rst\n\n'%subdir) + + fhsubdirIndex.write("""\ +.. _%s-examples-index: + +############################################## +%s Examples +############################################## + +.. htmlonly:: + + :Release: |version| + :Date: |today| + +.. toctree:: + :maxdepth: 1 + +"""%(subdir, subdir)) + + print subdir + + data = datad[subdir] + data.sort() + + for fullpath, fname, contents in data: + basename, ext = os.path.splitext(fname) + outputfile = os.path.join(outputdir, fname) + #thumbfile = os.path.join(thumb_dir, '%s.png'%basename) + #print ' static_dir=%s, basename=%s, fullpath=%s, fname=%s, thumb_dir=%s, thumbfile=%s'%(static_dir, basename, fullpath, fname, thumb_dir, thumbfile) + + rstfile = '%s.rst'%basename + outrstfile = os.path.join(rstdir, rstfile) + + fhsubdirIndex.write(' %s\n'%rstfile) + + if (not out_of_date(fullpath, outputfile) and + not out_of_date(fullpath, outrstfile)): + continue + + print ' %s'%fname + + fh = file(outrstfile, 'w') + fh.write('.. _%s-%s:\n\n'%(subdir, basename)) + title = '%s example code: %s'%(subdir, fname) + #title = '<img src=%s> %s example code: %s'%(thumbfile, subdir, fname) + + + fh.write(title + '\n') + fh.write('='*len(title) + '\n\n') + + do_plot = (subdir in ('api', + 'pylab_examples', + 'units') and + not noplot_regex.search(contents)) + + if do_plot: + fh.write("\n\n.. plot:: %s\n\n::\n\n" % fullpath) + else: + fh.write("[`source code <%s>`_]\n\n::\n\n" % fname) + fhstatic = file(outputfile, 'w') + fhstatic.write(contents) + fhstatic.close() + + # indent the contents + contents = '\n'.join([' %s'%row.rstrip() for row in contents.split('\n')]) + fh.write(contents) + + fh.write('\n\nKeywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`)') + fh.close() + + fhsubdirIndex.close() + + fhindex.close() + +def setup(app): + app.connect('builder-inited', generate_example_rst) Modified: trunk/matplotlib/doc/sphinxext/plot_directive.py =================================================================== --- trunk/matplotlib/doc/sphinxext/plot_directive.py 2008-12-18 19:08:45 UTC (rev 6673) +++ trunk/matplotlib/doc/sphinxext/plot_directive.py 2008-12-18 19:10:38 UTC (rev 6674) @@ -34,6 +34,41 @@ import matplotlib.image as image from matplotlib import _pylab_helpers +if hasattr(os.path, 'relpath'): + relpath = os.path.relpath +else: + def relpath(target, base=os.curdir): + """ + Return a relative path to the target from either the current dir or an optional base dir. + Base can be a directory specified either as absolute or relative to current dir. + """ + + if not os.path.exists(target): + raise OSError, 'Target does not exist: '+target + + if not os.path.isdir(base): + raise OSError, 'Base is not a directory or does not exist: '+base + + base_list = (os.path.abspath(base)).split(os.sep) + target_list = (os.path.abspath(target)).split(os.sep) + + # On the windows platform the target may be on a completely different drive from the base. + if os.name in ['nt','dos','os2'] and base_list[0] <> target_list[0]: + raise OSError, 'Target is on a different drive to base. Target: '+target_list[0].upper()+', base: '+base_list[0].upper() + + # Starting from the filepath root, work out how much of the filepath is + # shared by base and target. + for i in range(min(len(base_list), len(target_list))): + if base_list[i] <> target_list[i]: break + else: + # If we broke out of the loop, i is pointing to the first differing path elements. + # If we didn't break out of the loop, i is pointing to identical path elements. + # Increment i so that in all cases it points to the first differing path elements. + i+=1 + + rel_list = [os.pardir] * (len(base_list)-i) + target_list[i:] + return os.path.join(*rel_list) + def write_char(s): sys.stdout.write(s) sys.stdout.flush() @@ -186,6 +221,7 @@ reference = directives.uri(arguments[0]) basedir, fname = os.path.split(reference) basename, ext = os.path.splitext(fname) + basedir = relpath(basedir, setup.app.builder.srcdir) # Get the directory of the rst file, and determine the relative # path from the resulting html file to the plot_directive links Modified: trunk/matplotlib/lib/matplotlib/pyplot.py =================================================================== --- trunk/matplotlib/lib/matplotlib/pyplot.py 2008-12-18 19:08:45 UTC (rev 6673) +++ trunk/matplotlib/lib/matplotlib/pyplot.py 2008-12-18 19:10:38 UTC (rev 6674) @@ -1148,10 +1148,9 @@ def plotting(): """ Plotting commands - - ============ ================================================= + =============== ========================================================= Command Description - ========= ================================================= + =============== ========================================================= axes Create a new axes axis Set or return the current axis limits bar make a bar chart @@ -1204,7 +1203,7 @@ title add a title to the current axes xlabel add an xlabel to the current axes ylabel add a ylabel to the current axes - ============ ================================================= + =============== ========================================================= The following commands will set the default colormap accordingly: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |