You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(115) |
Aug
(120) |
Sep
(137) |
Oct
(170) |
Nov
(461) |
Dec
(263) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(120) |
Feb
(74) |
Mar
(35) |
Apr
(74) |
May
(245) |
Jun
(356) |
Jul
(240) |
Aug
(115) |
Sep
(78) |
Oct
(225) |
Nov
(98) |
Dec
(271) |
2009 |
Jan
(132) |
Feb
(84) |
Mar
(74) |
Apr
(56) |
May
(90) |
Jun
(79) |
Jul
(83) |
Aug
(296) |
Sep
(214) |
Oct
(76) |
Nov
(82) |
Dec
(66) |
2010 |
Jan
(46) |
Feb
(58) |
Mar
(51) |
Apr
(77) |
May
(58) |
Jun
(126) |
Jul
(128) |
Aug
(64) |
Sep
(50) |
Oct
(44) |
Nov
(48) |
Dec
(54) |
2011 |
Jan
(68) |
Feb
(52) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
1
(2) |
2
|
3
(1) |
4
|
5
|
6
(1) |
7
(1) |
8
(1) |
9
|
10
(2) |
11
(5) |
12
(1) |
13
|
14
(4) |
15
|
16
(2) |
17
(5) |
18
(1) |
19
(3) |
20
(2) |
21
(5) |
22
(6) |
23
(6) |
24
(1) |
25
|
26
(2) |
27
(5) |
28
(3) |
29
(4) |
30
(3) |
31
(17) |
|
Revision: 7307 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7307&view=rev Author: evilguru Date: 2009年07月29日 21:28:50 +0000 (2009年7月29日) Log Message: ----------- Add first attempt at getting matplotlib to install mathtex. Modified Paths: -------------- branches/mathtex/setup.py branches/mathtex/setupext.py Modified: branches/mathtex/setup.py =================================================================== --- branches/mathtex/setup.py 2009年07月29日 17:14:05 UTC (rev 7306) +++ branches/mathtex/setup.py 2009年07月29日 21:28:50 UTC (rev 7307) @@ -42,7 +42,8 @@ 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 + check_for_pdftops, check_for_datetime, options, build_png, \ + check_provide_mathtex, build_mathtex #import distutils.sysconfig # jdh @@ -128,6 +129,9 @@ if has_libpng and options['build_agg'] or options['build_image']: build_png(ext_modules, packages) +if has_libpng and options['provide_mathtex'] and check_provide_mathtex(): + build_mathtex(ext_modules, packages, package_data) + if options['build_windowing'] and sys.platform=='win32': build_windowing(ext_modules, packages) Modified: branches/mathtex/setupext.py =================================================================== --- branches/mathtex/setupext.py 2009年07月29日 17:14:05 UTC (rev 7306) +++ branches/mathtex/setupext.py 2009年07月29日 21:28:50 UTC (rev 7307) @@ -98,6 +98,7 @@ 'verbose': False, 'provide_pytz': 'auto', 'provide_dateutil': 'auto', + 'provide_mathtex' : 'auto', 'build_agg': True, 'build_gtk': 'auto', 'build_gtkagg': 'auto', @@ -126,6 +127,10 @@ "dateutil") except: options['provide_dateutil'] = 'auto' + try: options['provide_mathtex'] = config.getboolean("provide_packages", + "mathtex") + except: options['provide_mathtex'] = 'auto' + try: options['build_gtk'] = config.getboolean("gui_support", "gtk") except: options['build_gtk'] = 'auto' @@ -386,6 +391,14 @@ print_status("datetime", "present, version unknown") return True +def check_provide_mathtex(): + try: + import mathtex + except ImportError: + print_status("mathtex", "matplotlib will provide") + return True + return False + def check_provide_pytz(hasdatetime=True): if hasdatetime and (options['provide_pytz'] is True): print_status("pytz", "matplotlib will provide") @@ -545,7 +558,7 @@ else: add_base_flags(module) module.libraries.append('z') - + # put this last for library link order module.libraries.extend(std_libs) @@ -1092,6 +1105,11 @@ ext_modules.append(module) BUILT_FT2FONT = True +def build_mathtex(ext_modules, packages, package_data): + packages.append('mathtex/mathtex') + packages.append('mathtex/mathtex.backends') + package_data['mathtex'] = ['lib/mathtex/data/fonts/*.ttf'] + def build_ttconv(ext_modules, packages): global BUILT_TTCONV if BUILT_TTCONV: return # only build it if you you haven't already This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7306 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7306&view=rev Author: evilguru Date: 2009年07月29日 17:14:05 +0000 (2009年7月29日) Log Message: ----------- Update the mathtex branch so that it is up-to-date with trunk. Modified Paths: -------------- branches/mathtex/CHANGELOG branches/mathtex/boilerplate.py branches/mathtex/examples/pylab_examples/axes_zoom_effect.py branches/mathtex/examples/pylab_examples/findobj_demo.py branches/mathtex/examples/pylab_examples/griddata_demo.py branches/mathtex/examples/pylab_examples/hatch_demo.py branches/mathtex/lib/matplotlib/axes.py branches/mathtex/lib/matplotlib/backends/backend_pdf.py branches/mathtex/lib/matplotlib/backends/backend_svg.py branches/mathtex/lib/matplotlib/collections.py branches/mathtex/lib/matplotlib/delaunay/VoronoiDiagramGenerator.cpp branches/mathtex/lib/matplotlib/delaunay/__init__.py branches/mathtex/lib/matplotlib/delaunay/_delaunay.cpp branches/mathtex/lib/matplotlib/delaunay/triangulate.py branches/mathtex/lib/matplotlib/mlab.py branches/mathtex/lib/matplotlib/pyplot.py branches/mathtex/lib/matplotlib/quiver.py branches/mathtex/lib/mpl_toolkits/axes_grid/axislines.py branches/mathtex/lib/mpl_toolkits/mplot3d/art3d.py branches/mathtex/lib/mpl_toolkits/mplot3d/axes3d.py branches/mathtex/src/_backend_agg.cpp Added Paths: ----------- branches/mathtex/examples/api/radar_chart.py branches/mathtex/examples/mplot3d/hist3d_demo.py branches/mathtex/examples/pylab_examples/legend_translucent.py Removed Paths: ------------- branches/mathtex/src/agg.cxx branches/mathtex/src/swig_runtime.h Property Changed: ---------------- branches/mathtex/ branches/mathtex/doc/pyplots/README branches/mathtex/doc/sphinxext/gen_gallery.py branches/mathtex/doc/sphinxext/gen_rst.py branches/mathtex/examples/misc/multiprocess.py branches/mathtex/examples/mplot3d/contour3d_demo.py branches/mathtex/examples/mplot3d/contourf3d_demo.py branches/mathtex/examples/mplot3d/polys3d_demo.py branches/mathtex/examples/mplot3d/scatter3d_demo.py branches/mathtex/examples/mplot3d/surface3d_demo.py branches/mathtex/examples/mplot3d/wire3d_demo.py branches/mathtex/lib/matplotlib/sphinxext/mathmpl.py branches/mathtex/lib/matplotlib/sphinxext/only_directives.py branches/mathtex/lib/matplotlib/sphinxext/plot_directive.py Property changes on: branches/mathtex ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7253 /trunk/matplotlib:1-7262 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7253 /trunk/matplotlib:1-7305 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,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /trunk/matplotlib:7265-7303 Modified: branches/mathtex/CHANGELOG =================================================================== --- branches/mathtex/CHANGELOG 2009年07月29日 16:58:13 UTC (rev 7305) +++ branches/mathtex/CHANGELOG 2009年07月29日 17:14:05 UTC (rev 7306) @@ -1,3 +1,26 @@ +2009年07月28日 Quiver speed improved, thanks to tip by Ray Speth. -EF + +2009年07月27日 Simplify argument handling code for plot method. -EF + +2009年07月25日 Allow "plot(1, 2, 'r*')" to work. - EF + +2009年07月22日 Added an 'interp' keyword to griddata so the faster linear + interpolation method can be chosen. Default is 'nn', so + default behavior (using natural neighbor method) is unchanged (JSW) + +2009年07月22日 Improved boilerplate.py so that it generates the correct + signatures for pyplot functions. - JKS + +2009年07月19日 Fixed the docstring of Axes.step to reflect the correct + meaning of the kwargs "pre" and "post" - See SF bug + https://sourceforge.net/tracker/index.php?func=detail&aid=2823304&group_id=80706&atid=560720 + - JDH + +2009年07月18日 Fix support for hatches without color fills to pdf and svg + backends. Add an example of that to hatch_demo.py. - JKS + +2009年07月17日 Removed fossils from swig version of agg backend. - EF + 2009年07月14日 initial submission of the annotation guide. -JJL 2009年07月14日 axes_grid : minor improvements in anchored_artists and @@ -3,5 +26,5 @@ inset_locator. -JJL -2009年07月14日 Fix a few bugs in ConnectionStyle algorithms. Add +2009年07月14日 Fix a few bugs in ConnectionStyle algorithms. Add ConnectionPatch class. -JJL Modified: branches/mathtex/boilerplate.py =================================================================== --- branches/mathtex/boilerplate.py 2009年07月29日 16:58:13 UTC (rev 7305) +++ branches/mathtex/boilerplate.py 2009年07月29日 17:14:05 UTC (rev 7306) @@ -1,47 +1,50 @@ -# wrap the plot commands defined in axes. The code generated by this +# Wrap the plot commands defined in axes. The code generated by this # file is pasted into pylab.py. We did try to do this the smart way, # with callable functions and new.function, but could never get the # docstrings right for python2.2. See # http://groups.google.com/group/comp.lang.python/browse_frm/thread/dcd63ec13096a0f6/1b14640f3a4ad3dc?#1b14640f3a4ad3dc +# For some later history, see +# http://thread.gmane.org/gmane.comp.python.matplotlib.devel/7068 +import inspect +import random +import re +import sys +import types -# note we check for __doc__ is not None since py2exe optimize removes -# the docstrings +# import the local copy of matplotlib, not the installed one +sys.path.insert(0, './lib') +from matplotlib.axes import Axes +from matplotlib.cbook import dedent _fmtplot = """\ # This function was autogenerated by boilerplate.py. Do not edit as # changes will be lost -def %(func)s(*args, **kwargs): +def %(func)s(%(argspec)s): + %(docstring)s + %(ax)s = gca() # allow callers to override the hold state by passing hold=True|False - b = ishold() - h = kwargs.pop('hold', None) - if h is not None: - hold(h) + %(washold)s = %(ax)s.ishold() + %(sethold)s + if hold is not None: + %(ax)s.hold(hold) try: - ret = gca().%(func)s(*args, **kwargs) + %(ret)s = %(ax)s.%(func)s(%(call)s) draw_if_interactive() - except: - hold(b) - raise + finally: + %(ax)s.hold(%(washold)s) %(mappable)s - hold(b) - return ret -if Axes.%(func)s.__doc__ is not None: - %(func)s.__doc__ = dedent(Axes.%(func)s.__doc__) + \"\"\" - -Additional kwargs: hold = [True|False] overrides default hold state\"\"\" + return %(ret)s """ _fmtmisc = """\ # This function was autogenerated by boilerplate.py. Do not edit as # changes will be lost -def %(func)s(*args, **kwargs): - - ret = gca().%(func)s(*args, **kwargs) +def %(func)s(%(argspec)s): + %(docstring)s + %(ret)s = gca().%(func)s(%(call)s) draw_if_interactive() - return ret -if Axes.%(func)s.__doc__ is not None: - %(func)s.__doc__ = dedent(Axes.%(func)s.__doc__) + return %(ret)s """ # these methods are all simple wrappers of Axes methods by the same @@ -101,33 +104,113 @@ ) cmappable = { - 'contour' : 'if ret._A is not None: gci._current = ret', - 'contourf': 'if ret._A is not None: gci._current = ret', - 'hexbin' : 'gci._current = ret[0]', - 'scatter' : 'gci._current = ret', - 'pcolor' : 'gci._current = ret', - 'pcolormesh' : 'gci._current = ret', - 'imshow' : 'gci._current = ret', - 'spy' : 'gci._current = ret', - 'quiver' : 'gci._current = ret', - 'specgram' : 'gci._current = ret[-1]', + 'contour' : 'if %(ret)s._A is not None: gci._current = %(ret)s', + 'contourf': 'if %(ret)s._A is not None: gci._current = %(ret)s', + 'hexbin' : 'gci._current = %(ret)s', + 'scatter' : 'gci._current = %(ret)s', + 'pcolor' : 'gci._current = %(ret)s', + 'pcolormesh' : 'gci._current = %(ret)s', + 'imshow' : 'gci._current = %(ret)s', + 'spy' : 'gci._current = %(ret)s', + 'quiver' : 'gci._current = %(ret)s', + 'specgram' : 'gci._current = %(ret)s[-1]', } +def format_value(value): + """ + Format function default values as needed for inspect.formatargspec. + The interesting part is a hard-coded list of functions used + as defaults in pyplot methods. + """ + if isinstance(value, types.FunctionType): + if value.func_name in ('detrend_none', 'window_hanning'): + return '=mlab.' + value.func_name + if value.func_name == 'mean': + return '=np.' + value.func_name + raise ValueError, ('default value %s unknown to boilerplate.formatvalue' + % value) + return '='+repr(value) -for func in _plotcommands: - if func in cmappable: - mappable = cmappable[func] - else: - mappable = '' - print _fmtplot%locals() +def remove_final_whitespace(string): + """ + Return a copy of *string* with final whitespace removed from each line. + """ + return '\n'.join(x.rstrip() for x in string.split('\n')) +def make_docstring(cmd, mention_hold): + func = getattr(Axes, cmd) + docstring = inspect.getdoc(func) + if docstring is None: + return "" + escaped = re.sub(r'\\', r'\\\\', docstring) + if mention_hold: + escaped += ''' -for func in _misccommands: - print _fmtmisc%locals() +Additional kwargs: hold = [True|False] overrides default hold state +''' + return '"""'+escaped+'"""' +for fmt,cmdlist in (_fmtplot,_plotcommands),(_fmtmisc,_misccommands): + for func in cmdlist: + # For some commands, an additional line is needed to set the + # color map + if func in cmappable: + mappable = cmappable[func] % locals() + else: + mappable = '' + # Format docstring + docstring = make_docstring(func, fmt is _fmtplot) + # Get argspec of wrapped function + args, varargs, varkw, defaults = inspect.getargspec(getattr(Axes, func)) + args.pop(0) # remove 'self' argument + if defaults is None: + defaults = () + + # How to call the wrapped function + call = map(str, args) + if varargs is not None: + call.append('*'+varargs) + if varkw is not None: + call.append('**'+varkw) + call = ', '.join(call) + + # Add a hold keyword argument if needed (fmt is _fmtplot) and + # possible (if *args is used, we can't just add a hold + # argument in front of it since it would gobble one of the + # arguments the user means to pass via *args) + if varargs: + sethold = "hold = %(varkw)s.pop('hold', None)" % locals() + elif fmt is _fmtplot: + args.append('hold') + defaults = defaults + (None,) + sethold = '' + + # Now we can build the argspec for defining the wrapper + argspec = inspect.formatargspec(args, varargs, varkw, defaults, + formatvalue=format_value) + argspec = argspec[1:-1] # remove parens + + # A gensym-like facility in case some function takes an + # argument named washold, ax, or ret + washold,ret,ax = 'washold', 'ret', 'ax' + bad = set(args) | set((varargs, varkw)) + while washold in bad or ret in bad or ax in bad: + washold = 'washold' + str(random.randrange(10**12)) + ret = 'ret' + str(random.randrange(10**12)) + ax = 'ax' + str(random.randrange(10**12)) + + # Since we can't avoid using some function names, + # bail out if they are used as argument names + for reserved in ('gca', 'gci', 'draw_if_interactive'): + if reserved in bad: + raise ValueError, \ + 'Axes method %s has kwarg named %s' % (func, reserved) + + print remove_final_whitespace(fmt%locals()) + # define the colormap functions _fmtcmap = """\ # This function was autogenerated by boilerplate.py. Do not edit as Property changes on: branches/mathtex/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,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /trunk/matplotlib/doc/pyplots/README:7265-7303 Property changes on: branches/mathtex/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,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 + /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,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /trunk/matplotlib/doc/sphinxext/gen_gallery.py:7265-7303 Property changes on: branches/mathtex/doc/sphinxext/gen_rst.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 + /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /trunk/matplotlib/doc/sphinxext/gen_rst.py:7265-7303 Copied: branches/mathtex/examples/api/radar_chart.py (from rev 7303, trunk/matplotlib/examples/api/radar_chart.py) =================================================================== --- branches/mathtex/examples/api/radar_chart.py (rev 0) +++ branches/mathtex/examples/api/radar_chart.py 2009年07月29日 17:14:05 UTC (rev 7306) @@ -0,0 +1,144 @@ +import numpy as np + +import matplotlib.pyplot as plt +from matplotlib.projections.polar import PolarAxes +from matplotlib.projections import register_projection + +def radar_factory(num_vars, frame='circle'): + """Create a radar chart with `num_vars` axes.""" + # calculate evenly-spaced axis angles + theta = 2*np.pi * np.linspace(0, 1-1./num_vars, num_vars) + # rotate theta such that the first axis is at the top + theta += np.pi/2 + + def draw_poly_frame(self, x0, y0, r): + # TODO: use transforms to convert (x, y) to (r, theta) + verts = [(r*np.cos(t) + x0, r*np.sin(t) + y0) for t in theta] + return plt.Polygon(verts, closed=True, edgecolor='k') + + def draw_circle_frame(self, x0, y0, r): + return plt.Circle((x0, y0), r) + + frame_dict = {'polygon': draw_poly_frame, 'circle': draw_circle_frame} + if frame not in frame_dict: + raise ValueError, 'unknown value for `frame`: %s' % frame + + class RadarAxes(PolarAxes): + """Class for creating a radar chart (a.k.a. a spider or star chart) + + http://en.wikipedia.org/wiki/Radar_chart + """ + name = 'radar' + # use 1 line segment to connect specified points + RESOLUTION = 1 + # define draw_frame method + draw_frame = frame_dict[frame] + + def fill(self, *args, **kwargs): + """Override fill so that line is closed by default""" + closed = kwargs.pop('closed', True) + return super(RadarAxes, self).fill(closed=closed, *args, **kwargs) + + def plot(self, *args, **kwargs): + """Override plot so that line is closed by default""" + lines = super(RadarAxes, self).plot(*args, **kwargs) + for line in lines: + self._close_line(line) + + def _close_line(self, line): + x, y = line.get_data() + # FIXME: markers at x[0], y[0] get doubled-up + if x[0] != x[-1]: + x = np.concatenate((x, [x[0]])) + y = np.concatenate((y, [y[0]])) + line.set_data(x, y) + + def set_varlabels(self, labels): + self.set_thetagrids(theta * 180/np.pi, labels) + + def _gen_axes_patch(self): + x0, y0 = (0.5, 0.5) + r = 0.5 + return self.draw_frame(x0, y0, r) + + register_projection(RadarAxes) + return theta + + +if __name__ == '__main__': + #The following data is from the Denver Aerosol Sources and Health study. + #See doi:10.1016/j.atmosenv.2008年12月01日7 + # + #The data are pollution source profile estimates for five modeled pollution + #sources (e.g., cars, wood-burning, etc) that emit 7-9 chemical species. + #The radar charts are experimented with here to see if we can nicely + #visualize how the modeled source profiles change across four scenarios: + # 1) No gas-phase species present, just seven particulate counts on + # Sulfate + # Nitrate + # Elemental Carbon (EC) + # Organic Carbon fraction 1 (OC) + # Organic Carbon fraction 2 (OC2) + # Organic Carbon fraction 3 (OC3) + # Pyrolized Organic Carbon (OP) + # 2)Inclusion of gas-phase specie carbon monoxide (CO) + # 3)Inclusion of gas-phase specie ozone (O3). + # 4)Inclusion of both gas-phase speciesis present... + N = 9 + theta = radar_factory(N) + spoke_labels = ['Sulfate', 'Nitrate', 'EC', 'OC1', 'OC2', 'OC3', 'OP', 'CO', + 'O3'] + f1_base = [0.88, 0.01, 0.03, 0.03, 0.00, 0.06, 0.01, 0.00, 0.00] + f1_CO = [0.88, 0.02, 0.02, 0.02, 0.00, 0.05, 0.00, 0.05, 0.00] + f1_O3 = [0.89, 0.01, 0.07, 0.00, 0.00, 0.05, 0.00, 0.00, 0.03] + f1_both = [0.87, 0.01, 0.08, 0.00, 0.00, 0.04, 0.00, 0.00, 0.01] + + f2_base = [0.07, 0.95, 0.04, 0.05, 0.00, 0.02, 0.01, 0.00, 0.00] + f2_CO = [0.08, 0.94, 0.04, 0.02, 0.00, 0.01, 0.12, 0.04, 0.00] + f2_O3 = [0.07, 0.95, 0.05, 0.04, 0.00, 0.02, 0.12, 0.00, 0.00] + f2_both = [0.09, 0.95, 0.02, 0.03, 0.00, 0.01, 0.13, 0.06, 0.00] + + f3_base = [0.01, 0.02, 0.85, 0.19, 0.05, 0.10, 0.00, 0.00, 0.00] + f3_CO = [0.01, 0.01, 0.79, 0.10, 0.00, 0.05, 0.00, 0.31, 0.00] + f3_O3 = [0.01, 0.02, 0.86, 0.27, 0.16, 0.19, 0.00, 0.00, 0.00] + f3_both = [0.01, 0.02, 0.71, 0.24, 0.13, 0.16, 0.00, 0.50, 0.00] + + f4_base = [0.02, 0.01, 0.07, 0.01, 0.21, 0.12, 0.98, 0.00, 0.00] + f4_CO = [0.00, 0.02, 0.03, 0.38, 0.31, 0.31, 0.00, 0.59, 0.00] + f4_O3 = [0.01, 0.03, 0.00, 0.32, 0.29, 0.27, 0.00, 0.00, 0.95] + f4_both = [0.01, 0.03, 0.00, 0.28, 0.24, 0.23, 0.00, 0.44, 0.88] + + f5_base = [0.01, 0.01, 0.02, 0.71, 0.74, 0.70, 0.00, 0.00, 0.00] + f5_CO = [0.02, 0.02, 0.11, 0.47, 0.69, 0.58, 0.88, 0.00, 0.00] + f5_O3 = [0.02, 0.00, 0.03, 0.37, 0.56, 0.47, 0.87, 0.00, 0.00] + f5_both = [0.02, 0.00, 0.18, 0.45, 0.64, 0.55, 0.86, 0.00, 0.16] + + fig = plt.figure(figsize=(9,9)) + # adjust spacing around the subplots + fig.subplots_adjust(wspace=0.25, hspace=0.20, top=0.85, bottom=0.05) + title_list = ['Basecase', 'With CO', 'With O3', 'CO & O3'] + data = {'Basecase': [f1_base, f2_base, f3_base, f4_base, f5_base], + 'With CO': [f1_CO, f2_CO, f3_CO, f4_CO, f5_CO], + 'With O3': [f1_O3, f2_O3, f3_O3, f4_O3, f5_O3], + 'CO & O3': [f1_both, f2_both, f3_both, f4_both, f5_both]} + colors = ['b', 'r', 'g', 'm', 'y'] + # chemicals range from 0 to 1 + radial_grid = [0.2, 0.4, 0.6, 0.8] + # If you don't care about the order, you can loop over data_dict.items() + for n, title in enumerate(title_list): + ax = fig.add_subplot(2, 2, n+1, projection='radar') + plt.rgrids(radial_grid) + ax.set_title(title, weight='bold', size='medium', position=(0.5, 1.1), + horizontalalignment='center', verticalalignment='center') + for d, color in zip(data[title], colors): + ax.plot(theta, d, color=color) + ax.fill(theta, d, facecolor=color, alpha=0.25) + ax.set_varlabels(spoke_labels) + # add legend relative to top-left plot + plt.subplot(2,2,1) + labels = ('Factor 1', 'Factor 2', 'Factor 3', 'Factor 4', 'Factor 5') + legend = plt.legend(labels, loc=(0.9, .95), labelspacing=0.1) + plt.setp(legend.get_texts(), fontsize='small') + plt.figtext(0.5, 0.965, '5-Factor Solution Profiles Across Four Scenarios', + ha='center', color='black', weight='bold', size='large') + plt.show() Property changes on: branches/mathtex/examples/misc/multiprocess.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/misc/log.py:5753-5771 /branches/v0_98_5_maint/examples/misc/log.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 + /branches/v0_91_maint/examples/misc/log.py:5753-5771 /branches/v0_98_5_maint/examples/misc/log.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /trunk/matplotlib/examples/misc/multiprocess.py:7265-7303 Property changes on: branches/mathtex/examples/mplot3d/contour3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/contour.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contour.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 + /branches/v0_91_maint/examples/mplot3d/contour.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contour.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /trunk/matplotlib/examples/mplot3d/contour3d_demo.py:7265-7303 Property changes on: branches/mathtex/examples/mplot3d/contourf3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/contourf.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contourf.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 + /branches/v0_91_maint/examples/mplot3d/contourf.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contourf.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /trunk/matplotlib/examples/mplot3d/contourf3d_demo.py:7265-7303 Copied: branches/mathtex/examples/mplot3d/hist3d_demo.py (from rev 7303, trunk/matplotlib/examples/mplot3d/hist3d_demo.py) =================================================================== --- branches/mathtex/examples/mplot3d/hist3d_demo.py (rev 0) +++ branches/mathtex/examples/mplot3d/hist3d_demo.py 2009年07月29日 17:14:05 UTC (rev 7306) @@ -0,0 +1,27 @@ +from mpl_toolkits.mplot3d import Axes3D +from matplotlib.collections import PolyCollection +from matplotlib.colors import colorConverter +import pylab +import random +import numpy as np + +fig = pylab.figure() +ax = Axes3D(fig) +x = np.random.rand(100) * 4 +y = np.random.rand(100) * 4 +hist, xedges, yedges = np.histogram2d(x, y, bins=4) + +elements = (len(xedges) - 1) * (len(yedges) - 1) +xpos, ypos = np.meshgrid( + [xedges[i] + 0.25 for i in range(len(xedges) - 1)], + [yedges[i] + 0.25 for i in range(len(yedges) - 1)]) +xpos = xpos.flatten() +ypos = ypos.flatten() +zpos = [0] * elements +dx = [0.5] * elements +dy = [0.5] * elements +dz = hist.flatten() +ax.bar3d(xpos, ypos, zpos, dx, dy, dz, color='b') + +pylab.show() + Property changes on: branches/mathtex/examples/mplot3d/polys3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/polys.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/polys.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 + /branches/v0_91_maint/examples/mplot3d/polys.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/polys.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /trunk/matplotlib/examples/mplot3d/polys3d_demo.py:7265-7303 Property changes on: branches/mathtex/examples/mplot3d/scatter3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/scatter.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/scatter.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 + /branches/v0_91_maint/examples/mplot3d/scatter.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/scatter.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /trunk/matplotlib/examples/mplot3d/scatter3d_demo.py:7265-7303 Property changes on: branches/mathtex/examples/mplot3d/surface3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/surface.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/surface.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 + /branches/v0_91_maint/examples/mplot3d/surface.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/surface.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /trunk/matplotlib/examples/mplot3d/surface3d_demo.py:7265-7303 Property changes on: branches/mathtex/examples/mplot3d/wire3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/wire.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/wire.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 + /branches/v0_91_maint/examples/mplot3d/wire.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/wire.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /trunk/matplotlib/examples/mplot3d/wire3d_demo.py:7265-7303 Modified: branches/mathtex/examples/pylab_examples/axes_zoom_effect.py =================================================================== --- branches/mathtex/examples/pylab_examples/axes_zoom_effect.py 2009年07月29日 16:58:13 UTC (rev 7305) +++ branches/mathtex/examples/pylab_examples/axes_zoom_effect.py 2009年07月29日 17:14:05 UTC (rev 7306) @@ -51,7 +51,7 @@ prop_patches=kwargs.copy() prop_patches["ec"]="none" - prop_patches["alpha"]="0.2" + prop_patches["alpha"]=0.2 c1, c2, bbox_patch1, bbox_patch2, p = \ connect_bbox(mybbox1, mybbox2, @@ -84,7 +84,7 @@ prop_patches=kwargs.copy() prop_patches["ec"]="none" - prop_patches["alpha"]="0.2" + prop_patches["alpha"]=0.2 c1, c2, bbox_patch1, bbox_patch2, p = \ connect_bbox(mybbox1, mybbox2, Modified: branches/mathtex/examples/pylab_examples/findobj_demo.py =================================================================== --- branches/mathtex/examples/pylab_examples/findobj_demo.py 2009年07月29日 16:58:13 UTC (rev 7305) +++ branches/mathtex/examples/pylab_examples/findobj_demo.py 2009年07月29日 17:14:05 UTC (rev 7306) @@ -23,7 +23,7 @@ # match on arbitrary function def myfunc(x): - return hasattr(x, 'set_color') + return hasattr(x, 'set_color') and not hasattr(x, 'set_facecolor') for o in fig.findobj(myfunc): o.set_color('blue') Modified: branches/mathtex/examples/pylab_examples/griddata_demo.py =================================================================== --- branches/mathtex/examples/pylab_examples/griddata_demo.py 2009年07月29日 16:58:13 UTC (rev 7305) +++ branches/mathtex/examples/pylab_examples/griddata_demo.py 2009年07月29日 17:14:05 UTC (rev 7306) @@ -4,7 +4,7 @@ import numpy as np # make up data. #npts = int(raw_input('enter # of random points to plot:')) -seed(-1) +seed(0) npts = 200 x = uniform(-2,2,npts) y = uniform(-2,2,npts) Modified: branches/mathtex/examples/pylab_examples/hatch_demo.py =================================================================== --- branches/mathtex/examples/pylab_examples/hatch_demo.py 2009年07月29日 16:58:13 UTC (rev 7305) +++ branches/mathtex/examples/pylab_examples/hatch_demo.py 2009年07月29日 17:14:05 UTC (rev 7306) @@ -3,18 +3,29 @@ PDF, SVG and Agg backends only. """ import matplotlib.pyplot as plt +from matplotlib.patches import Ellipse, Polygon fig = plt.figure() -ax1 = fig.add_subplot(121) +ax1 = fig.add_subplot(131) ax1.bar(range(1,5), range(1,5), color='red', edgecolor='black', hatch="/") ax1.bar(range(1,5), [6] * 4, bottom=range(1,5), color='blue', edgecolor='black', hatch='//') +ax1.set_xticks([1.5,2.5,3.5,4.5]) -ax2 = fig.add_subplot(122) +ax2 = fig.add_subplot(132) bars = ax2.bar(range(1,5), range(1,5), color='yellow', ecolor='black') + \ ax2.bar(range(1, 5), [6] * 4, bottom=range(1,5), color='green', ecolor='black') +ax2.set_xticks([1.5,2.5,3.5,4.5]) patterns = ('-', '+', 'x', '\\', '*', 'o', 'O', '.') for bar, pattern in zip(bars, patterns): bar.set_hatch(pattern) +ax3 = fig.add_subplot(133) +ax3.fill([1,3,3,1],[1,1,2,2], fill=False, hatch='\\') +ax3.add_patch(Ellipse((4,1.5), 4, 0.5, fill=False, hatch='*')) +ax3.add_patch(Polygon([[0,0],[4,1.1],[6,2.5],[2,1.4]], closed=True, + fill=False, hatch='/')) +ax3.set_xlim((0,6)) +ax3.set_ylim((0,2.5)) + plt.show() Copied: branches/mathtex/examples/pylab_examples/legend_translucent.py (from rev 7303, trunk/matplotlib/examples/pylab_examples/legend_translucent.py) =================================================================== --- branches/mathtex/examples/pylab_examples/legend_translucent.py (rev 0) +++ branches/mathtex/examples/pylab_examples/legend_translucent.py 2009年07月29日 17:14:05 UTC (rev 7306) @@ -0,0 +1,18 @@ +#!/usr/bin/python +# +# Show how to add a translucent legend + +# import pyplot module +import matplotlib.pyplot as plt + +# draw 2 crossing lines +plt.plot([0,1], label='going up') +plt.plot([1,0], label='going down') + +# add the legend in the middle of the plot +leg = plt.legend(fancybox=True, loc='center') +# set the alpha value of the legend: it will be translucent +leg.get_frame().set_alpha(0.5) + +# show the plot +plt.show() Modified: branches/mathtex/lib/matplotlib/axes.py =================================================================== --- branches/mathtex/lib/matplotlib/axes.py 2009年07月29日 16:58:13 UTC (rev 7305) +++ branches/mathtex/lib/matplotlib/axes.py 2009年07月29日 17:14:05 UTC (rev 7306) @@ -199,21 +199,6 @@ func = getattr(fill_poly,funcName) func(val) - def _xy_from_y(self, y): - if self.axes.yaxis is not None: - b = self.axes.yaxis.update_units(y) - if b: return np.arange(len(y)), y, False - - if not ma.isMaskedArray(y): - y = np.asarray(y) - if len(y.shape) == 1: - y = y[:,np.newaxis] - nr, nc = y.shape - x = np.arange(nr) - if len(x.shape) == 1: - x = x[:,np.newaxis] - return x,y, True - def _xy_from_xy(self, x, y): if self.axes.xaxis is not None and self.axes.yaxis is not None: bx = self.axes.xaxis.update_units(x) @@ -223,197 +208,107 @@ if by: y = self.axes.convert_yunits(y) - x = ma.asarray(x) - y = ma.asarray(y) - if len(x.shape) == 1: + x = np.atleast_1d(x) #like asanyarray, but converts scalar to array + y = np.atleast_1d(y) + if x.shape[0] != y.shape[0]: + raise ValueError("x and y must have same first dimension") + if x.ndim > 2 or y.ndim > 2: + raise ValueError("x and y can be no greater than 2-D") + + if x.ndim == 1: x = x[:,np.newaxis] - if len(y.shape) == 1: + if y.ndim == 1: y = y[:,np.newaxis] - nrx, ncx = x.shape - nry, ncy = y.shape - assert nrx == nry, 'Dimensions of x and y are incompatible' - if ncx == ncy: - return x, y, True - if ncx == 1: - x = np.repeat(x, ncy, axis=1) - if ncy == 1: - y = np.repeat(y, ncx, axis=1) - assert x.shape == y.shape, 'Dimensions of x and y are incompatible' - return x, y, True + return x, y + def _makeline(self, x, y, kw, kwargs): + kw = kw.copy() # Don't modify the original kw. + if not 'color' in kw: + kw['color'] = self._get_next_cycle_color() + # (can't use setdefault because it always evaluates + # its second argument) + seg = mlines.Line2D(x, y, + axes=self.axes, + **kw + ) + self.set_lineprops(seg, **kwargs) + return seg - def _plot_1_arg(self, y, **kwargs): - assert self.command == 'plot', 'fill needs at least 2 arguments' - ret = [] + def _makefill(self, x, y, kw, kwargs): + try: + facecolor = kw['color'] + except KeyError: + facecolor = self._get_next_cycle_color() + seg = mpatches.Polygon(np.hstack( + (x[:,np.newaxis],y[:,np.newaxis])), + facecolor = facecolor, + fill=True, + closed=kw['closed'] + ) + self.set_patchprops(seg, **kwargs) + return seg - x, y, multicol = self._xy_from_y(y) - if multicol: - for j in xrange(y.shape[1]): - color = self._get_next_cycle_color() - seg = mlines.Line2D(x, y[:,j], - color = color, - axes=self.axes, - ) - self.set_lineprops(seg, **kwargs) - ret.append(seg) + def _plot_args(self, tup, kwargs): + ret = [] + if len(tup) > 1 and is_string_like(tup[-1]): + linestyle, marker, color = _process_plot_format(tup[-1]) + tup = tup[:-1] + elif len(tup) == 3: + raise ValueError, 'third arg must be a format string' else: - color = self._get_next_cycle_color() - seg = mlines.Line2D(x, y, - color = color, - axes=self.axes, - ) - self.set_lineprops(seg, **kwargs) - ret.append(seg) + linestyle, marker, color = None, None, None + kw = {} + for k, v in zip(('linestyle', 'marker', 'color'), + (linestyle, marker, color)): + if v is not None: + kw[k] = v - return ret + y = np.atleast_1d(tup[-1]) - def _plot_2_args(self, tup2, **kwargs): - ret = [] - if is_string_like(tup2[1]): - - assert self.command == 'plot', ('fill needs at least 2 non-string ' - 'arguments') - y, fmt = tup2 - x, y, multicol = self._xy_from_y(y) - - linestyle, marker, color = _process_plot_format(fmt) - - def makeline(x, y): - _color = color - if _color is None: - _color = self._get_next_cycle_color() - seg = mlines.Line2D(x, y, - color=_color, - linestyle=linestyle, marker=marker, - axes=self.axes, - ) - self.set_lineprops(seg, **kwargs) - ret.append(seg) - - if multicol: - for j in xrange(y.shape[1]): - makeline(x[:,j], y[:,j]) - else: - makeline(x, y) - - return ret + if len(tup) == 2: + x = np.atleast_1d(tup[0]) else: + x = np.arange(y.shape[0], dtype=float) - x, y = tup2 - x, y, multicol = self._xy_from_xy(x, y) + x, y = self._xy_from_xy(x, y) - def makeline(x, y): - color = self._get_next_cycle_color() - seg = mlines.Line2D(x, y, - color=color, - axes=self.axes, - ) - self.set_lineprops(seg, **kwargs) - ret.append(seg) - - def makefill(x, y): - facecolor = self._get_next_cycle_color() - seg = mpatches.Polygon(np.hstack( - (x[:,np.newaxis],y[:,np.newaxis])), - facecolor = facecolor, - fill=True, - closed=closed - ) - self.set_patchprops(seg, **kwargs) - ret.append(seg) - - if self.command == 'plot': - func = makeline - else: - closed = kwargs.get('closed', True) - func = makefill - if multicol: - for j in xrange(y.shape[1]): - func(x[:,j], y[:,j]) - else: - func(x, y) - - - return ret - - def _plot_3_args(self, tup3, **kwargs): - ret = [] - - x, y, fmt = tup3 - x, y, multicol = self._xy_from_xy(x, y) - - linestyle, marker, color = _process_plot_format(fmt) - - def makeline(x, y): - _color = color - if _color is None: - _color = self._get_next_cycle_color() - seg = mlines.Line2D(x, y, - color=_color, - linestyle=linestyle, marker=marker, - axes=self.axes, - ) - self.set_lineprops(seg, **kwargs) - ret.append(seg) - - def makefill(x, y): - facecolor = color - seg = mpatches.Polygon(np.hstack( - (x[:,np.newaxis],y[:,np.newaxis])), - facecolor = facecolor, - fill=True, - closed=closed - ) - self.set_patchprops(seg, **kwargs) - ret.append(seg) - if self.command == 'plot': - func = makeline + func = self._makeline else: - closed = kwargs.get('closed', True) - func = makefill + kw['closed'] = kwargs.get('closed', True) + func = self._makefill - if multicol: - for j in xrange(y.shape[1]): - func(x[:,j], y[:,j]) - else: - func(x, y) + ncx, ncy = x.shape[1], y.shape[1] + for j in xrange(max(ncx, ncy)): + seg = func(x[:,j%ncx], y[:,j%ncy], kw, kwargs) + ret.append(seg) return ret + def _grab_next_args(self, *args, **kwargs): remaining = args while 1: - if len(remaining)==0: return - if len(remaining)==1: - for seg in self._plot_1_arg(remaining[0], **kwargs): + if len(remaining)==0: + return + if len(remaining) <= 3: + for seg in self._plot_args(remaining, kwargs): yield seg - remaining = [] - continue - if len(remaining)==2: - for seg in self._plot_2_args(remaining, **kwargs): - yield seg - remaining = [] - continue - if len(remaining)==3: - if not is_string_like(remaining[2]): - raise ValueError, 'third arg must be a format string' - for seg in self._plot_3_args(remaining, **kwargs): - yield seg - remaining=[] - continue + return + if is_string_like(remaining[2]): - for seg in self._plot_3_args(remaining[:3], **kwargs): - yield seg - remaining=remaining[3:] + isplit = 3 else: - for seg in self._plot_2_args(remaining[:2], **kwargs): - yield seg - remaining=remaining[2:] + isplit = 2 + for seg in self._plot_args(remaining[:isplit], kwargs): + yield seg + remaining=remaining[isplit:] + + class Axes(martist.Artist): """ The :class:`Axes` contains most of the figure elements: @@ -4109,9 +4004,9 @@ Keyword arguments: *where*: [ 'pre' | 'post' | 'mid' ] - If 'pre', the interval from x[i] to x[i+1] has level y[i] + If 'pre', the interval from x[i] to x[i+1] has level y[i+1] - If 'post', that interval has level y[i+1] + If 'post', that interval has level y[i] If 'mid', the jumps in *y* occur half-way between the *x*-values. Modified: branches/mathtex/lib/matplotlib/backends/backend_pdf.py =================================================================== --- branches/mathtex/lib/matplotlib/backends/backend_pdf.py 2009年07月29日 16:58:13 UTC (rev 7305) +++ branches/mathtex/lib/matplotlib/backends/backend_pdf.py 2009年07月29日 17:14:05 UTC (rev 7306) @@ -1743,14 +1743,27 @@ return `d` def _strokep(self): + """ + Predicate: does the path need to be stroked (its outline drawn)? + This tests for the various conditions that disable stroking + the path, in which case it would presumably be filled. + """ return (self._linewidth > 0 and self._alpha > 0 and (len(self._rgb) <= 3 or self._rgb[3] != 0.0)) def _fillp(self): - return ((self._fillcolor is not None or self._hatch) and - (len(self._fillcolor) <= 3 or self._fillcolor[3] != 0.0)) + """ + Predicate: does the path need to be filled? + """ + return self._hatch or \ + (self._fillcolor is not None and + (len(self._fillcolor) <= 3 or self._fillcolor[3] != 0.0)) def close_and_paint(self): + """ + Return the appropriate pdf operator to close the path and + cause it to be stroked, filled, or both. + """ if self._strokep(): if self._fillp(): return Op.close_fill_stroke @@ -1763,6 +1776,10 @@ return Op.endpath def paint(self): + """ + Return the appropriate pdf operator to cause the path to be + stroked, filled, or both. + """ if self._strokep(): if self._fillp(): return Op.fill_stroke Modified: branches/mathtex/lib/matplotlib/backends/backend_svg.py =================================================================== --- branches/mathtex/lib/matplotlib/backends/backend_svg.py 2009年07月29日 16:58:13 UTC (rev 7305) +++ branches/mathtex/lib/matplotlib/backends/backend_svg.py 2009年07月29日 17:14:05 UTC (rev 7306) @@ -106,9 +106,13 @@ path_data = self._convert_path( gc.get_hatch_path(), Affine2D().scale(HATCH_SIZE).scale(1.0, -1.0).translate(0, HATCH_SIZE)) + if rgbFace is None: + fill = 'none' + else: + fill = rgb2hex(rgbFace) self._svgwriter.write( '<rect x="0" y="0" width="%d" height="%d" fill="%s"/>' % - (HATCH_SIZE+1, HATCH_SIZE+1, rgb2hex(rgbFace))) + (HATCH_SIZE+1, HATCH_SIZE+1, fill)) path = '<path d="%s" fill="%s" stroke="%s" stroke-width="1.0"/>' % ( path_data, rgb2hex(gc.get_rgb()[:3]), rgb2hex(gc.get_rgb()[:3])) self._svgwriter.write(path) Modified: branches/mathtex/lib/matplotlib/collections.py =================================================================== --- branches/mathtex/lib/matplotlib/collections.py 2009年07月29日 16:58:13 UTC (rev 7305) +++ branches/mathtex/lib/matplotlib/collections.py 2009年07月29日 17:14:05 UTC (rev 7306) @@ -670,6 +670,9 @@ def set_verts(self, verts, closed=True): '''This allows one to delay initialization of the vertices.''' + if np.ma.isMaskedArray(verts): + verts = verts.astype(np.float_).filled(np.nan) + # This is much faster than having Path do it one at a time. if closed: self._paths = [] for xy in verts: Modified: branches/mathtex/lib/matplotlib/delaunay/VoronoiDiagramGenerator.cpp =================================================================== --- branches/mathtex/lib/matplotlib/delaunay/VoronoiDiagramGenerator.cpp 2009年07月29日 16:58:13 UTC (rev 7305) +++ branches/mathtex/lib/matplotlib/delaunay/VoronoiDiagramGenerator.cpp 2009年07月29日 17:14:05 UTC (rev 7306) @@ -12,9 +12,9 @@ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. */ -/* - * This code was originally written by Stephan Fortune in C code. Shane O'Sullivan, - * have since modified it, encapsulating it in a C++ class and, fixing memory leaks and +/* + * This code was originally written by Stephan Fortune in C code. Shane O'Sullivan, + * have since modified it, encapsulating it in a C++ class and, fixing memory leaks and * adding accessors to the Voronoi Edges. * Permission to use, copy, modify, and distribute this software for any * purpose without fee is hereby granted, provided that this entire notice @@ -26,7 +26,7 @@ * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. */ - + /* * Subsequently, Robert Kern modified it to yield Python objects. * Copyright 2005 Robert Kern <rob...@gm...> @@ -78,9 +78,9 @@ nsites=numPoints; plot = 0; - triangulate = 0; + triangulate = 0; debug = 1; - sorted = 0; + sorted = 0; freeinit(&sfl, sizeof (Site)); sites = (struct Site *) myalloc(nsites*sizeof( *sites)); @@ -112,9 +112,9 @@ //printf("\n%f %f\n",xValues[i],yValues[i]); } - + qsort(sites, nsites, sizeof (*sites), scomp); - + siteidx = 0; geominit(); double temp = 0; @@ -134,9 +134,9 @@ borderMinY = minY; borderMaxX = maxX; borderMaxY = maxY; + + siteidx = 0; - siteidx = 0; - voronoi(triangulate); return true; @@ -191,25 +191,25 @@ struct Halfedge * VoronoiDiagramGenerator::ELgethash(int b) { struct Halfedge *he; - - if(b<0 || b>=ELhashsize) + + if(b<0 || b>=ELhashsize) return((struct Halfedge *) NULL); - he = ELhash[b]; - if (he == (struct Halfedge *) NULL || he->ELedge != (struct Edge *) DELETED ) + he = ELhash[b]; + if (he == (struct Halfedge *) NULL || he->ELedge != (struct Edge *) DELETED ) return (he); - + /* Hash table points to deleted half edge. Patch as necessary. */ ELhash[b] = (struct Halfedge *) NULL; - if ((he -> ELrefcnt -= 1) == 0) + if ((he -> ELrefcnt -= 1) == 0) makefree((Freenode*)he, &hfl); return ((struct Halfedge *) NULL); -} +} struct Halfedge * VoronoiDiagramGenerator::ELleftbnd(struct Point *p) { int i, bucket; struct Halfedge *he; - + /* Use hash table to get close to desired halfedge */ bucket = (int)((p->x - xmin)/deltax * ELhashsize); //use the hash function to find the place in the hash map that this HalfEdge should be @@ -218,12 +218,12 @@ he = ELgethash(bucket); if(he == (struct Halfedge *) NULL) //if the HE isn't found, search backwards and forwards in the hash map for the first non-null entry - { + { for(i=1; 1 ; i += 1) - { - if ((he=ELgethash(bucket-i)) != (struct Halfedge *) NULL) + { + if ((he=ELgethash(bucket-i)) != (struct Halfedge *) NULL) break; - if ((he=ELgethash(bucket+i)) != (struct Halfedge *) NULL) + if ((he=ELgethash(bucket+i)) != (struct Halfedge *) NULL) break; }; totalsearch += i; @@ -232,22 +232,22 @@ /* Now search linear list of halfedges for the correct one */ if (he==ELleftend || (he != ELrightend && right_of(he,p))) { - do + do { he = he -> ELright; } while (he!=ELrightend && right_of(he,p)); //keep going right on the list until either the end is reached, or you find the 1st edge which the point he = he -> ELleft; //isn't to the right of } else //if the point is to the left of the HalfEdge, then search left for the HE just to the left of the point - do + do { he = he -> ELleft; } while (he!=ELleftend && !right_of(he,p)); - + /* Update hash table and reference counts */ if(bucket > 0 && bucket <ELhashsize-1) - { - if(ELhash[bucket] != (struct Halfedge *) NULL) + { + if(ELhash[bucket] != (struct Halfedge *) NULL) { ELhash[bucket] -> ELrefcnt -= 1; } @@ -281,9 +281,9 @@ struct Site * VoronoiDiagramGenerator::leftreg(struct Halfedge *he) { - if(he -> ELedge == (struct Edge *)NULL) + if(he -> ELedge == (struct Edge *)NULL) return(bottomsite); - return( he -> ELpm == le ? + return( he -> ELpm == le ? he -> ELedge -> reg[le] : he -> ELedge -> reg[re]); } @@ -297,7 +297,7 @@ } void VoronoiDiagramGenerator::geominit() -{ +{ double sn; freeinit(&efl, sizeof(Edge)); @@ -313,17 +313,17 @@ struct Edge * VoronoiDiagramGenerator::bisect(struct Site *s1, struct Site *s2) { double dx,dy,adx,ady; - struct Edge *newedge; + struct Edge *newedge; newedge = (struct Edge *) getfree(&efl); - + newedge -> reg[0] = s1; //store the sites that this edge is bisecting newedge -> reg[1] = s2; - ref(s1); + ref(s1); ref(s2); newedge -> ep[0] = (struct Site *) NULL; //to begin with, there are no endpoints on the bisector - it goes to infinity newedge -> ep[1] = (struct Site *) NULL; - + dx = s2->coord.x - s1->coord.x; //get the difference in x dist between the sites dy = s2->coord.y - s1->coord.y; adx = dx>0 ? dx : -dx; //make sure that the difference in positive @@ -331,18 +331,18 @@ newedge -> c = (double)(s1->coord.x * dx + s1->coord.y * dy + (dx*dx + dy*dy)*0.5);//get the slope of the line if (adx>ady) - { + { newedge -> a = 1.0; newedge -> b = dy/dx; newedge -> c /= dx;//set formula of line, with x fixed to 1 } else - { + { newedge -> b = 1.0; newedge -> a = dx/dy; newedge -> c /= dy;//set formula of line, with y fixed to 1 }; - + newedge -> edgenbr = nedges; //printf("\nbisect(%d) ((%f,%f) and (%f,%f)",nedges,s1->coord.x,s1->coord.y,s2->coord.x,s2->coord.y); - + nedges += 1; return(newedge); } @@ -355,40 +355,40 @@ double d, xint, yint; int right_of_site; struct Site *v; - + e1 = el1 -> ELedge; e2 = el2 -> ELedge; - if(e1 == (struct Edge*)NULL || e2 == (struct Edge*)NULL) + if(e1 == (struct Edge*)NULL || e2 == (struct Edge*)NULL) return ((struct Site *) NULL); //if the two edges bisect the same parent, return null - if (e1->reg[1] == e2->reg[1]) + if (e1->reg[1] == e2->reg[1]) return ((struct Site *) NULL); - + d = e1->a * e2->b - e1->b * e2->a; - if (-1.0e-10<d && d<1.0e-10) + if (-1.0e-10<d && d<1.0e-10) return ((struct Site *) NULL); - + xint = (e1->c*e2->b - e2->c*e1->b)/d; yint = (e2->c*e1->a - e1->c*e2->a)/d; - + if( (e1->reg[1]->coord.y < e2->reg[1]->coord.y) || (e1->reg[1]->coord.y == e2->reg[1]->coord.y && e1->reg[1]->coord.x < e2->reg[1]->coord.x) ) - { - el = el1; + { + el = el1; e = e1; } else - { - el = el2; + { + el = el2; e = e2; }; - + right_of_site = xint >= e -> reg[1] -> coord.x; - if ((right_of_site && el -> ELpm == le) || (!right_of_site && el -> ELpm == re)) + if ((right_of_site && el -> ELpm == le) || (!right_of_site && el -> ELpm == re)) return ((struct Site *) NULL); - + //create a new site at the point of intersection - this is a new vector event waiting to happen v = (struct Site *) getfree(&sfl); v -> refcnt = 0; @@ -404,22 +404,22 @@ struct Site *topsite; int right_of_site, above, fast; double dxp, dyp, dxs, t1, t2, t3, yl; - + e = el -> ELedge; topsite = e -> reg[1]; right_of_site = p -> x > topsite -> coord.x; if(right_of_site && el -> ELpm == le) return(1); if(!right_of_site && el -> ELpm == re) return (0); - + if (e->a == 1.0) { dyp = p->y - topsite->coord.y; dxp = p->x - topsite->coord.x; fast = 0; if ((!right_of_site & (e->b<0.0)) | (right_of_site & (e->b>=0.0)) ) - { above = dyp>= e->b*dxp; + { above = dyp>= e->b*dxp; fast = above; } - else + else { above = p->x + p->y*e->b > e-> c; if(e->b<0.0) above = !above; if (!above) fast = 1; @@ -446,7 +446,7 @@ { e -> ep[lr] = s; ref(s); - if(e -> ep[re-lr]== (struct Site *) NULL) + if(e -> ep[re-lr]== (struct Site *) NULL) return; clip_line(e); @@ -477,7 +477,7 @@ void VoronoiDiagramGenerator::deref(struct Site *v) { v -> refcnt -= 1; - if (v -> refcnt == 0 ) + if (v -> refcnt == 0 ) makefree((Freenode*)v, &sfl); ... [truncated message content]
Revision: 7305 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7305&view=rev Author: evilguru Date: 2009年07月29日 16:58:13 +0000 (2009年7月29日) Log Message: ----------- Try to add merge tracking to the mathtex branch. Property Changed: ---------------- branches/mathtex/ Property changes on: branches/mathtex ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7253 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7253 /trunk/matplotlib:1-7262 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7304 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7304&view=rev Author: evilguru Date: 2009年07月29日 09:57:39 +0000 (2009年7月29日) Log Message: ----------- Add support for mathtext.default to the OS X backend. This still requires testing from a Mac user. Modified Paths: -------------- branches/mathtex/lib/matplotlib/backends/backend_macosx.py Modified: branches/mathtex/lib/matplotlib/backends/backend_macosx.py =================================================================== --- branches/mathtex/lib/matplotlib/backends/backend_macosx.py 2009年07月28日 22:43:15 UTC (rev 7303) +++ branches/mathtex/lib/matplotlib/backends/backend_macosx.py 2009年07月29日 09:57:39 UTC (rev 7304) @@ -97,7 +97,8 @@ if not HAVE_MATHTEX: return - m = Mathtex(s, rcParams['mathtext.fontset'], prop.get_size_in_points(), self.dpi) + m = Mathtex(s, rcParams['mathtext.fontset'], prop.get_size_in_points(), + self.dpi, rcParams['mathtext.default']) b = MathtexBackendImage() m.render_to_backend(b) @@ -125,7 +126,7 @@ if ismath: if HAVE_MATHTEX: m = Mathtex(s, rcParams['mathtext.fontset'], - prop.get_size_in_points(), self.dpi) + prop.get_size_in_points(), self.dpi, rcParams['mathtext.default']) return m.width, m.height, m.depth else: warnings.warn('matplotlib was compiled without mathtex support. ' + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.