SourceForge logo
SourceForge logo
Menu

matplotlib-checkins — Commit notification. DO NOT POST to this list, just subscribe to it.

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)

Showing results of 83

1 2 3 4 > >> (Page 1 of 4)
From: <jd...@us...> - 2009年07月31日 18:55:29
Revision: 7327
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7327&view=rev
Author: jdh2358
Date: 2009年07月31日 18:55:17 +0000 (2009年7月31日)
Log Message:
-----------
added lena to mpl_data
Added Paths:
-----------
 trunk/mpl_data/
 trunk/mpl_data/lena.png
Added: trunk/mpl_data/lena.png
===================================================================
(Binary files differ)
Property changes on: trunk/mpl_data/lena.png
___________________________________________________________________
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: <jd...@us...> - 2009年07月31日 18:11:58
Revision: 7326
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7326&view=rev
Author: jdh2358
Date: 2009年07月31日 18:11:50 +0000 (2009年7月31日)
Log Message:
-----------
update the makefile for win32 build
Modified Paths:
--------------
 branches/v0_99_maint/release/win32/Makefile
Modified: branches/v0_99_maint/release/win32/Makefile
===================================================================
--- branches/v0_99_maint/release/win32/Makefile	2009年07月31日 15:52:19 UTC (rev 7325)
+++ branches/v0_99_maint/release/win32/Makefile	2009年07月31日 18:11:50 UTC (rev 7326)
@@ -1,4 +1,4 @@
-PYDIR = C:/Python26
+PYDIR = C:/Python25
 PYTHON = ${PYDIR}/python.exe
 SRCDIR = ${PWD}
 WINSRCDIR = `${PWD}/data/mingw_path.sh ${PWD}`
@@ -6,7 +6,7 @@
 PNGVERSION = 1.2.36
 FREETYPEVERSION = 2.3.9
 TCLTKVERSION = 8.5.7
-MPLVERSION = 0.98.5.3
+MPLVERSION = 0.99.0.rc1
 
 ## You shouldn't need to configure past this point
 
@@ -89,8 +89,8 @@
 	rm -rf build &&\
 	cp ../data/setup*.* . &&\
 	export CFLAGS="${CFLAGS}" &&\
-	${PYTHON} setupwin.py build_ext -c mingw32 -I ${PY_INCLUDE} -L ${PY_LINKER} bdist_wininst 
-	#${PYTHON} setupwinegg.py build_ext -c mingw32 -I ${PY_INCLUDE} -L ${PY_LINKER} bdist_egg
+	${PYTHON} setupwin.py build_ext -c mingw32 -I ${PY_INCLUDE} -L ${PY_LINKER} bdist_wininst &&\
+	${PYTHON} setupwinegg.py build_ext -c mingw32 -I ${PY_INCLUDE} -L ${PY_LINKER} bdist_egg
 
 
 inplace:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jd...@us...> - 2009年07月31日 15:52:28
Revision: 7325
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7325&view=rev
Author: jdh2358
Date: 2009年07月31日 15:52:19 +0000 (2009年7月31日)
Log Message:
-----------
added miktex win32 patch from sf patch 2820194
Modified Paths:
--------------
 branches/v0_99_maint/lib/matplotlib/texmanager.py
 branches/v0_99_maint/setupext.py
Modified: branches/v0_99_maint/lib/matplotlib/texmanager.py
===================================================================
--- branches/v0_99_maint/lib/matplotlib/texmanager.py	2009年07月31日 15:39:30 UTC (rev 7324)
+++ branches/v0_99_maint/lib/matplotlib/texmanager.py	2009年07月31日 15:52:19 UTC (rev 7325)
@@ -56,7 +56,7 @@
 
 def dvipng_hack_alpha():
 p = Popen('dvipng -version', shell=True, stdin=PIPE, stdout=PIPE,
- stderr=STDOUT, close_fds=True)
+ stderr=STDOUT, close_fds=(sys.platform!='win32'))
 stdin, stdout = p.stdin, p.stdout
 for line in stdout:
 if line.startswith('dvipng '):
Modified: branches/v0_99_maint/setupext.py
===================================================================
--- branches/v0_99_maint/setupext.py	2009年07月31日 15:39:30 UTC (rev 7324)
+++ branches/v0_99_maint/setupext.py	2009年07月31日 15:52:19 UTC (rev 7325)
@@ -174,7 +174,7 @@
 stdin=subprocess.PIPE,
 stdout=subprocess.PIPE,
 stderr=subprocess.STDOUT,
- close_fds=True)
+ close_fds=(sys.platform != 'win32'))
 return p.stdin, p.stdout
 
 class CleanUpFile:
@@ -458,7 +458,7 @@
 try:
 stdin, stdout = run_child_process('latex -version')
 line = stdout.readlines()[0]
- pattern = '3\.1\d+'
+ pattern = '(3\.1\d+)|(MiKTeX \d+.\d+)'
 match = re.search(pattern, line)
 print_status("latex", match.group(0))
 return True
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jd...@us...> - 2009年07月31日 15:39:40
Revision: 7324
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7324&view=rev
Author: jdh2358
Date: 2009年07月31日 15:39:30 +0000 (2009年7月31日)
Log Message:
-----------
revert setupext.py patch for osx; breaks my osx test build
Modified Paths:
--------------
 branches/v0_99_maint/setupext.py
Modified: branches/v0_99_maint/setupext.py
===================================================================
--- branches/v0_99_maint/setupext.py	2009年07月31日 15:32:11 UTC (rev 7323)
+++ branches/v0_99_maint/setupext.py	2009年07月31日 15:39:30 UTC (rev 7324)
@@ -51,7 +51,7 @@
 'linux' : ['/usr/local', '/usr',],
 'cygwin' : ['/usr/local', '/usr',],
 'darwin' : ['/sw/lib/freetype2', '/sw/lib/freetype219', '/usr/local',
- '/usr', '/sw'],
+ '/usr', '/sw', '/usr/X11R6'],
 'freebsd4' : ['/usr/local', '/usr'],
 'freebsd5' : ['/usr/local', '/usr'],
 'freebsd6' : ['/usr/local', '/usr'],
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jd...@us...> - 2009年07月31日 15:32:17
Revision: 7323
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7323&view=rev
Author: jdh2358
Date: 2009年07月31日 15:32:11 +0000 (2009年7月31日)
Log Message:
-----------
apply sf patches 2830233 and 2823885 for osx setup and 64 bit; thanks Michiel
Modified Paths:
--------------
 branches/v0_99_maint/release/osx/Makefile
 branches/v0_99_maint/setupext.py
 branches/v0_99_maint/src/_macosx.m
Modified: branches/v0_99_maint/release/osx/Makefile
===================================================================
--- branches/v0_99_maint/release/osx/Makefile	2009年07月31日 13:49:33 UTC (rev 7322)
+++ branches/v0_99_maint/release/osx/Makefile	2009年07月31日 15:32:11 UTC (rev 7323)
@@ -2,7 +2,7 @@
 ZLIBVERSION=1.2.3
 PNGVERSION=1.2.33
 FREETYPEVERSION=2.3.7
-MPLVERSION=0.98.5.3
+MPLVERSION=0.99.0.rc1
 MPLSRC=matplotlib-${MPLVERSION}
 MACOSX_DEPLOYMENT_TARGET=10.4
 
Modified: branches/v0_99_maint/setupext.py
===================================================================
--- branches/v0_99_maint/setupext.py	2009年07月31日 13:49:33 UTC (rev 7322)
+++ branches/v0_99_maint/setupext.py	2009年07月31日 15:32:11 UTC (rev 7323)
@@ -51,7 +51,7 @@
 'linux' : ['/usr/local', '/usr',],
 'cygwin' : ['/usr/local', '/usr',],
 'darwin' : ['/sw/lib/freetype2', '/sw/lib/freetype219', '/usr/local',
- '/usr', '/sw', '/usr/X11R6'],
+ '/usr', '/sw'],
 'freebsd4' : ['/usr/local', '/usr'],
 'freebsd5' : ['/usr/local', '/usr'],
 'freebsd6' : ['/usr/local', '/usr'],
Modified: branches/v0_99_maint/src/_macosx.m
===================================================================
--- branches/v0_99_maint/src/_macosx.m	2009年07月31日 13:49:33 UTC (rev 7322)
+++ branches/v0_99_maint/src/_macosx.m	2009年07月31日 15:32:11 UTC (rev 7323)
@@ -7,15 +7,19 @@
 
 
 static int nwin = 0; /* The number of open windows */
+
+/* Use Atsui for Mac OS X 10.4, CoreText for Mac OS X 10.5 */
+#ifndef MAC_OS_X_VERSION_10_5
 static int ngc = 0; /* The number of graphics contexts in use */
 
 
 /* For drawing Unicode strings with ATSUI */
 static ATSUStyle style = NULL;
 static ATSUTextLayout layout = NULL;
+#endif
 
 /* CGFloat was defined in Mac OS X 10.5 */
-#ifndef CGFloat
+#ifndef CGFLOAT_DEFINED
 #define CGFloat float
 #endif
 
@@ -171,6 +175,7 @@
 return 1;
 }
 
+#ifndef MAC_OS_X_VERSION_10_5
 static int _init_atsui(void)
 {
 OSStatus status;
@@ -208,6 +213,7 @@
 if (status!=noErr)
 PyErr_WarnEx(PyExc_RuntimeWarning, "ATSUDisposeTextLayout failed", 1);
 }
+#endif
 
 static int _draw_path(CGContextRef cr, void* iterator)
 {
@@ -336,6 +342,10 @@
 - (void)mouseUp:(NSEvent*)event;
 - (void)mouseDragged:(NSEvent*)event;
 - (void)mouseMoved:(NSEvent*)event;
+- (void)rightMouseDown:(NSEvent*)event;
+- (void)rightMouseUp:(NSEvent*)event;
+- (void)otherMouseDown:(NSEvent*)event;
+- (void)otherMouseUp:(NSEvent*)event;
 - (void)setRubberband:(NSRect)rect;
 - (void)removeRubberband;
 - (const char*)convertKeyEvent:(NSEvent*)event;
@@ -375,6 +385,7 @@
 CGContextRef cr;
 NSSize size;
 int level;
+ CGFloat color[4];
 } GraphicsContext;
 
 static CGMutablePathRef _create_path(void* iterator)
@@ -440,6 +451,7 @@
 self->cr = NULL;
 self->level = 0;
 
+#ifndef MAC_OS_X_VERSION_10_5
 if (ngc==0)
 {
 int ok = _init_atsui();
@@ -449,10 +461,12 @@
 }
 }
 ngc++;
+#endif
 
 return (PyObject*) self;
 }
 
+#ifndef MAC_OS_X_VERSION_10_5
 static void
 GraphicsContext_dealloc(GraphicsContext *self)
 {
@@ -461,6 +475,7 @@
 
 self->ob_type->tp_free((PyObject*)self);
 }
+#endif
 
 static PyObject*
 GraphicsContext_repr(GraphicsContext* self)
@@ -516,6 +531,9 @@
 return NULL;
 }
 CGContextSetAlpha(cr, alpha);
+ 
+ self->color[3] = alpha;
+
 Py_INCREF(Py_None);
 return Py_None;
 }
@@ -651,7 +669,7 @@
 static BOOL
 _set_dashes(CGContextRef cr, PyObject* linestyle)
 {
- float phase = 0.0;
+ CGFloat phase = 0.0;
 PyObject* offset;
 PyObject* dashes;
 
@@ -686,7 +704,7 @@
 }
 int n = PyTuple_GET_SIZE(dashes);
 int i;
- float* lengths = malloc(n*sizeof(float));
+ CGFloat* lengths = malloc(n*sizeof(CGFloat));
 if(!lengths)
 {
 PyErr_SetString(PyExc_MemoryError, "Failed to store dashes");
@@ -697,9 +715,9 @@
 {
 PyObject* value = PyTuple_GET_ITEM(dashes, i);
 if (PyFloat_Check(value))
- lengths[i] = (float) PyFloat_AS_DOUBLE(value);
+ lengths[i] = (CGFloat) PyFloat_AS_DOUBLE(value);
 else if (PyInt_Check(value))
- lengths[i] = (float) PyInt_AS_LONG(value);
+ lengths[i] = (CGFloat) PyInt_AS_LONG(value);
 else break;
 }
 Py_DECREF(dashes);
@@ -750,6 +768,11 @@
 
 CGContextSetRGBStrokeColor(cr, r, g, b, 1.0);
 CGContextSetRGBFillColor(cr, r, g, b, 1.0);
+
+ self->color[0] = r;
+ self->color[1] = g;
+ self->color[2] = b;
+
 Py_INCREF(Py_None);
 return Py_None;
 }
@@ -889,28 +912,12 @@
 }
 else
 {
- int ok;
- float color[4] = {0, 0, 0, 1};
 CGPatternRef pattern;
 CGColorSpaceRef baseSpace;
 CGColorSpaceRef patternSpace;
 static const CGPatternCallbacks callbacks = {0,
 &_draw_hatch,
 &_release_hatch};
- PyObject* rgb = PyObject_CallMethod((PyObject*)self, "get_rgb", "");
- if (!rgb)
- {
- Py_DECREF(hatchpath);
- return NULL;
- }
- ok = PyArg_ParseTuple(rgb, "ffff", &color[0], &color[1], &color[2], &color[3]);
- Py_DECREF(rgb);
- if (!ok)
- {
- Py_DECREF(hatchpath);
- return NULL;
- }
-
 baseSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
 if (!baseSpace)
 {
@@ -938,7 +945,7 @@
 kCGPatternTilingNoDistortion,
 false,
 &callbacks);
- CGContextSetFillPattern(cr, pattern, color);
+ CGContextSetFillPattern(cr, pattern, self->color);
 CGPatternRelease(pattern);
 iterator = get_path_iterator(path,
 transform,
@@ -1227,6 +1234,8 @@
 
 if (Ntransforms)
 {
+ CGAffineTransform master;
+ double a, b, c, d, tx, ty;
 PyObject* values = PyObject_CallMethod(master_transform, "to_values", "");
 if (!values)
 {
@@ -1239,15 +1248,15 @@
 ok = 0;
 goto exit;
 }
- CGAffineTransform master;
- ok = PyArg_ParseTuple(values, "ffffff",
- &master.a,
- &master.b,
- &master.c,
- &master.d,
- &master.tx,
- &master.ty);
+ /* CGAffineTransform contains CGFloat; cannot use master directly */
+ ok = PyArg_ParseTuple(values, "dddddd", &a, &b, &c, &d, &tx, &ty);
 Py_DECREF(values);
+ master.a = a;
+ master.b = b;
+ master.c = c;
+ master.d = d;
+ master.tx = tx;
+	master.ty = ty;
 if (!ok) goto exit;
 CGContextConcatCTM(cr, master);
 }
@@ -1652,13 +1661,15 @@
 }
 if (PyTuple_Check(values))
 {
- ok = PyArg_ParseTuple(values, "ffffff",
- &master.a,
- &master.b,
- &master.c,
- &master.d,
- &master.tx,
- &master.ty);
+ double a, b, c, d, tx, ty;
+ /* CGAffineTransform contains CGFloat; cannot use master directly */
+ ok = PyArg_ParseTuple(values, "dddddd", &a, &b, &c, &d, &tx, &ty);
+ master.a = a;
+ master.b = b;
+ master.c = c;
+ master.d = d;
+ master.tx = tx;
+	master.ty = ty;
 }
 else
 {
@@ -1866,7 +1877,11 @@
 }
 
 
+#ifdef MAC_OS_X_VERSION_10_5
+static CTFontRef
+#else
 static ATSFontRef
+#endif
 setfont(CGContextRef cr, PyObject* family, float size, const char weight[],
 const char italic[])
 {
@@ -1876,7 +1891,11 @@
 const char* temp;
 const char* name = "Times-Roman";
 CFStringRef string;
- ATSFontRef atsfont = 0;
+#ifdef MAC_OS_X_VERSION_10_5
+ CTFontRef font = 0;
+#else
+ ATSFontRef font = 0;
+#endif
 
 const int k = (strcmp(italic, "italic") ? 0 : 2)
 + (strcmp(weight, "bold") ? 0 : 1);
@@ -2072,26 +2091,38 @@
 string = CFStringCreateWithCString(kCFAllocatorDefault,
 temp,
 kCFStringEncodingMacRoman);
- atsfont = ATSFontFindFromPostScriptName(string, kATSOptionFlagsDefault);
+#ifdef MAC_OS_X_VERSION_10_5
+ font = CTFontCreateWithName(string, size, NULL);
+#else
+ font = ATSFontFindFromPostScriptName(string, kATSOptionFlagsDefault);
+#endif
+
 CFRelease(string);
 
- if(atsfont)
+ if(font)
 {
 name = temp;
 break;
 }
 }
- if(!atsfont)
+ if(!font)
 { string = CFStringCreateWithCString(kCFAllocatorDefault,
 name,
 kCFStringEncodingMacRoman);
- atsfont = ATSFontFindFromPostScriptName(string, kATSOptionFlagsDefault);
+#ifdef MAC_OS_X_VERSION_10_5
+ font = CTFontCreateWithName(string, size, NULL);
+#else
+ font = ATSFontFindFromPostScriptName(string, kATSOptionFlagsDefault);
+#endif
 CFRelease(string);
 }
+#ifndef MAC_OS_X_VERSION_10_5
 CGContextSelectFont(cr, name, size, kCGEncodingMacRoman);
- return atsfont;
+#endif
+ return font;
 }
 
+#ifdef MAC_OS_X_VERSION_10_5
 static PyObject*
 GraphicsContext_draw_text (GraphicsContext* self, PyObject* args)
 {
@@ -2104,6 +2135,174 @@
 const char* weight;
 const char* italic;
 float angle;
+ CTFontRef font;
+ CGColorRef color;
+ CGFloat descent;
+
+ CFStringRef keys[2];
+ CFTypeRef values[2];
+
+ CGContextRef cr = self->cr;
+ if (!cr)
+ {
+ PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL");
+ return NULL;
+ }
+
+ if(!PyArg_ParseTuple(args, "ffu#Ofssf",
+ &x,
+ &y,
+ &text,
+ &n,
+ &family,
+ &size,
+ &weight,
+ &italic,
+ &angle)) return NULL;
+
+ font = setfont(cr, family, size, weight, italic);
+
+ color = CGColorCreateGenericRGB(self->color[0],
+ self->color[1],
+ self->color[2],
+ self->color[3]);
+
+ keys[0] = kCTFontAttributeName;
+ keys[1] = kCTForegroundColorAttributeName;
+ values[0] = font;
+ values[1] = color;
+ CFDictionaryRef attributes = CFDictionaryCreate(kCFAllocatorDefault,
+ (const void**)&keys,
+ (const void**)&values,
+ 2,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+ CGColorRelease(color);
+ CFRelease(font);
+
+ CFStringRef s = CFStringCreateWithCharacters(kCFAllocatorDefault, text, n);
+
+ CFAttributedStringRef string = CFAttributedStringCreate(kCFAllocatorDefault,
+ s,
+ attributes);
+ CFRelease(s);
+ CFRelease(attributes);
+
+ CTLineRef line = CTLineCreateWithAttributedString(string);
+ CFRelease(string);
+
+ CTLineGetTypographicBounds(line, NULL, &descent, NULL);
+
+ if (!line)
+ {
+ PyErr_SetString(PyExc_RuntimeError,
+ "CTLineCreateWithAttributedString failed");
+ return NULL;
+ }
+
+ CGContextSetTextMatrix(cr, CGAffineTransformIdentity);
+ if (angle)
+ {
+ CGContextSaveGState(cr);
+ CGContextTranslateCTM(cr, x, y);
+ CGContextRotateCTM(cr, angle*M_PI/180);
+ CTLineDraw(line, cr);
+ CGContextRestoreGState(cr);
+ }
+ else
+ {
+ CGContextSetTextPosition(cr, x, y);
+ CTLineDraw(line, cr);
+ }
+ CFRelease(line);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static PyObject*
+GraphicsContext_get_text_width_height_descent(GraphicsContext* self, PyObject* args)
+{
+ const UniChar* text;
+ int n;
+ PyObject* family;
+ float size;
+ const char* weight;
+ const char* italic;
+
+ CGFloat ascent;
+ CGFloat descent;
+ double width;
+ CGRect rect;
+
+ CTFontRef font;
+
+ CGContextRef cr = self->cr;
+ if (!cr)
+ {
+ PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL");
+ return NULL;
+ }
+
+ if(!PyArg_ParseTuple(args, "u#Ofss",
+ &text, &n, &family, &size, &weight, &italic))
+ return NULL;
+
+ font = setfont(cr, family, size, weight, italic);
+
+ CFStringRef keys[1];
+ CFTypeRef values[1];
+
+ keys[0] = kCTFontAttributeName;
+ values[0] = font;
+ CFDictionaryRef attributes = CFDictionaryCreate(kCFAllocatorDefault,
+ (const void**)&keys,
+ (const void**)&values,
+ 1,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+ CFRelease(font);
+
+ CFStringRef s = CFStringCreateWithCharacters(kCFAllocatorDefault, text, n);
+
+ CFAttributedStringRef string = CFAttributedStringCreate(kCFAllocatorDefault,
+ s,
+ attributes);
+ CFRelease(s);
+ CFRelease(attributes);
+
+ CTLineRef line = CTLineCreateWithAttributedString(string);
+ CFRelease(string);
+
+ if (!line)
+ {
+ PyErr_SetString(PyExc_RuntimeError,
+ "CTLineCreateWithAttributedString failed");
+ return NULL;
+ }
+
+ width = CTLineGetTypographicBounds(line, &ascent, &descent, NULL);
+ rect = CTLineGetImageBounds(line, cr);
+ 
+ CFRelease(line);
+
+ return Py_BuildValue("fff", width, rect.size.height, descent);
+}
+
+#else
+
+static PyObject*
+GraphicsContext_draw_text (GraphicsContext* self, PyObject* args)
+{
+ float x;
+ float y;
+ const UniChar* text;
+ int n;
+ PyObject* family;
+ float size;
+ const char* weight;
+ const char* italic;
+ float angle;
 ATSFontRef atsfont;
 CGContextRef cr = self->cr;
 if (!cr)
@@ -2188,6 +2387,102 @@
 return Py_None;
 }
 
+static PyObject*
+GraphicsContext_get_text_width_height_descent(GraphicsContext* self, PyObject* args)
+{
+ const UniChar* text;
+ int n;
+ PyObject* family;
+ float size;
+ const char* weight;
+ const char* italic;
+
+ ATSFontRef atsfont;
+
+ CGContextRef cr = self->cr;
+ if (!cr)
+ {
+ PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL");
+ return NULL;
+ }
+
+ if(!PyArg_ParseTuple(args, "u#Ofss", &text, &n, &family, &size, &weight, &italic)) return NULL;
+
+ atsfont = setfont(cr, family, size, weight, italic);
+
+ OSStatus status = noErr;
+ ATSUAttributeTag tags[] = {kATSUFontTag,
+ kATSUSizeTag,
+ kATSUQDBoldfaceTag,
+ kATSUQDItalicTag};
+ ByteCount sizes[] = {sizeof(ATSUFontID),
+ sizeof(Fixed),
+ sizeof(Boolean),
+ sizeof(Boolean)};
+ Fixed atsuSize = Long2Fix(size);
+ Boolean isBold = FALSE; /* setfont takes care of this */
+ Boolean isItalic = FALSE; /* setfont takes care of this */
+ ATSUAttributeValuePtr values[] = {&atsfont, &atsuSize, &isBold, &isItalic};
+
+ status = ATSUSetAttributes(style, 4, tags, sizes, values);
+ if (status!=noErr)
+ {
+ PyErr_SetString(PyExc_RuntimeError, "ATSUSetAttributes failed");
+ return NULL;
+ }
+
+ status = ATSUSetTextPointerLocation(layout,
+ text,
+ kATSUFromTextBeginning, /* offset from beginning */
+ kATSUToTextEnd, /* length of text range */
+ n); /* length of text buffer */
+ if (status!=noErr)
+ {
+ PyErr_SetString(PyExc_RuntimeError,
+ "ATSUCreateTextLayoutWithTextPtr failed");
+ return NULL;
+ }
+
+ status = ATSUSetRunStyle(layout,
+ style,
+ kATSUFromTextBeginning,
+ kATSUToTextEnd);
+ if (status!=noErr)
+ {
+ PyErr_SetString(PyExc_RuntimeError, "ATSUSetRunStyle failed");
+ return NULL;
+ }
+
+ ATSUAttributeTag tag = kATSUCGContextTag;
+ ByteCount bc = sizeof (CGContextRef);
+ ATSUAttributeValuePtr value = &cr;
+ status = ATSUSetLayoutControls(layout, 1, &tag, &bc, &value);
+ if (status!=noErr)
+ {
+ PyErr_SetString(PyExc_RuntimeError, "ATSUSetLayoutControls failed");
+ return NULL;
+ }
+
+ ATSUTextMeasurement before;
+ ATSUTextMeasurement after;
+ ATSUTextMeasurement ascent;
+ ATSUTextMeasurement descent;
+ status = ATSUGetUnjustifiedBounds(layout,
+ kATSUFromTextBeginning, kATSUToTextEnd,
+ &before, &after, &ascent, &descent);
+ if (status!=noErr)
+ {
+ PyErr_SetString(PyExc_RuntimeError, "ATSUGetUnjustifiedBounds failed");
+ return NULL;
+ }
+
+ const float width = FixedToFloat(after-before);
+ const float height = FixedToFloat(ascent-descent);
+
+ return Py_BuildValue("fff", width, height, FixedToFloat(descent));
+}
+#endif
+
 static void _data_provider_release(void* info, const void* data, size_t size)
 {
 PyObject* image = (PyObject*)info;
@@ -2293,101 +2588,6 @@
 }
 
 static PyObject*
-GraphicsContext_get_text_width_height_descent(GraphicsContext* self, PyObject* args)
-{
- const UniChar* text;
- int n;
- PyObject* family;
- float size;
- const char* weight;
- const char* italic;
-
- ATSFontRef atsfont;
-
- CGContextRef cr = self->cr;
- if (!cr)
- {
- PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL");
- return NULL;
- }
-
- if(!PyArg_ParseTuple(args, "u#Ofss", &text, &n, &family, &size, &weight, &italic)) return NULL;
-
- atsfont = setfont(cr, family, size, weight, italic);
-
- OSStatus status = noErr;
- ATSUAttributeTag tags[] = {kATSUFontTag,
- kATSUSizeTag,
- kATSUQDBoldfaceTag,
- kATSUQDItalicTag};
- ByteCount sizes[] = {sizeof(ATSUFontID),
- sizeof(Fixed),
- sizeof(Boolean),
- sizeof(Boolean)};
- Fixed atsuSize = Long2Fix(size);
- Boolean isBold = FALSE; /* setfont takes care of this */
- Boolean isItalic = FALSE; /* setfont takes care of this */
- ATSUAttributeValuePtr values[] = {&atsfont, &atsuSize, &isBold, &isItalic};
-
- status = ATSUSetAttributes(style, 4, tags, sizes, values);
- if (status!=noErr)
- {
- PyErr_SetString(PyExc_RuntimeError, "ATSUSetAttributes failed");
- return NULL;
- }
-
- status = ATSUSetTextPointerLocation(layout,
- text,
- kATSUFromTextBeginning, /* offset from beginning */
- kATSUToTextEnd, /* length of text range */
- n); /* length of text buffer */
- if (status!=noErr)
- {
- PyErr_SetString(PyExc_RuntimeError,
- "ATSUCreateTextLayoutWithTextPtr failed");
- return NULL;
- }
-
- status = ATSUSetRunStyle(layout,
- style,
- kATSUFromTextBeginning,
- kATSUToTextEnd);
- if (status!=noErr)
- {
- PyErr_SetString(PyExc_RuntimeError, "ATSUSetRunStyle failed");
- return NULL;
- }
-
- ATSUAttributeTag tag = kATSUCGContextTag;
- ByteCount bc = sizeof (CGContextRef);
- ATSUAttributeValuePtr value = &cr;
- status = ATSUSetLayoutControls(layout, 1, &tag, &bc, &value);
- if (status!=noErr)
- {
- PyErr_SetString(PyExc_RuntimeError, "ATSUSetLayoutControls failed");
- return NULL;
- }
-
- ATSUTextMeasurement before;
- ATSUTextMeasurement after;
- ATSUTextMeasurement ascent;
- ATSUTextMeasurement descent;
- status = ATSUGetUnjustifiedBounds(layout,
- kATSUFromTextBeginning, kATSUToTextEnd,
- &before, &after, &ascent, &descent);
- if (status!=noErr)
- {
- PyErr_SetString(PyExc_RuntimeError, "ATSUGetUnjustifiedBounds failed");
- return NULL;
- }
-
- const float width = FixedToFloat(after-before);
- const float height = FixedToFloat(ascent-descent);
-
- return Py_BuildValue("fff", width, height, FixedToFloat(descent));
-}
-
-static PyObject*
 GraphicsContext_draw_image(GraphicsContext* self, PyObject* args)
 {
 float x, y;
@@ -2621,7 +2821,11 @@
 "_macosx.GraphicsContext", /*tp_name*/
 sizeof(GraphicsContext), /*tp_basicsize*/
 0, /*tp_itemsize*/
+#ifdef MAC_OS_X_VERSION_10_5
+ 0, /*tp_dealloc*/
+#else
 (destructor)GraphicsContext_dealloc, /*tp_dealloc*/
+#endif
 0, /*tp_print*/
 0, /*tp_getattr*/
 0, /*tp_setattr*/
@@ -2826,15 +3030,18 @@
 int n;
 const unichar* characters;
 NSSize size;
+ double width, height;
 
 if(!view)
 {
 PyErr_SetString(PyExc_RuntimeError, "NSView* is NULL");
 return NULL;
 }
- if(!PyArg_ParseTuple(args, "u#ff",
-				&characters, &n,
-				&size.width, &size.height)) return NULL;
+ /* NSSize contains CGFloat; cannot use size directly */
+ if(!PyArg_ParseTuple(args, "u#dd",
+				&characters, &n, &width, &height)) return NULL;
+ size.width = width;
+ size.height = height;
 
 /* This function may be called from inside the event loop, when an
 * autorelease pool is available, or from Python, when no autorelease
@@ -4492,6 +4699,86 @@
 PyGILState_Release(gstate);
 }
 
+- (void)rightMouseDown:(NSEvent *)event
+{
+ int x, y;
+ int num = 3;
+ PyObject* result;
+ PyGILState_STATE gstate;
+ NSPoint location = [event locationInWindow];
+ location = [self convertPoint: location fromView: nil];
+ x = location.x;
+ y = location.y;
+ gstate = PyGILState_Ensure();
+ result = PyObject_CallMethod(canvas, "button_press_event", "iii", x, y, num);
+ if(result)
+ Py_DECREF(result);
+ else
+ PyErr_Print();
+
+ PyGILState_Release(gstate);
+}
+
+- (void)rightMouseUp:(NSEvent *)event
+{
+ int x, y;
+ int num = 3;
+ PyObject* result;
+ PyGILState_STATE gstate;
+ NSPoint location = [event locationInWindow];
+ location = [self convertPoint: location fromView: nil];
+ x = location.x;
+ y = location.y;
+ gstate = PyGILState_Ensure();
+ result = PyObject_CallMethod(canvas, "button_release_event", "iii", x, y, num);
+ if(result)
+ Py_DECREF(result);
+ else
+ PyErr_Print();
+
+ PyGILState_Release(gstate);
+}
+
+- (void)otherMouseDown:(NSEvent *)event
+{
+ int x, y;
+ int num = 2;
+ PyObject* result;
+ PyGILState_STATE gstate;
+ NSPoint location = [event locationInWindow];
+ location = [self convertPoint: location fromView: nil];
+ x = location.x;
+ y = location.y;
+ gstate = PyGILState_Ensure();
+ result = PyObject_CallMethod(canvas, "button_press_event", "iii", x, y, num);
+ if(result)
+ Py_DECREF(result);
+ else
+ PyErr_Print();
+
+ PyGILState_Release(gstate);
+}
+
+- (void)otherMouseUp:(NSEvent *)event
+{
+ int x, y;
+ int num = 2;
+ PyObject* result;
+ PyGILState_STATE gstate;
+ NSPoint location = [event locationInWindow];
+ location = [self convertPoint: location fromView: nil];
+ x = location.x;
+ y = location.y;
+ gstate = PyGILState_Ensure();
+ result = PyObject_CallMethod(canvas, "button_release_event", "iii", x, y, num);
+ if(result)
+ Py_DECREF(result);
+ else
+ PyErr_Print();
+
+ PyGILState_Release(gstate);
+}
+
 - (void)setRubberband:(NSRect)rect
 {
 if (!NSIsEmptyRect(rubberband)) [self setNeedsDisplayInRect: rubberband];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2009年07月31日 13:49:41
Revision: 7322
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7322&view=rev
Author: mdboom
Date: 2009年07月31日 13:49:33 +0000 (2009年7月31日)
Log Message:
-----------
Removed merge tracking for "svnmerge" for 
https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_91_maint
Property Changed:
----------------
 trunk/matplotlib/
Property changes on: trunk/matplotlib
___________________________________________________________________
Modified: svnmerge-integrated
 - /branches/mathtex:1-7263 /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7253 /branches/v0_99_maint:1-7318
 + /branches/mathtex:1-7263 /branches/v0_98_5_maint:1-7253 /branches/v0_99_maint:1-7318
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2009年07月31日 13:46:44
Revision: 7320
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7320&view=rev
Author: mdboom
Date: 2009年07月31日 13:46:28 +0000 (2009年7月31日)
Log Message:
-----------
Initialized merge tracking via "svnmerge" with revisions "1-7315" from 
https://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib
Property Changed:
----------------
 branches/v0_99_maint/
Property changes on: branches/v0_99_maint
___________________________________________________________________
Modified: svnmerge-integrated
 - /branches/mathtex:1-7263 /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7253
 + /branches/mathtex:1-7263 /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7253 /trunk/matplotlib:1-7315
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2009年07月31日 13:46:40
Revision: 7321
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7321&view=rev
Author: mdboom
Date: 2009年07月31日 13:46:28 +0000 (2009年7月31日)
Log Message:
-----------
Update coding guide for 0.99 version
Modified Paths:
--------------
 trunk/matplotlib/doc/devel/coding_guide.rst
Modified: trunk/matplotlib/doc/devel/coding_guide.rst
===================================================================
--- trunk/matplotlib/doc/devel/coding_guide.rst	2009年07月31日 13:46:28 UTC (rev 7320)
+++ trunk/matplotlib/doc/devel/coding_guide.rst	2009年07月31日 13:46:28 UTC (rev 7321)
@@ -27,12 +27,12 @@
 Branch checkouts, eg the maintenance branch::
 
 svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/\
- v0_91_maint mpl91 --username=youruser --password=yourpass
+ v0_99_maint mpl99 --username=youruser --password=yourpass
 
-The current release of the trunk is in the 0.98.5 maintenance branch::
+The current release of the trunk is in the 0.99.x maintenance branch::
 
 svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/\
- v0_98_5_maint mpl98.5 --username=youruser --password=yourpass
+ v0_99_maint mpl99 --username=youruser --password=yourpass
 
 
 Committing changes
@@ -96,7 +96,7 @@
 svnmerge.py merge -S BRANCHNAME
 
 Where BRANCHNAME is the name of the branch to merge *from*,
- e.g. v0_98_5_maint.
+ e.g. v0_99_maint.
 
 If you wish to merge only specific revisions (in an unusual
 situation), do::
@@ -130,17 +130,17 @@
 with this.
 
 * Creating a new branch from the trunk (if the release version is
- 0.98.5 at revision 6573)::
+ 0.99 at revision 6573)::
 
 > svn copy \
- https://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib@6573 \
- https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_98_5_maint \
- -m "Creating maintenance branch for 0.98.5"
+ https://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib@7315 \
+ https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_99_maint \
+ -m "Creating maintenance branch for 0.99"
 
 * You can add a new branch for the trunk to "track" using
 "svnmerge.py init", e.g., from a working copy of the trunk::
 
- > svnmerge.py init https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint
+ > svnmerge.py init https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_99_maint
 property 'svnmerge-integrated' set on '.'
 
 After doing a "svn commit" on this, this merge tracking is available
@@ -150,7 +150,7 @@
 * Tracking can later be removed with the "svnmerge.py uninit" command,
 e.g.::
 
- > svnmerge.py -S v0_9_5_maint uninit
+ > svnmerge.py -S v0_99_maint uninit
 
 .. _using-git:
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jd...@us...> - 2009年07月31日 13:42:33
Revision: 7314
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7314&view=rev
Author: jdh2358
Date: 2009年07月31日 13:28:27 +0000 (2009年7月31日)
Log Message:
-----------
fixed pyplot typo in gridlines
Modified Paths:
--------------
 trunk/matplotlib/examples/tests/backend_driver.py
 trunk/matplotlib/lib/matplotlib/pyplot.py
Modified: trunk/matplotlib/examples/tests/backend_driver.py
===================================================================
--- trunk/matplotlib/examples/tests/backend_driver.py	2009年07月31日 13:15:16 UTC (rev 7313)
+++ trunk/matplotlib/examples/tests/backend_driver.py	2009年07月31日 13:28:27 UTC (rev 7314)
@@ -392,7 +392,8 @@
 doc = __doc__.split('\n\n')
 op = OptionParser(description=doc[0].strip(),
 usage='%prog [options] [--] [backends and switches]',
- epilog='\n'.join(doc[1:]))
+ #epilog='\n'.join(doc[1:]) # epilog not supported on my python2.4 machine: JDH
+ )
 op.disable_interspersed_args()
 op.set_defaults(dirs='pylab,api,units,mplot3d',
 clean=False, coverage=False, valgrind=False)
Modified: trunk/matplotlib/lib/matplotlib/pyplot.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/pyplot.py	2009年07月31日 13:15:16 UTC (rev 7313)
+++ trunk/matplotlib/lib/matplotlib/pyplot.py	2009年07月31日 13:28:27 UTC (rev 7314)
@@ -1102,7 +1102,7 @@
 if not isinstance(ax, PolarAxes):
 raise RuntimeError('rgrids only defined for polar axes')
 if len(args)==0:
- lines = ax.yaxis.gridlines()
+ lines = ax.yaxis.get_gridlines()
 labels = ax.yaxis.get_ticklabels()
 else:
 lines, labels = ax.set_rgrids(*args, **kwargs)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2009年07月31日 13:42:05
Revision: 7319
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7319&view=rev
Author: mdboom
Date: 2009年07月31日 13:41:58 +0000 (2009年7月31日)
Log Message:
-----------
Initialized merge tracking via "svnmerge" with revisions "1-7318" from 
https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_99_maint
Property Changed:
----------------
 trunk/matplotlib/
Property changes on: trunk/matplotlib
___________________________________________________________________
Modified: svnmerge-integrated
 - /branches/mathtex:1-7263 /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7253
 + /branches/mathtex:1-7263 /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7253 /branches/v0_99_maint:1-7318
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2009年07月31日 13:40:02
Revision: 7318
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7318&view=rev
Author: mdboom
Date: 2009年07月31日 13:39:49 +0000 (2009年7月31日)
Log Message:
-----------
Creating 0.99.x maintenance branch
Added Paths:
-----------
 branches/v0_99_maint/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jd...@us...> - 2009年07月31日 13:39:09
Revision: 7317
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7317&view=rev
Author: jdh2358
Date: 2009年07月31日 13:38:56 +0000 (2009年7月31日)
Log Message:
-----------
remove community choice vote from website
Modified Paths:
--------------
 trunk/matplotlib/doc/_templates/indexsidebar.html
 trunk/matplotlib/doc/mpl_toolkits/mplot3d/api.rst
 trunk/matplotlib/doc/users/toolkits.rst
 trunk/matplotlib/examples/tests/backend_driver.py
Modified: trunk/matplotlib/doc/_templates/indexsidebar.html
===================================================================
--- trunk/matplotlib/doc/_templates/indexsidebar.html	2009年07月31日 13:36:38 UTC (rev 7316)
+++ trunk/matplotlib/doc/_templates/indexsidebar.html	2009年07月31日 13:38:56 UTC (rev 7317)
@@ -1,19 +1,13 @@
 <h3>News</h3>
 
+
 <p>Please <a href="http://sourceforge.net/project/project_donations.php?group_id=80706">donate</a>
 to support matplotlib development.</p>
 
+
 <p>Watch a <a href="http://videolectures.net/mloss08_hunter_mat">video lecture</a> about matplotlib presented at <a href="http://videolectures.net/mloss08_whistler">NIPS 08 Workshop</a> <i>Machine Learning Open Source Software</i></a>. 
 </p>
 
-<p>Nominate matplotlib for a community choice award by clicking the
-image below -- suggested category "Best Project for Academia" for
-software which "helps you hit the books, analyze global trends, or
-just understand the world a little bit better than you did before":
-<a href="http://sourceforge.net/images/cca/cca_nominate.png" border="0"/></a>
-</p>
-
-
 <h3>Download</h3>
 <p>Current version: <b>{{ version }}</b></p>
 
Modified: trunk/matplotlib/doc/mpl_toolkits/mplot3d/api.rst
===================================================================
--- trunk/matplotlib/doc/mpl_toolkits/mplot3d/api.rst	2009年07月31日 13:36:38 UTC (rev 7316)
+++ trunk/matplotlib/doc/mpl_toolkits/mplot3d/api.rst	2009年07月31日 13:38:56 UTC (rev 7317)
@@ -7,7 +7,6 @@
 
 .. automodule:: mpl_toolkits.mplot3d.axes3d
 :members:
- :exclude-members: contour3D, contourf3D, plot3D, scatter3D
 :show-inheritance:
 
 :mod:`mpl_toolkits.mplot3d.art3d`
Modified: trunk/matplotlib/doc/users/toolkits.rst
===================================================================
--- trunk/matplotlib/doc/users/toolkits.rst	2009年07月31日 13:36:38 UTC (rev 7316)
+++ trunk/matplotlib/doc/users/toolkits.rst	2009年07月31日 13:38:56 UTC (rev 7317)
@@ -66,5 +66,5 @@
 distributed with matplotlib source.
 
 .. image:: ../_static/demo_axes_grid.png
-
+ 
 See :ref:`toolkit_axesgrid-index` for documentations.
Modified: trunk/matplotlib/examples/tests/backend_driver.py
===================================================================
--- trunk/matplotlib/examples/tests/backend_driver.py	2009年07月31日 13:36:38 UTC (rev 7316)
+++ trunk/matplotlib/examples/tests/backend_driver.py	2009年07月31日 13:38:56 UTC (rev 7317)
@@ -336,7 +336,6 @@
 for fullpath in testcases:
 print ('\tdriving %-40s' % (fullpath)),
 sys.stdout.flush()
-
 fpath, fname = os.path.split(fullpath)
 
 if fname in exclude:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2009年07月31日 13:36:48
Revision: 7316
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7316&view=rev
Author: mdboom
Date: 2009年07月31日 13:36:38 +0000 (2009年7月31日)
Log Message:
-----------
Tagging 0.99.0.rc1
Added Paths:
-----------
 tags/v0_99_0_rc1/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2009年07月31日 13:33:15
Revision: 7315
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7315&view=rev
Author: mdboom
Date: 2009年07月31日 13:33:06 +0000 (2009年7月31日)
Log Message:
-----------
Tagging 0.99.0.rc1 release
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/examples/pylab_examples/log_demo.py
 trunk/matplotlib/lib/matplotlib/__init__.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2009年07月31日 13:28:27 UTC (rev 7314)
+++ trunk/matplotlib/CHANGELOG	2009年07月31日 13:33:06 UTC (rev 7315)
@@ -1,3 +1,7 @@
+======================================================================
+
+2009年07月31日 Tagging 0.99.0.rc1 at 7314 - MGD
+
 2009年07月30日 Add set_cmap and register_cmap, and improve get_cmap,
 to provide convenient handling of user-generated
 colormaps. Reorganized _cm and cm modules. - EF
Modified: trunk/matplotlib/examples/pylab_examples/log_demo.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/log_demo.py	2009年07月31日 13:28:27 UTC (rev 7314)
+++ trunk/matplotlib/examples/pylab_examples/log_demo.py	2009年07月31日 13:33:06 UTC (rev 7315)
@@ -19,7 +19,7 @@
 
 # log x and y axis
 plt.subplot(223)
-plt.loglog(t, 20*np.exp(-t/10.0), basex=4)
+plt.loglog(t, 20*np.exp(-t/10.0), basex=2)
 plt.grid(True)
 plt.title('loglog base 4 on x')
 
Modified: trunk/matplotlib/lib/matplotlib/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/__init__.py	2009年07月31日 13:28:27 UTC (rev 7314)
+++ trunk/matplotlib/lib/matplotlib/__init__.py	2009年07月31日 13:33:06 UTC (rev 7315)
@@ -89,7 +89,7 @@
 """
 from __future__ import generators
 
-__version__ = '0.98.6svn'
+__version__ = '0.99.0.rc1'
 __revision__ = '$Revision$'
 __date__ = '$Date$'
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jd...@us...> - 2009年07月31日 13:15:29
Revision: 7313
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7313&view=rev
Author: jdh2358
Date: 2009年07月31日 13:15:16 +0000 (2009年7月31日)
Log Message:
-----------
make rgrids return grid, not tick, lines
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/lib/matplotlib/projections/polar.py
 trunk/matplotlib/lib/matplotlib/pyplot.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2009年07月31日 05:22:37 UTC (rev 7312)
+++ trunk/matplotlib/CHANGELOG	2009年07月31日 13:15:16 UTC (rev 7313)
@@ -4421,4 +4421,3 @@
 2003年11月21日 - make a dash-dot dict for the GC
 
 2003年12月15日 - fix install path bug
-t
Modified: trunk/matplotlib/lib/matplotlib/projections/polar.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/projections/polar.py	2009年07月31日 05:22:37 UTC (rev 7312)
+++ trunk/matplotlib/lib/matplotlib/projections/polar.py	2009年07月31日 13:15:16 UTC (rev 7313)
@@ -397,7 +397,7 @@
 self._r_label2_position.clear().translate(angle, -self._rpad * rmax)
 for t in self.yaxis.get_ticklabels():
 t.update(kwargs)
- return self.yaxis.get_ticklines(), self.yaxis.get_ticklabels()
+ return self.yaxis.get_gridlines(), self.yaxis.get_ticklabels()
 
 set_rgrids.__doc__ = cbook.dedent(set_rgrids.__doc__) % kwdocd
 
Modified: trunk/matplotlib/lib/matplotlib/pyplot.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/pyplot.py	2009年07月31日 05:22:37 UTC (rev 7312)
+++ trunk/matplotlib/lib/matplotlib/pyplot.py	2009年07月31日 13:15:16 UTC (rev 7313)
@@ -1102,7 +1102,7 @@
 if not isinstance(ax, PolarAxes):
 raise RuntimeError('rgrids only defined for polar axes')
 if len(args)==0:
- lines = ax.yaxis.get_ticklines()
+ lines = ax.yaxis.gridlines()
 labels = ax.yaxis.get_ticklabels()
 else:
 lines, labels = ax.set_rgrids(*args, **kwargs)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2009年07月31日 05:22:49
Revision: 7312
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7312&view=rev
Author: efiring
Date: 2009年07月31日 05:22:37 +0000 (2009年7月31日)
Log Message:
-----------
Removed the colormap data caching--it was trying to solve a non-problem.
Upon installation, the colormap data in _cm.py is compiled into _cm.pyc,
and importing that takes negligible time.
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/lib/matplotlib/cm.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2009年07月31日 02:48:18 UTC (rev 7311)
+++ trunk/matplotlib/CHANGELOG	2009年07月31日 05:22:37 UTC (rev 7312)
@@ -1,7 +1,6 @@
 2009年07月30日 Add set_cmap and register_cmap, and improve get_cmap,
 to provide convenient handling of user-generated
- colormaps. Reorganized _cm and cm modules, and added
- caching of the color data to reduce startup time. - EF
+ colormaps. Reorganized _cm and cm modules. - EF
 
 2009年07月28日 Quiver speed improved, thanks to tip by Ray Speth. -EF
 
Modified: trunk/matplotlib/lib/matplotlib/cm.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/cm.py	2009年07月31日 02:48:18 UTC (rev 7311)
+++ trunk/matplotlib/lib/matplotlib/cm.py	2009年07月31日 05:22:37 UTC (rev 7312)
@@ -1,44 +1,20 @@
 """
-This module contains the instantiations of color mapping classes
+This module provides a large set of colormaps, functions for
+registering new colormaps and for getting a colormap by name,
+and a mixin class for adding color mapping functionality.
+
 """
+
 import os
 
-try:
- import cPickle as pickle
-except ImportError:
- import pickle
-
 import numpy as np
 from numpy import ma
 import matplotlib as mpl
 import matplotlib.colors as colors
 import matplotlib.cbook as cbook
+from matplotlib._cm import datad
 
-LUTSIZE = mpl.rcParams['image.lut']
 
-_cmcache = os.path.join(mpl.get_configdir(), 'colormaps.cache')
-
-loaded = False
-try:
- c = open(_cmcache)
- datad = pickle.load(c)
- c.close()
- mpl.verbose.report("Using colormaps from %s" % _cmcache)
- loaded = True
-except:
- mpl.verbose.report("Could not load colormaps from %s" % _cmcache)
-
-if not loaded:
- from matplotlib._cm import datad
-
- try:
- c = open(_cmcache, 'w')
- pickle.dump(datad, c, 2)
- c.close()
- mpl.verbose.report("New colormap cache in %s" % _cmcache)
- except:
- mpl.verbose.report("Failed to generate colormap cache")
-
 cmap_d = dict()
 
 # reverse all the colormaps.
@@ -51,7 +27,10 @@
 data_r[key] = valnew
 return data_r
 
+LUTSIZE = mpl.rcParams['image.lut']
+
 _cmapnames = datad.keys() # need this list because datad is changed in loop
+
 for cmapname in _cmapnames:
 cmapname_r = cmapname+'_r'
 cmapdat_r = revcmap(datad[cmapname])
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2009年07月31日 02:48:25
Revision: 7311
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7311&view=rev
Author: efiring
Date: 2009年07月31日 02:48:18 +0000 (2009年7月31日)
Log Message:
-----------
Cache the color data to reduce startup time.
Also, cmap kwargs now accept colormap names as strings.
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/lib/matplotlib/_cm.py
 trunk/matplotlib/lib/matplotlib/axes.py
 trunk/matplotlib/lib/matplotlib/cm.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2009年07月30日 21:50:10 UTC (rev 7310)
+++ trunk/matplotlib/CHANGELOG	2009年07月31日 02:48:18 UTC (rev 7311)
@@ -1,6 +1,7 @@
 2009年07月30日 Add set_cmap and register_cmap, and improve get_cmap,
 to provide convenient handling of user-generated
- colormaps. - EF
+ colormaps. Reorganized _cm and cm modules, and added
+ caching of the color data to reduce startup time. - EF
 
 2009年07月28日 Quiver speed improved, thanks to tip by Ray Speth. -EF
 
Modified: trunk/matplotlib/lib/matplotlib/_cm.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/_cm.py	2009年07月30日 21:50:10 UTC (rev 7310)
+++ trunk/matplotlib/lib/matplotlib/_cm.py	2009年07月31日 02:48:18 UTC (rev 7311)
@@ -1,25 +1,15 @@
 """
-Color data and pre-defined cmap objects.
+Nothing here but dictionaries for generating LinearSegmentedColormaps,
+and a dictionary of these dictionaries.
 
-This is a helper for cm.py, originally part of that file.
-Separating the data (this file) from cm.py makes both easier
-to deal with.
-
-Objects visible in cm.py are the individual cmap objects ('autumn',
-etc.) and a dictionary, 'datad', including all of these objects.
 """
 
-import matplotlib as mpl
-import matplotlib.colors as colors
-LUTSIZE = mpl.rcParams['image.lut']
-
 _binary_data = {
 'red' : ((0., 1., 1.), (1., 0., 0.)),
 'green': ((0., 1., 1.), (1., 0., 0.)),
 'blue' : ((0., 1., 1.), (1., 0., 0.))
 }
 
-
 _bone_data = {'red': ((0., 0., 0.),(1.0, 1.0, 1.0)),
 'green': ((0., 0., 0.),(1.0, 1.0, 1.0)),
 'blue': ((0., 0., 0.),(1.0, 1.0, 1.0))}
@@ -379,44 +369,6 @@
 (1.0, 0.80, 0.80)]}
 
 
-autumn = colors.LinearSegmentedColormap('autumn', _autumn_data, LUTSIZE)
-bone = colors.LinearSegmentedColormap('bone ', _bone_data, LUTSIZE)
-binary = colors.LinearSegmentedColormap('binary ', _binary_data, LUTSIZE)
-cool = colors.LinearSegmentedColormap('cool', _cool_data, LUTSIZE)
-copper = colors.LinearSegmentedColormap('copper', _copper_data, LUTSIZE)
-flag = colors.LinearSegmentedColormap('flag', _flag_data, LUTSIZE)
-gray = colors.LinearSegmentedColormap('gray', _gray_data, LUTSIZE)
-hot = colors.LinearSegmentedColormap('hot', _hot_data, LUTSIZE)
-hsv = colors.LinearSegmentedColormap('hsv', _hsv_data, LUTSIZE)
-jet = colors.LinearSegmentedColormap('jet', _jet_data, LUTSIZE)
-pink = colors.LinearSegmentedColormap('pink', _pink_data, LUTSIZE)
-prism = colors.LinearSegmentedColormap('prism', _prism_data, LUTSIZE)
-spring = colors.LinearSegmentedColormap('spring', _spring_data, LUTSIZE)
-summer = colors.LinearSegmentedColormap('summer', _summer_data, LUTSIZE)
-winter = colors.LinearSegmentedColormap('winter', _winter_data, LUTSIZE)
-spectral = colors.LinearSegmentedColormap('spectral', _spectral_data, LUTSIZE)
-
-
-
-datad = {
- 'autumn': _autumn_data,
- 'bone': _bone_data,
- 'binary': _binary_data,
- 'cool': _cool_data,
- 'copper': _copper_data,
- 'flag': _flag_data,
- 'gray' : _gray_data,
- 'hot': _hot_data,
- 'hsv': _hsv_data,
- 'jet' : _jet_data,
- 'pink': _pink_data,
- 'prism': _prism_data,
- 'spring': _spring_data,
- 'summer': _summer_data,
- 'winter': _winter_data,
- 'spectral': _spectral_data
- }
-
 # 34 colormaps based on color specifications and designs
 # developed by Cynthia Brewer (http://colorbrewer.org).
 # The ColorBrewer palettes have been included under the terms
@@ -5859,48 +5811,26 @@
 0.0078431377187371254, 0.0078431377187371254), (1.0,
 0.0039215688593685627, 0.0039215688593685627)]}
 
-Accent = colors.LinearSegmentedColormap('Accent', _Accent_data, LUTSIZE)
-Blues = colors.LinearSegmentedColormap('Blues', _Blues_data, LUTSIZE)
-BrBG = colors.LinearSegmentedColormap('BrBG', _BrBG_data, LUTSIZE)
-BuGn = colors.LinearSegmentedColormap('BuGn', _BuGn_data, LUTSIZE)
-BuPu = colors.LinearSegmentedColormap('BuPu', _BuPu_data, LUTSIZE)
-Dark2 = colors.LinearSegmentedColormap('Dark2', _Dark2_data, LUTSIZE)
-GnBu = colors.LinearSegmentedColormap('GnBu', _GnBu_data, LUTSIZE)
-Greens = colors.LinearSegmentedColormap('Greens', _Greens_data, LUTSIZE)
-Greys = colors.LinearSegmentedColormap('Greys', _Greys_data, LUTSIZE)
-Oranges = colors.LinearSegmentedColormap('Oranges', _Oranges_data, LUTSIZE)
-OrRd = colors.LinearSegmentedColormap('OrRd', _OrRd_data, LUTSIZE)
-Paired = colors.LinearSegmentedColormap('Paired', _Paired_data, LUTSIZE)
-Pastel1 = colors.LinearSegmentedColormap('Pastel1', _Pastel1_data, LUTSIZE)
-Pastel2 = colors.LinearSegmentedColormap('Pastel2', _Pastel2_data, LUTSIZE)
-PiYG = colors.LinearSegmentedColormap('PiYG', _PiYG_data, LUTSIZE)
-PRGn = colors.LinearSegmentedColormap('PRGn', _PRGn_data, LUTSIZE)
-PuBu = colors.LinearSegmentedColormap('PuBu', _PuBu_data, LUTSIZE)
-PuBuGn = colors.LinearSegmentedColormap('PuBuGn', _PuBuGn_data, LUTSIZE)
-PuOr = colors.LinearSegmentedColormap('PuOr', _PuOr_data, LUTSIZE)
-PuRd = colors.LinearSegmentedColormap('PuRd', _PuRd_data, LUTSIZE)
-Purples = colors.LinearSegmentedColormap('Purples', _Purples_data, LUTSIZE)
-RdBu = colors.LinearSegmentedColormap('RdBu', _RdBu_data, LUTSIZE)
-RdGy = colors.LinearSegmentedColormap('RdGy', _RdGy_data, LUTSIZE)
-RdPu = colors.LinearSegmentedColormap('RdPu', _RdPu_data, LUTSIZE)
-RdYlBu = colors.LinearSegmentedColormap('RdYlBu', _RdYlBu_data, LUTSIZE)
-RdYlGn = colors.LinearSegmentedColormap('RdYlGn', _RdYlGn_data, LUTSIZE)
-Reds = colors.LinearSegmentedColormap('Reds', _Reds_data, LUTSIZE)
-Set1 = colors.LinearSegmentedColormap('Set1', _Set1_data, LUTSIZE)
-Set2 = colors.LinearSegmentedColormap('Set2', _Set2_data, LUTSIZE)
-Set3 = colors.LinearSegmentedColormap('Set3', _Set3_data, LUTSIZE)
-Spectral = colors.LinearSegmentedColormap('Spectral', _Spectral_data, LUTSIZE)
-YlGn = colors.LinearSegmentedColormap('YlGn', _YlGn_data, LUTSIZE)
-YlGnBu = colors.LinearSegmentedColormap('YlGnBu', _YlGnBu_data, LUTSIZE)
-YlOrBr = colors.LinearSegmentedColormap('YlOrBr', _YlOrBr_data, LUTSIZE)
-YlOrRd = colors.LinearSegmentedColormap('YlOrRd', _YlOrRd_data, LUTSIZE)
-gist_earth = colors.LinearSegmentedColormap('gist_earth', _gist_earth_data, LUTSIZE)
-gist_gray = colors.LinearSegmentedColormap('gist_gray', _gist_gray_data, LUTSIZE)
-gist_heat = colors.LinearSegmentedColormap('gist_heat', _gist_heat_data, LUTSIZE)
-gist_ncar = colors.LinearSegmentedColormap('gist_ncar', _gist_ncar_data, LUTSIZE)
-gist_rainbow = colors.LinearSegmentedColormap('gist_rainbow', _gist_rainbow_data, LUTSIZE)
-gist_stern = colors.LinearSegmentedColormap('gist_stern', _gist_stern_data, LUTSIZE)
-gist_yarg = colors.LinearSegmentedColormap('gist_yarg', _gist_yarg_data, LUTSIZE)
+datad = {
+ 'autumn': _autumn_data,
+ 'bone': _bone_data,
+ 'binary': _binary_data,
+ 'cool': _cool_data,
+ 'copper': _copper_data,
+ 'flag': _flag_data,
+ 'gray' : _gray_data,
+ 'hot': _hot_data,
+ 'hsv': _hsv_data,
+ 'jet' : _jet_data,
+ 'pink': _pink_data,
+ 'prism': _prism_data,
+ 'spring': _spring_data,
+ 'summer': _summer_data,
+ 'winter': _winter_data,
+ 'spectral': _spectral_data
+ }
+
+
 datad['Accent']=_Accent_data
 datad['Blues']=_Blues_data
 datad['BrBG']=_BrBG_data
@@ -5944,19 +5874,7 @@
 datad['gist_stern']=_gist_stern_data
 datad['gist_yarg']=_gist_yarg_data
 
-# reverse all the colormaps.
-# reversed colormaps have '_r' appended to the name.
 
-def revcmap(data):
- data_r = {}
- for key, val in data.iteritems():
- valnew = [(1.-a, b, c) for a, b, c in reversed(val)]
- data_r[key] = valnew
- return data_r
 
-cmapnames = datad.keys()
-for cmapname in cmapnames:
- cmapname_r = cmapname+'_r'
- cmapdat_r = revcmap(datad[cmapname])
- datad[cmapname_r] = cmapdat_r
- locals()[cmapname_r] = colors.LinearSegmentedColormap(cmapname_r, cmapdat_r, LUTSIZE)
+
+
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py	2009年07月30日 21:50:10 UTC (rev 7310)
+++ trunk/matplotlib/lib/matplotlib/axes.py	2009年07月31日 02:48:18 UTC (rev 7311)
@@ -3911,12 +3911,12 @@
 *bbox_to_anchor* keyword argument. bbox_to_anchor can be an instance
 of BboxBase(or its derivatives) or a tuple of 2 or 4 floats.
 For example,
- 
+
 loc = 'upper right', bbox_to_anchor = (0.5, 0.5)
 
 will place the legend so that the upper right corner of the legend at
 the center of the axes.
- 
+
 The legend location can be specified in other coordinate, by using the
 *bbox_transform* keyword.
 
@@ -3946,7 +3946,7 @@
 
 *fancybox*: [ None | False | True ]
 if True, draw a frame with a round fancybox. If None, use rc
- 
+
 *shadow*: [ None | False | True ]
 If *True*, draw a shadow behind legend. If *None*, use rc settings.
 
@@ -5172,9 +5172,9 @@
 arguments will be used only if *c* is an array of floats.
 
 *cmap*: [ None | Colormap ]
- A :class:`matplotlib.colors.Colormap` instance. If *None*,
- defaults to rc ``image.cmap``. *cmap* is only used if *c*
- is an array of floats.
+ A :class:`matplotlib.colors.Colormap` instance or registered
+ name. If *None*, defaults to rc ``image.cmap``. *cmap* is
+ only used if *c* is an array of floats.
 
 *norm*: [ None | Normalize ]
 A :class:`matplotlib.colors.Normalize` instance is used to
@@ -5370,7 +5370,6 @@
 
 if colors is None:
 if norm is not None: assert(isinstance(norm, mcolors.Normalize))
- if cmap is not None: assert(isinstance(cmap, mcolors.Colormap))
 collection.set_array(np.asarray(c))
 collection.set_cmap(cmap)
 collection.set_norm(norm)
@@ -5712,7 +5711,6 @@
 accum = bins.searchsorted(accum)
 
 if norm is not None: assert(isinstance(norm, mcolors.Normalize))
- if cmap is not None: assert(isinstance(cmap, mcolors.Colormap))
 collection.set_array(accum)
 collection.set_cmap(cmap)
 collection.set_norm(norm)
@@ -6245,7 +6243,6 @@
 if not self._hold: self.cla()
 
 if norm is not None: assert(isinstance(norm, mcolors.Normalize))
- if cmap is not None: assert(isinstance(cmap, mcolors.Colormap))
 if aspect is None: aspect = rcParams['image.aspect']
 self.set_aspect(aspect)
 im = mimage.AxesImage(self, cmap, norm, interpolation, origin, extent,
@@ -6490,7 +6487,6 @@
 collection.set_alpha(alpha)
 collection.set_array(C)
 if norm is not None: assert(isinstance(norm, mcolors.Normalize))
- if cmap is not None: assert(isinstance(cmap, mcolors.Colormap))
 collection.set_cmap(cmap)
 collection.set_norm(norm)
 if vmin is not None or vmax is not None:
@@ -6612,7 +6608,6 @@
 collection.set_alpha(alpha)
 collection.set_array(C)
 if norm is not None: assert(isinstance(norm, mcolors.Normalize))
- if cmap is not None: assert(isinstance(cmap, mcolors.Colormap))
 collection.set_cmap(cmap)
 collection.set_norm(norm)
 if vmin is not None or vmax is not None:
@@ -6719,7 +6714,6 @@
 vmin = kwargs.pop('vmin', None)
 vmax = kwargs.pop('vmax', None)
 if norm is not None: assert(isinstance(norm, mcolors.Normalize))
- if cmap is not None: assert(isinstance(cmap, mcolors.Colormap))
 
 C = args[-1]
 nr, nc = C.shape
Modified: trunk/matplotlib/lib/matplotlib/cm.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/cm.py	2009年07月30日 21:50:10 UTC (rev 7310)
+++ trunk/matplotlib/lib/matplotlib/cm.py	2009年07月31日 02:48:18 UTC (rev 7311)
@@ -1,25 +1,68 @@
 """
 This module contains the instantiations of color mapping classes
 """
+import os
 
+try:
+ import cPickle as pickle
+except ImportError:
+ import pickle
+
 import numpy as np
 from numpy import ma
 import matplotlib as mpl
 import matplotlib.colors as colors
 import matplotlib.cbook as cbook
-from matplotlib._cm import *
 
-# Dictionary for user-registered colormaps:
+LUTSIZE = mpl.rcParams['image.lut']
+
+_cmcache = os.path.join(mpl.get_configdir(), 'colormaps.cache')
+
+loaded = False
+try:
+ c = open(_cmcache)
+ datad = pickle.load(c)
+ c.close()
+ mpl.verbose.report("Using colormaps from %s" % _cmcache)
+ loaded = True
+except:
+ mpl.verbose.report("Could not load colormaps from %s" % _cmcache)
+
+if not loaded:
+ from matplotlib._cm import datad
+
+ try:
+ c = open(_cmcache, 'w')
+ pickle.dump(datad, c, 2)
+ c.close()
+ mpl.verbose.report("New colormap cache in %s" % _cmcache)
+ except:
+ mpl.verbose.report("Failed to generate colormap cache")
+
 cmap_d = dict()
 
-# Using this second dictionary allows us to handle any
-# Colormap instance; the built-in datad is only for
-# LinearSegmentedColormaps. The advantage of keeping
-# datad is that it delays the generation of the Colormap
-# instance until it is actually needed. Generating the
-# instance is fast enough, and typically done few enough
-# times, that there is no need to cache the result.
+# reverse all the colormaps.
+# reversed colormaps have '_r' appended to the name.
 
+def revcmap(data):
+ data_r = {}
+ for key, val in data.iteritems():
+ valnew = [(1.0-a, b, c) for a, b, c in reversed(val)]
+ data_r[key] = valnew
+ return data_r
+
+_cmapnames = datad.keys() # need this list because datad is changed in loop
+for cmapname in _cmapnames:
+ cmapname_r = cmapname+'_r'
+ cmapdat_r = revcmap(datad[cmapname])
+ datad[cmapname_r] = cmapdat_r
+ cmap_d[cmapname] = colors.LinearSegmentedColormap(
+ cmapname, datad[cmapname], LUTSIZE)
+ cmap_d[cmapname_r] = colors.LinearSegmentedColormap(
+ cmapname_r, cmapdat_r, LUTSIZE)
+
+locals().update(cmap_d)
+
 def register_cmap(name=None, cmap=None, data=None, lut=None):
 """
 Add a colormap to the set recognized by :func:`get_cmap`.
@@ -67,6 +110,11 @@
 
 If *name* is a :class:`colors.Colormap` instance, it will be
 returned.
+
+ If *lut* is not None it must be an integer giving the number of
+ entries desired in the lookup table, and *name* must be a
+ standard mpl colormap name with a corresponding data dictionary
+ in *datad*.
 """
 if name is None:
 name = mpl.rcParams['image.cmap']
@@ -75,15 +123,13 @@
 return name
 
 if name in cmap_d:
- return cmap_d[name]
+ if lut is None:
+ return cmap_d[name]
+ elif name in datad:
+ return colors.LinearSegmentedColormap(name, datad[name], lut)
+ else:
+ raise ValueError("Colormap %s is not recognized" % name)
 
- if name not in datad:
- raise ValueError("%s is not a known colormap name" % name)
-
- if lut is None:
- lut = mpl.rcParams['image.lut']
- return colors.LinearSegmentedColormap(name, datad[name], lut)
-
 class ScalarMappable:
 """
 This is a mixin class to support scalar -> RGBA mapping. Handles
@@ -105,7 +151,7 @@
 
 self._A = None
 self.norm = norm
- self.cmap = cmap
+ self.cmap = get_cmap(cmap)
 self.colorbar = None
 self.update_dict = {'array':False}
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <evi...@us...> - 2009年07月30日 21:50:20
Revision: 7310
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7310&view=rev
Author: evilguru
Date: 2009年07月30日 21:50:10 +0000 (2009年7月30日)
Log Message:
-----------
Revert r7307 to the mathtex branch after a dicussion on the mailing list.
Modified Paths:
--------------
 branches/mathtex/setup.py
 branches/mathtex/setupext.py
Modified: branches/mathtex/setup.py
===================================================================
--- branches/mathtex/setup.py	2009年07月30日 19:32:15 UTC (rev 7309)
+++ branches/mathtex/setup.py	2009年07月30日 21:50:10 UTC (rev 7310)
@@ -42,8 +42,7 @@
 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_provide_mathtex, build_mathtex
+ check_for_pdftops, check_for_datetime, options, build_png
 #import distutils.sysconfig
 
 # jdh
@@ -129,9 +128,6 @@
 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月30日 19:32:15 UTC (rev 7309)
+++ branches/mathtex/setupext.py	2009年07月30日 21:50:10 UTC (rev 7310)
@@ -98,7 +98,6 @@
 'verbose': False,
 'provide_pytz': 'auto',
 'provide_dateutil': 'auto',
- 'provide_mathtex' : 'auto',
 'build_agg': True,
 'build_gtk': 'auto',
 'build_gtkagg': 'auto',
@@ -127,10 +126,6 @@
 "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'
 
@@ -391,14 +386,6 @@
 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")
@@ -558,7 +545,7 @@
 else:
 add_base_flags(module)
 module.libraries.append('z')
-
+ 
 # put this last for library link order
 module.libraries.extend(std_libs)
 
@@ -1105,11 +1092,6 @@
 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.
From: <ef...@us...> - 2009年07月30日 19:32:25
Revision: 7309
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7309&view=rev
Author: efiring
Date: 2009年07月30日 19:32:15 +0000 (2009年7月30日)
Log Message:
-----------
User-generated colormaps are handled more easily.
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/doc/api/api_changes.rst
 trunk/matplotlib/examples/pylab_examples/custom_cmap.py
 trunk/matplotlib/lib/matplotlib/cm.py
 trunk/matplotlib/lib/matplotlib/image.py
 trunk/matplotlib/lib/matplotlib/pyplot.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2009年07月30日 17:08:23 UTC (rev 7308)
+++ trunk/matplotlib/CHANGELOG	2009年07月30日 19:32:15 UTC (rev 7309)
@@ -1,3 +1,7 @@
+2009年07月30日 Add set_cmap and register_cmap, and improve get_cmap,
+ to provide convenient handling of user-generated
+ colormaps. - EF
+
 2009年07月28日 Quiver speed improved, thanks to tip by Ray Speth. -EF
 
 2009年07月27日 Simplify argument handling code for plot method. -EF
Modified: trunk/matplotlib/doc/api/api_changes.rst
===================================================================
--- trunk/matplotlib/doc/api/api_changes.rst	2009年07月30日 17:08:23 UTC (rev 7308)
+++ trunk/matplotlib/doc/api/api_changes.rst	2009年07月30日 19:32:15 UTC (rev 7309)
@@ -21,6 +21,11 @@
 Changes beyond 0.98.x
 =====================
 
+* User-generated colormaps can now be added to the set recognized
+ by :func:`matplotlib.cm.get_cmap`. Colormaps can be made the
+ default and applied to the current image using
+ :func:`matplotlib.pyplot.set_cmap`.
+
 * changed use_mrecords default to False in mlab.csv2rec since this is
 partially broken
 
Modified: trunk/matplotlib/examples/pylab_examples/custom_cmap.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/custom_cmap.py	2009年07月30日 17:08:23 UTC (rev 7308)
+++ trunk/matplotlib/examples/pylab_examples/custom_cmap.py	2009年07月30日 19:32:15 UTC (rev 7309)
@@ -103,11 +103,25 @@
 (1.0, 0.0, 0.0))
 }
 
+# Now we will use this example to illustrate 3 ways of
+# handling custom colormaps.
+# First, the most direct and explicit:
 
 blue_red1 = LinearSegmentedColormap('BlueRed1', cdict1)
+
+# Second, create the map explicitly and register it.
+# Like the first method, this method works with any kind
+# of Colormap, not just
+# a LinearSegmentedColormap:
+
 blue_red2 = LinearSegmentedColormap('BlueRed2', cdict2)
-blue_red3 = LinearSegmentedColormap('BlueRed3', cdict3)
+plt.register_cmap(cmap=blue_red2)
 
+# Third, for LinearSegmentedColormap only,
+# leave everything to register_cmap:
+
+plt.register_cmap(name='BlueRed3', data=cdict3) # optional lut kwarg
+
 x = np.arange(0, np.pi, 0.1)
 y = np.arange(0, 2*np.pi, 0.1)
 X, Y = np.meshgrid(x,y)
@@ -121,13 +135,33 @@
 plt.colorbar()
 
 plt.subplot(1,3,2)
-plt.imshow(Z, interpolation='nearest', cmap=blue_red2)
+cmap = plt.get_cmap('BlueRed2')
+plt.imshow(Z, interpolation='nearest', cmap=cmap)
 plt.colorbar()
 
+# Now we will set the third cmap as the default. One would
+# not normally do this in the middle of a script like this;
+# it is done here just to illustrate the method.
+
+plt.rcParams['image.cmap'] = 'BlueRed3'
+
+# Also see below for an alternative, particularly for
+# interactive use.
+
 plt.subplot(1,3,3)
-plt.imshow(Z, interpolation='nearest', cmap=blue_red3)
+plt.imshow(Z, interpolation='nearest')
 plt.colorbar()
 
+# Or as yet another variation, we could replace the rcParams
+# specification *before* the imshow with the following *after*
+# imshow:
+#
+# plt.set_cmap('BlueRed3')
+#
+# This sets the new default *and* sets the colormap of the last
+# image-like item plotted via pyplot, if any.
+
+
 plt.suptitle('Custom Blue-Red colormaps')
 
 plt.show()
Modified: trunk/matplotlib/lib/matplotlib/cm.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/cm.py	2009年07月30日 17:08:23 UTC (rev 7308)
+++ trunk/matplotlib/lib/matplotlib/cm.py	2009年07月30日 19:32:15 UTC (rev 7309)
@@ -9,16 +9,79 @@
 import matplotlib.cbook as cbook
 from matplotlib._cm import *
 
+# Dictionary for user-registered colormaps:
+cmap_d = dict()
 
+# Using this second dictionary allows us to handle any
+# Colormap instance; the built-in datad is only for
+# LinearSegmentedColormaps. The advantage of keeping
+# datad is that it delays the generation of the Colormap
+# instance until it is actually needed. Generating the
+# instance is fast enough, and typically done few enough
+# times, that there is no need to cache the result.
 
+def register_cmap(name=None, cmap=None, data=None, lut=None):
+ """
+ Add a colormap to the set recognized by :func:`get_cmap`.
+
+ It can be used in two ways::
+
+ register_cmap(name='swirly', cmap=swirly_cmap)
+
+ register_cmap(name='choppy', data=choppydata, lut=128)
+
+ In the first case, *cmap* must be a :class:`colors.Colormap`
+ instance. The *name* is optional; if absent, the name will
+ be the :attr:`name` attribute of the *cmap*.
+
+ In the second case, the three arguments are passed to
+ the :class:`colors.LinearSegmentedColormap` initializer,
+ and the resulting colormap is registered.
+
+ """
+ if name is None:
+ try:
+ name = cmap.name
+ except AttributeError:
+ raise ValueError("Arguments must include a name or a Colormap")
+
+ if not cbook.is_string_like(name):
+ raise ValueError("Colormap name must be a string")
+
+ if isinstance(cmap, colors.Colormap):
+ cmap_d[name] = cmap
+ return
+
+ # For the remainder, let exceptions propagate.
+ if lut is None:
+ lut = mpl.rcParams['image.lut']
+ cmap = colors.LinearSegmentedColormap(name, data, lut)
+ cmap_d[name] = cmap
+
 def get_cmap(name=None, lut=None):
 """
- Get a colormap instance, defaulting to rc values if *name* is None
+ Get a colormap instance, defaulting to rc values if *name* is None.
+
+ Colormaps added with :func:`register_cmap` take precedence over
+ builtin colormaps.
+
+ If *name* is a :class:`colors.Colormap` instance, it will be
+ returned.
 """
- if name is None: name = mpl.rcParams['image.cmap']
- if lut is None: lut = mpl.rcParams['image.lut']
+ if name is None:
+ name = mpl.rcParams['image.cmap']
 
- assert(name in datad.keys())
+ if isinstance(name, colors.Colormap):
+ return name
+
+ if name in cmap_d:
+ return cmap_d[name]
+
+ if name not in datad:
+ raise ValueError("%s is not a known colormap name" % name)
+
+ if lut is None:
+ lut = mpl.rcParams['image.lut']
 return colors.LinearSegmentedColormap(name, datad[name], lut)
 
 class ScalarMappable:
@@ -116,9 +179,9 @@
 """
 set the colormap for luminance data
 
- ACCEPTS: a colormap
+ ACCEPTS: a colormap or registered colormap name
 """
- if cmap is None: cmap = get_cmap()
+ cmap = get_cmap(cmap)
 self.cmap = cmap
 self.changed()
 
Modified: trunk/matplotlib/lib/matplotlib/image.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/image.py	2009年07月30日 17:08:23 UTC (rev 7308)
+++ trunk/matplotlib/lib/matplotlib/image.py	2009年07月30日 19:32:15 UTC (rev 7309)
@@ -512,7 +512,7 @@
 def set_cmap(self, cmap):
 if self._A is not None:
 raise RuntimeError('Cannot change colors after loading data')
- cm.ScalarMappable.set_cmap(self, norm)
+ cm.ScalarMappable.set_cmap(self, cmap)
 
 class PcolorImage(martist.Artist, cm.ScalarMappable):
 '''
Modified: trunk/matplotlib/lib/matplotlib/pyplot.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/pyplot.py	2009年07月30日 17:08:23 UTC (rev 7308)
+++ trunk/matplotlib/lib/matplotlib/pyplot.py	2009年07月30日 19:32:15 UTC (rev 7309)
@@ -17,7 +17,7 @@
 from matplotlib.scale import get_scale_docs, get_scale_names
 
 from matplotlib import cm
-from matplotlib.cm import get_cmap
+from matplotlib.cm import get_cmap, register_cmap
 
 import numpy as np
 
@@ -1396,8 +1396,26 @@
 im.set_clim(vmin, vmax)
 draw_if_interactive()
 
+def set_cmap(cmap):
+ '''
+ set the default colormap to *cmap* and apply to current image if any.
+ See help(colormaps) for more information.
 
+ *cmap* must be a :class:`colors.Colormap` instance, or
+ the name of a registered colormap.
 
+ See :func:`register_cmap` and :func:`get_cmap`.
+ '''
+ cmap = cm.get_cmap(cmap)
+
+ rc('image', cmap=cmap.name)
+ im = gci()
+
+ if im is not None:
+ im.set_cmap(cmap)
+ draw_if_interactive()
+
+
 def imread(*args, **kwargs):
 return _imread(*args, **kwargs)
 if _imread.__doc__ is not None:
@@ -6327,12 +6345,12 @@
 *bbox_to_anchor* keyword argument. bbox_to_anchor can be an instance
 of BboxBase(or its derivatives) or a tuple of 2 or 4 floats.
 For example, ::
- 
+
 loc = 'upper right', bbox_to_anchor = (0.5, 0.5)
 
 will place the legend so that the upper right corner of the legend at
 the center of the axes.
- 
+
 The legend location can be specified in other coordinate, by using the
 *bbox_transform* keyword.
 
@@ -6365,7 +6383,7 @@
 
 *fancybox*: [ None | False | True ]
 if True, draw a frame with a round fancybox. If None, use rc
- 
+
 *shadow*: [ None | False | True ]
 If *True*, draw a shadow behind legend. If *None*, use rc settings.
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <lee...@us...> - 2009年07月30日 17:08:37
Revision: 7308
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7308&view=rev
Author: leejjoon
Date: 2009年07月30日 17:08:23 +0000 (2009年7月30日)
Log Message:
-----------
legend doc. update
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/axes.py
 trunk/matplotlib/lib/matplotlib/figure.py
 trunk/matplotlib/lib/matplotlib/legend.py
 trunk/matplotlib/lib/matplotlib/offsetbox.py
 trunk/matplotlib/lib/matplotlib/pyplot.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py	2009年07月29日 21:28:50 UTC (rev 7307)
+++ trunk/matplotlib/lib/matplotlib/axes.py	2009年07月30日 17:08:23 UTC (rev 7308)
@@ -3906,31 +3906,66 @@
 'center' 10
 =============== =============
 
- If none of these are locations are suitable, loc can be a 2-tuple
- giving x,y in axes coords, ie::
 
- loc = 0, 1 # left top
- loc = 0.5, 0.5 # center
+ Users can specify any arbitrary location for the legend using the
+ *bbox_to_anchor* keyword argument. bbox_to_anchor can be an instance
+ of BboxBase(or its derivatives) or a tuple of 2 or 4 floats.
+ For example,
+ 
+ loc = 'upper right', bbox_to_anchor = (0.5, 0.5)
 
+ will place the legend so that the upper right corner of the legend at
+ the center of the axes.
+ 
+ The legend location can be specified in other coordinate, by using the
+ *bbox_transform* keyword.
+
+ The loc itslef can be a 2-tuple giving x,y of the lower-left corner of
+ the legend in axes coords (*bbox_to_anchor* is ignored).
+
+
 Keyword arguments:
 
- *isaxes*: [ True | False ]
- Indicates that this is an axes legend
+ *prop*: [ None | FontProperties | dict ]
+ A :class:`matplotlib.font_manager.FontProperties`
+ instance. If *prop* is a dictionary, a new instance will be
+ created with *prop*. If *None*, use rc settings.
 
 *numpoints*: integer
- The number of points in the legend line, default is 4
+ The number of points in the legend for line
 
- *prop*: [ None | FontProperties ]
- A :class:`matplotlib.font_manager.FontProperties`
- instance, or *None* to use rc settings.
+ *scatterpoints*: integer
+ The number of points in the legend for scatter plot
 
+ *scatteroffsets*: list of floats
+ a list of yoffsets for scatter symbols in legend
+
 *markerscale*: [ None | scalar ]
 The relative size of legend markers vs. original. If *None*, use rc
 settings.
 
+ *fancybox*: [ None | False | True ]
+ if True, draw a frame with a round fancybox. If None, use rc
+ 
 *shadow*: [ None | False | True ]
 If *True*, draw a shadow behind legend. If *None*, use rc settings.
 
+ *ncol* : integer
+ number of columns. default is 1
+
+ *mode* : [ "expand" | None ]
+ if mode is "expand", the legend will be horizontally expanded
+ to fill the axes area (or *bbox_to_anchor*)
+
+ *bbox_to_anchor* : an instance of BboxBase or a tuple of 2 or 4 floats
+ the bbox that the legend will be anchored.
+
+ *bbox_transform* : [ an instance of Transform | None ]
+ the transform for the bbox. transAxes if None.
+
+ *title* : string
+ the legend title
+
 Padding and spacing between various elements use following keywords
 parameters. The dimensions of these values are given as a fraction
 of the fontsize. Values from rcParams will be used if None.
@@ -3946,9 +3981,13 @@
 columnspacing the spacing between columns
 ================ ==================================================================
 
+
 **Example:**
 
 .. plot:: mpl_examples/api/legend_demo.py
+
+ Also see :ref:`plotting-guide-legend`.
+
 """
 
 if len(args)==0:
Modified: trunk/matplotlib/lib/matplotlib/figure.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/figure.py	2009年07月29日 21:28:50 UTC (rev 7307)
+++ trunk/matplotlib/lib/matplotlib/figure.py	2009年07月30日 17:08:23 UTC (rev 7308)
@@ -829,29 +829,60 @@
 (0,0) is the left, bottom of the figure and 1,1 is the right,
 top.
 
- The legend instance is returned. The following kwargs are supported
+ Keyword arguments:
 
- *loc*
- the location of the legend
- *numpoints*
- the number of points in the legend line
- *prop*
- a :class:`matplotlib.font_manager.FontProperties` instance
- *pad*
- the fractional whitespace inside the legend border
- *markerscale*
- the relative size of legend markers vs. original
- *shadow*
- if True, draw a shadow behind legend
- *labelsep*
- the vertical space between the legend entries
- *handlelen*
- the length of the legend lines
- *handletextsep*
- the space between the legend line and legend text
- *axespad*
- the border between the axes and legend edge
+ *prop*: [ None | FontProperties | dict ]
+ A :class:`matplotlib.font_manager.FontProperties`
+ instance. If *prop* is a dictionary, a new instance will be
+ created with *prop*. If *None*, use rc settings.
 
+ *numpoints*: integer
+ The number of points in the legend line, default is 4
+
+ *scatterpoints*: integer
+ The number of points in the legend line, default is 4
+
+ *scatteroffsets*: list of floats
+ a list of yoffsets for scatter symbols in legend
+
+ *markerscale*: [ None | scalar ]
+ The relative size of legend markers vs. original. If *None*, use rc
+ settings.
+
+ *fancybox*: [ None | False | True ]
+ if True, draw a frame with a round fancybox. If None, use rc
+ 
+ *shadow*: [ None | False | True ]
+ If *True*, draw a shadow behind legend. If *None*, use rc settings.
+
+ *ncol* : integer
+ number of columns. default is 1
+
+ *mode* : [ "expand" | None ]
+ if mode is "expand", the legend will be horizontally expanded
+ to fill the axes area (or *bbox_to_anchor*)
+
+ *title* : string
+ the legend title
+
+ Padding and spacing between various elements use following keywords
+ parameters. The dimensions of these values are given as a fraction
+ of the fontsize. Values from rcParams will be used if None.
+
+ ================ ==================================================================
+ Keyword Description
+ ================ ==================================================================
+ borderpad the fractional whitespace inside the legend border
+ labelspacing the vertical space between the legend entries
+ handlelength the length of the legend handles
+ handletextpad the pad between the legend handle and text
+ borderaxespad the pad between the axes and legend border
+ columnspacing the spacing between columns
+ ================ ==================================================================
+
+
+ **Example:**
+
 .. plot:: mpl_examples/pylab_examples/figlegend_demo.py
 """
 handles = flatten(handles)
Modified: trunk/matplotlib/lib/matplotlib/legend.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/legend.py	2009年07月29日 21:28:50 UTC (rev 7307)
+++ trunk/matplotlib/lib/matplotlib/legend.py	2009年07月30日 17:08:23 UTC (rev 7308)
@@ -126,13 +126,15 @@
 ================ ==================================================================
 Keyword Description
 ================ ==================================================================
- loc a location code or a tuple of coordinates
- numpoints the number of points in the legend line
+ loc a location code
 prop the font property
 markerscale the relative size of legend markers vs. original
+ numpoints the number of points in the legend for line
+ scatterpoints the number of points in the legend for scatter plot
+ scatteryoffsets a list of yoffsets for scatter symbols in legend
 fancybox if True, draw a frame with a round fancybox. If None, use rc
 shadow if True, draw a shadow behind legend
- scatteryoffsets a list of yoffsets for scatter symbols in legend
+ ncol number of columns
 borderpad the fractional whitespace inside the legend border
 labelspacing the vertical space between the legend entries
 handlelength the length of the legend handles
@@ -147,9 +149,14 @@
 The dimensions of pad and spacing are given as a fraction of the
 _fontsize. Values from rcParams will be used if None.
 
-bbox_to_anchor can be an instance of BboxBase(or its derivatives) or a
-tuple of 2 or 4 floats. See :meth:`set_bbox_to_anchor` for more
-detail.
+Users can specify any arbitrary location for the legend using the
+*bbox_to_anchor* keyword argument. bbox_to_anchor can be an instance
+of BboxBase(or its derivatives) or a tuple of 2 or 4 floats.
+See :meth:`set_bbox_to_anchor` for more detail.
+
+The legend location can be specified by setting *loc* with a tuple of
+2 floats, which is interpreted as the lower-left corner of the legend
+in the normalized axes coordinate.
 """
 from matplotlib.axes import Axes # local import only to avoid circularity
 from matplotlib.figure import Figure # local import only to avoid circularity
@@ -158,8 +165,13 @@
 
 if prop is None:
 self.prop=FontProperties(size=rcParams["legend.fontsize"])
+ elif isinstance(prop, dict):
+ self.prop=FontProperties(**prop)
+ if "size" not in prop:
+ self.prop.set_size(rcParams["legend.fontsize"])
 else:
 self.prop=prop
+
 self._fontsize = self.prop.get_size_in_points()
 
 propnames=['numpoints', 'markerscale', 'shadow', "columnspacing",
Modified: trunk/matplotlib/lib/matplotlib/offsetbox.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/offsetbox.py	2009年07月29日 21:28:50 UTC (rev 7307)
+++ trunk/matplotlib/lib/matplotlib/offsetbox.py	2009年07月30日 17:08:23 UTC (rev 7308)
@@ -833,6 +833,10 @@
 
 if prop is None:
 self.prop=FontProperties(size=rcParams["legend.fontsize"])
+ elif isinstance(prop, dict):
+ self.prop=FontProperties(**prop)
+ if "size" not in prop:
+ self.prop.set_size(rcParams["legend.fontsize"])
 else:
 self.prop = prop
 
Modified: trunk/matplotlib/lib/matplotlib/pyplot.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/pyplot.py	2009年07月29日 21:28:50 UTC (rev 7307)
+++ trunk/matplotlib/lib/matplotlib/pyplot.py	2009年07月30日 17:08:23 UTC (rev 7308)
@@ -438,7 +438,7 @@
 .. seealso::
 
 :func:`~matplotlib.pyplot.legend`
- For information about the location codes
+
 """
 l = gcf().legend(handles, labels, loc, **kwargs)
 draw_if_interactive()
@@ -6322,31 +6322,69 @@
 'center' 10
 =============== =============
 
-If none of these are locations are suitable, loc can be a 2-tuple
-giving x,y in axes coords, ie::
 
- loc = 0, 1 # left top
- loc = 0.5, 0.5 # center
+Users can specify any arbitrary location for the legend using the
+*bbox_to_anchor* keyword argument. bbox_to_anchor can be an instance
+of BboxBase(or its derivatives) or a tuple of 2 or 4 floats.
+For example, ::
+ 
+ loc = 'upper right', bbox_to_anchor = (0.5, 0.5)
 
+will place the legend so that the upper right corner of the legend at
+the center of the axes.
+ 
+The legend location can be specified in other coordinate, by using the
+*bbox_transform* keyword.
+
+The loc itslef can be a 2-tuple giving x,y of the lower-left corner of
+the legend in axes coords (*bbox_to_anchor* is ignored).
+
+
 Keyword arguments:
 
 *isaxes*: [ True | False ]
 Indicates that this is an axes legend
 
+ *prop*: [ None | FontProperties | dict ]
+ A :class:`matplotlib.font_manager.FontProperties`
+ instance. If *prop* is a dictionary, a new instance will be
+ created with *prop*. If *None*, use rc settings.
+
 *numpoints*: integer
- The number of points in the legend line, default is 4
+ The number of points in the legend for line
 
- *prop*: [ None | FontProperties ]
- A :class:`matplotlib.font_manager.FontProperties`
- instance, or *None* to use rc settings.
+ *scatterpoints*: integer
+ The number of points in the legend for scatter plot
 
+ *scatteroffsets*: list of floats
+ a list of yoffsets for scatter symbols in legend
+
 *markerscale*: [ None | scalar ]
 The relative size of legend markers vs. original. If *None*, use rc
 settings.
 
+ *fancybox*: [ None | False | True ]
+ if True, draw a frame with a round fancybox. If None, use rc
+ 
 *shadow*: [ None | False | True ]
 If *True*, draw a shadow behind legend. If *None*, use rc settings.
 
+ *ncol* : integer
+ number of columns. default is 1
+
+ *mode* : [ "expand" | None ]
+ if mode is "expand", the legend will be horizontally expanded
+ to fill the axes area (or *bbox_to_anchor*)
+
+ *bbox_to_anchor* : an instance of BboxBase or a tuple of 2 or 4 floats
+ the bbox that the legend will be anchored.
+
+ *bbox_transform* : [ an instance of Transform | None ]
+ the transform for the bbox. transAxes if None.
+
+ *title* : string
+ the legend title
+
 Padding and spacing between various elements use following keywords
 parameters. The dimensions of these values are given as a fraction
 of the fontsize. Values from rcParams will be used if None.
@@ -6362,9 +6400,14 @@
 columnspacing the spacing between columns
 ================ ==================================================================
 
+
 **Example:**
 
-.. plot:: mpl_examples/api/legend_demo.py"""
+.. plot:: mpl_examples/api/legend_demo.py
+
+Also see :ref:`plotting-guide-legend`.
+
+"""
 ret = gca().legend(*args, **kwargs)
 draw_if_interactive()
 return ret
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <evi...@us...> - 2009年07月29日 21:29:05
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.
From: <evi...@us...> - 2009年07月29日 17:14:20
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]
From: <evi...@us...> - 2009年07月29日 16:58:21
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.
From: <ef...@us...> - 2009年07月28日 22:43:25
Revision: 7303
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7303&view=rev
Author: efiring
Date: 2009年07月28日 22:43:15 +0000 (2009年7月28日)
Log Message:
-----------
Speed up quiver for large numbers of arrows; key tip given by Ray Speth.
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/lib/matplotlib/collections.py
 trunk/matplotlib/lib/matplotlib/quiver.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2009年07月28日 20:56:07 UTC (rev 7302)
+++ trunk/matplotlib/CHANGELOG	2009年07月28日 22:43:15 UTC (rev 7303)
@@ -1,3 +1,5 @@
+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
Modified: trunk/matplotlib/lib/matplotlib/collections.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/collections.py	2009年07月28日 20:56:07 UTC (rev 7302)
+++ trunk/matplotlib/lib/matplotlib/collections.py	2009年07月28日 22:43:15 UTC (rev 7303)
@@ -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: trunk/matplotlib/lib/matplotlib/quiver.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/quiver.py	2009年07月28日 20:56:07 UTC (rev 7302)
+++ trunk/matplotlib/lib/matplotlib/quiver.py	2009年07月28日 22:43:15 UTC (rev 7303)
@@ -253,8 +253,12 @@
 self._set_transform()
 _pivot = self.Q.pivot
 self.Q.pivot = self.pivot[self.labelpos]
+ # Hack: save and restore the Umask
+ _mask = self.Q.Umask
+ self.Q.Umask = ma.nomask
 self.verts = self.Q._make_verts(np.array([self.U]),
 np.zeros((1,)))
+ self.Q.Umask = _mask
 self.Q.pivot = _pivot
 kw = self.Q.polykw
 kw.update(self.kw)
@@ -388,9 +392,9 @@
 X, Y, U, V, C = [None]*5
 args = list(args)
 if len(args) == 3 or len(args) == 5:
- C = ma.masked_invalid(args.pop(-1), copy=False)
- V = ma.masked_invalid(args.pop(-1), copy=False)
- U = ma.masked_invalid(args.pop(-1), copy=False)
+ C = np.asanyarray(args.pop(-1))
+ V = np.asanyarray(args.pop(-1))
+ U = np.asanyarray(args.pop(-1))
 if U.ndim == 1:
 nr, nc = 1, U.shape[0]
 else:
@@ -430,10 +434,21 @@
 collections.PolyCollection.draw(self, renderer)
 
 def set_UVC(self, U, V, C=None):
- self.U = U.ravel()
- self.V = V.ravel()
+ U = ma.masked_invalid(U, copy=False).ravel()
+ V = ma.masked_invalid(V, copy=False).ravel()
+ mask = ma.mask_or(U.mask, V.mask, copy=False, shrink=True)
 if C is not None:
- self.set_array(C.ravel())
+ C = ma.masked_invalid(C, copy=False).ravel()
+ mask = ma.mask_or(mask, C.mask, copy=False, shrink=True)
+ if mask is ma.nomask:
+ C = C.filled()
+ else:
+ C = ma.array(C, mask=mask, copy=False)
+ self.U = U.filled(1)
+ self.V = V.filled(1)
+ self.Umask = mask
+ if C is not None:
+ self.set_array(C)
 self._new_UV = True
 
 def _set_transform(self):
@@ -463,32 +478,33 @@
 
 def _angles(self, U, V, eps=0.001):
 xy = self.ax.transData.transform(self.XY)
- uv = ma.hstack((U[:,np.newaxis], V[:,np.newaxis])).filled(0)
+ uv = np.hstack((U[:,np.newaxis], V[:,np.newaxis]))
 xyp = self.ax.transData.transform(self.XY + eps * uv)
 dxy = xyp - xy
- ang = ma.arctan2(dxy[:,1], dxy[:,0])
+ ang = np.arctan2(dxy[:,1], dxy[:,0])
 return ang
 
 def _make_verts(self, U, V):
- uv = ma.asarray(U+V*1j)
- a = ma.absolute(uv)
+ uv = (U+V*1j)
+ a = np.absolute(uv)
 if self.scale is None:
 sn = max(10, math.sqrt(self.N))
- scale = 1.8 * a.mean() * sn / self.span # crude auto-scaling
+ scale = 1.8 * a[~self.Umask].mean() * sn / self.span # crude auto-scaling
 self.scale = scale
 length = a/(self.scale*self.width)
 X, Y = self._h_arrows(length)
 if self.angles == 'xy':
- theta = self._angles(U, V).filled(0)
+ theta = self._angles(U, V)
 elif self.angles == 'uv':
- theta = np.angle(uv.filled(0))
+ theta = np.angle(uv)
 else:
 theta = ma.masked_invalid(self.angles, copy=False).filled(0)
 theta *= (np.pi/180.0)
 theta.shape = (theta.shape[0], 1) # for broadcasting
 xy = (X+Y*1j) * np.exp(1j*theta)*self.width
 xy = xy[:,:,np.newaxis]
- XY = ma.concatenate((xy.real, xy.imag), axis=2)
+ XY = np.concatenate((xy.real, xy.imag), axis=2)
+
 return XY
 
 
@@ -502,8 +518,8 @@
 length = length.reshape(N, 1)
 # This number is chosen based on when pixel values overflow in Agg
 # causing rendering errors
- length = np.minimum(length, 2 ** 16)
-
+ #length = np.minimum(length, 2 ** 16)
+ np.clip(length, 0, 2**16, out=length)
 # x, y: normal horizontal arrow
 x = np.array([0, -self.headaxislength,
 -self.headlength, 0], np.float64)
@@ -514,21 +530,20 @@
 x0 = np.array([0, minsh-self.headaxislength,
 minsh-self.headlength, minsh], np.float64)
 y0 = 0.5 * np.array([1, 1, self.headwidth, 0], np.float64)
- ii = [0,1,2,3,2,1,0]
+ ii = [0,1,2,3,2,1,0,0]
 X = x.take(ii, 1)
 Y = y.take(ii, 1)
- Y[:, 3:] *= -1
+ Y[:, 3:-1] *= -1
 X0 = x0.take(ii)
 Y0 = y0.take(ii)
- Y0[3:] *= -1
+ Y0[3:-1] *= -1
 shrink = length/minsh
 X0 = shrink * X0[np.newaxis,:]
 Y0 = shrink * Y0[np.newaxis,:]
- short = np.repeat(length < minsh, 7, axis=1)
- #print 'short', length < minsh
+ short = np.repeat(length < minsh, 8, axis=1)
 # Now select X0, Y0 if short, otherwise X, Y
- X = ma.where(short, X0, X)
- Y = ma.where(short, Y0, Y)
+ np.putmask(X, short, X0)
+ np.putmask(Y, short, Y0)
 if self.pivot[:3] == 'mid':
 X -= 0.5 * X[:,3, np.newaxis]
 elif self.pivot[:3] == 'tip':
@@ -538,14 +553,18 @@
 tooshort = length < self.minlength
 if tooshort.any():
 # Use a heptagonal dot:
- th = np.arange(0,7,1, np.float64) * (np.pi/3.0)
+ th = np.arange(0,8,1, np.float64) * (np.pi/3.0)
 x1 = np.cos(th) * self.minlength * 0.5
 y1 = np.sin(th) * self.minlength * 0.5
 X1 = np.repeat(x1[np.newaxis, :], N, axis=0)
 Y1 = np.repeat(y1[np.newaxis, :], N, axis=0)
- tooshort = ma.repeat(tooshort, 7, 1)
- X = ma.where(tooshort, X1, X)
- Y = ma.where(tooshort, Y1, Y)
+ tooshort = np.repeat(tooshort, 8, 1)
+ np.putmask(X, tooshort, X1)
+ np.putmask(Y, tooshort, Y1)
+ if self.Umask is not ma.nomask:
+ mask = np.repeat(self.Umask[:,np.newaxis], 8, 1)
+ X = ma.array(X, mask=mask, copy=False)
+ Y = ma.array(Y, mask=mask, copy=False)
 return X, Y
 
 quiver_doc = _quiver_doc
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

Showing results of 83

1 2 3 4 > >> (Page 1 of 4)
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /