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
|
|
From: <md...@us...> - 2009-06-12 14:17:00
|
Revision: 7211
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7211&view=rev
Author: mdboom
Date: 2009-06-12 13:39:59 +0000 (Fri, 12 Jun 2009)
Log Message:
-----------
Fix PDFs for use with ReportLab's pedantic parser
Modified Paths:
--------------
branches/v0_98_5_maint/lib/matplotlib/backends/backend_pdf.py
Modified: branches/v0_98_5_maint/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- branches/v0_98_5_maint/lib/matplotlib/backends/backend_pdf.py 2009-06-10 21:28:07 UTC (rev 7210)
+++ branches/v0_98_5_maint/lib/matplotlib/backends/backend_pdf.py 2009-06-12 13:39:59 UTC (rev 7211)
@@ -1177,7 +1177,10 @@
'No offset for object %d (%s)' % (i, name)
borken = True
else:
- self.write("%010d %05d n \n" % (offset, generation))
+ if name == 'the zero object':
+ self.write("%010d %05d f \n" % (offset, generation))
+ else:
+ self.write("%010d %05d n \n" % (offset, generation))
i += 1
if borken:
raise AssertionError, 'Indirect object does not exist'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2009-06-12 14:03:31
|
Revision: 7212
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7212&view=rev
Author: mdboom
Date: 2009-06-12 13:46:48 +0000 (Fri, 12 Jun 2009)
Log Message:
-----------
Merged revisions 7209,7211 via svnmerge from
https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_98_5_maint
........
r7209 | jdh2358 | 2009-06-10 13:39:22 -0400 (Wed, 10 Jun 2009) | 1 line
remove gw32c from setupext
........
r7211 | mdboom | 2009-06-12 09:39:59 -0400 (Fri, 12 Jun 2009) | 2 lines
Fix PDFs for use with ReportLab's pedantic parser
........
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
Property Changed:
----------------
trunk/matplotlib/
trunk/matplotlib/doc/pyplots/README
trunk/matplotlib/doc/sphinxext/gen_gallery.py
trunk/matplotlib/doc/sphinxext/gen_rst.py
trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py
trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py
trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py
Property changes on: trunk/matplotlib
___________________________________________________________________
Modified: svnmerge-integrated
- /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7176
+ /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7211
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
+ /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
Property changes on: trunk/matplotlib/doc/pyplots/README
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,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
+ /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
Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,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
+ /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
Property changes on: trunk/matplotlib/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
+ /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
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2009-06-12 13:39:59 UTC (rev 7211)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2009-06-12 13:46:48 UTC (rev 7212)
@@ -1215,7 +1215,10 @@
'No offset for object %d (%s)' % (i, name)
borken = True
else:
- self.write("%010d %05d n \n" % (offset, generation))
+ if name == 'the zero object':
+ self.write("%010d %05d f \n" % (offset, generation))
+ else:
+ self.write("%010d %05d n \n" % (offset, generation))
i += 1
if borken:
raise AssertionError, 'Indirect object does not exist'
Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176
+ /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py: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
Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176
+ /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py: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
Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,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
+ /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,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
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-06-10 21:28:17
|
Revision: 7210
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7210&view=rev
Author: jdh2358
Date: 2009-06-10 21:28:07 +0000 (Wed, 10 Jun 2009)
Log Message:
-----------
Modified Paths:
--------------
trunk/matplotlib/release/win32/Makefile
trunk/matplotlib/release/win32/data/setupwin.py
Modified: trunk/matplotlib/release/win32/Makefile
===================================================================
--- trunk/matplotlib/release/win32/Makefile 2009-06-10 17:39:22 UTC (rev 7209)
+++ trunk/matplotlib/release/win32/Makefile 2009-06-10 21:28:07 UTC (rev 7210)
@@ -10,7 +10,7 @@
## You shouldn't need to configure past this point
-CFLAGS = -Os
+CFLAGS = -Os -D_ftime=ftime64 -DPNG_NO_READ_tIME -DPNG_NO_WRITE_tIME
PY_INCLUDE = "${WINSRCDIR}\\zlib-${ZLIBVERSION};${WINSRCDIR}/libpng-${PNGVERSION};${WINSRCDIR}/freetype-${FREETYPEVERSION}/include;${WINSRCDIR}/tcl${TCLTKVERSION}/generic;${WINSRCDIR}/tcl${TCLTKVERSION}/win;${WINSRCDIR}/tk${TCLTKVERSION}/generic;${WINSRCDIR}/tk${TCLTKVERSION}/win;${WINSRCDIR}/tk${TCLTKVERSION}/xlib"
@@ -36,7 +36,7 @@
rm -rf zlib-${ZLIBVERSION}
tar xvfz zlib-${ZLIBVERSION}.tar.gz
cd zlib-${ZLIBVERSION} &&\
- export CFLAGS=${CFLAGS} &&\
+ export CFLAGS="${CFLAGS}" &&\
./configure &&\
make -j3
@@ -88,8 +88,9 @@
cd matplotlib-${MPLVERSION} &&\
rm -rf build &&\
cp ../data/setup*.* . &&\
- ${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
+ 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
inplace:
@@ -102,7 +103,10 @@
cd matplotlib-${MPLVERSION}/lib &&\
${PYTHON} -c 'import matplotlib; matplotlib.use("Agg"); from pylab import *; print matplotlib.__file__; plot([1,2,3]); savefig("test.png")'
-test:
+test_png:
${PYTHON} -c 'import matplotlib; matplotlib.use("Agg"); from pylab import *; print matplotlib.__file__; plot([1,2,3]); savefig("test.png")'
+test_plot:
+ ${PYTHON} -c 'import matplotlib; from pylab import *; print matplotlib.__file__; plot([1,2,3]); show()'
+
all: fetch_deps dependencies installers
Modified: trunk/matplotlib/release/win32/data/setupwin.py
===================================================================
--- trunk/matplotlib/release/win32/data/setupwin.py 2009-06-10 17:39:22 UTC (rev 7209)
+++ trunk/matplotlib/release/win32/data/setupwin.py 2009-06-10 21:28:07 UTC (rev 7210)
@@ -2,9 +2,9 @@
try:
# Python 2.6
- # Replace the msvcr func to return an 'msvcr71'
+ # Replace the msvcr func to return an []
cygwinccompiler.get_msvcr
- cygwinccompiler.get_msvcr = lambda: ['msvcr71']
+ cygwinccompiler.get_msvcr = lambda: []
except AttributeError:
pass
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-06-10 17:40:23
|
Revision: 7209
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7209&view=rev
Author: jdh2358
Date: 2009-06-10 17:39:22 +0000 (Wed, 10 Jun 2009)
Log Message:
-----------
remove gw32c from setupext
Modified Paths:
--------------
branches/v0_98_5_maint/setupext.py
Modified: branches/v0_98_5_maint/setupext.py
===================================================================
--- branches/v0_98_5_maint/setupext.py 2009-06-10 17:39:01 UTC (rev 7208)
+++ branches/v0_98_5_maint/setupext.py 2009-06-10 17:39:22 UTC (rev 7209)
@@ -549,9 +549,13 @@
add_base_flags(module)
module.libraries.append('z')
- if sys.platform == 'win32' and win32_compiler == 'mingw32':
- module.libraries.append('gw32c')
+ # JDH: this file does not appear to be shipped w/ mingw32. I saw
+ # some discussion on the web that libpng needs it -- could this be
+ # the problem we are having with libpng?
+ #if sys.platform == 'win32' and win32_compiler == 'mingw32':
+ # module.libraries.append('gw32c')
+
# put this last for library link order
module.libraries.extend(std_libs)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-06-10 17:39:34
|
Revision: 7208
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7208&view=rev
Author: jdh2358
Date: 2009-06-10 17:39:01 +0000 (Wed, 10 Jun 2009)
Log Message:
-----------
attempt to build win32 installers
Modified Paths:
--------------
trunk/matplotlib/release/win32/Makefile
trunk/matplotlib/release/win32/data/setupwin.py
trunk/matplotlib/release/win32/data/setupwinegg.py
Modified: trunk/matplotlib/release/win32/Makefile
===================================================================
--- trunk/matplotlib/release/win32/Makefile 2009-06-10 16:41:06 UTC (rev 7207)
+++ trunk/matplotlib/release/win32/Makefile 2009-06-10 17:39:01 UTC (rev 7208)
@@ -1,28 +1,17 @@
-PYTHON = C:/Python26/python.exe
+PYDIR = C:/Python26
+PYTHON = ${PYDIR}/python.exe
SRCDIR = ${PWD}
WINSRCDIR = `${PWD}/data/mingw_path.sh ${PWD}`
ZLIBVERSION = 1.2.3
-PNGVERSION = 1.2.23
+PNGVERSION = 1.2.36
FREETYPEVERSION = 2.3.9
-#TCLTKVERSION = 8.4.19
TCLTKVERSION = 8.5.7
-MPLVERSION = 0.98.6svn
+MPLVERSION = 0.98.5.3
## You shouldn't need to configure past this point
-CFLAGS = -Os
-CFLAGS += -I${SRCDIR}/zlib-${ZLIBVERSION}
-CFLAGS += -I${SRCDIR}/libpng-${PNGVERSION}
-CFLAGS += -I${SRCDIR}/freetype-${FREETYPEVERSION}/include
-CFLAGS += -I${SRCDIR}/tcl${TCLTKVERSION}-src/generic
-CFLAGS += -I${SRCDIR}/tcl${TCLTKVERSION}-src/win
-CFLAGS += -I${SRCDIR}/tk${TCLTKVERSION}-src/generic
-CFLAGS += -I${SRCDIR}/tk${TCLTKVERSION}-src/win
-CFLAGS += -I${SRCDIR}/tk${TCLTKVERSION}-src/X11
+CFLAGS = -Os
-LDFLAGS = -L${SRCDIR}/zlib-${ZLIBVERSION}
-LDFLAGS += -L${SRCDIR}/libpng-${PNGVERSION}
-LDFLAGS += -L${SRCDIR}/freetype-${FREETYPEVERSION}
PY_INCLUDE = "${WINSRCDIR}\\zlib-${ZLIBVERSION};${WINSRCDIR}/libpng-${PNGVERSION};${WINSRCDIR}/freetype-${FREETYPEVERSION}/include;${WINSRCDIR}/tcl${TCLTKVERSION}/generic;${WINSRCDIR}/tcl${TCLTKVERSION}/win;${WINSRCDIR}/tk${TCLTKVERSION}/generic;${WINSRCDIR}/tk${TCLTKVERSION}/win;${WINSRCDIR}/tk${TCLTKVERSION}/xlib"
@@ -47,15 +36,21 @@
rm -rf zlib-${ZLIBVERSION}
tar xvfz zlib-${ZLIBVERSION}.tar.gz
cd zlib-${ZLIBVERSION} &&\
+ export CFLAGS=${CFLAGS} &&\
./configure &&\
make -j3
+# for reasons not clear to me, part of png compilation was failing
+# because it could not find zlib.h, even with the CFLAGS which point
+# to it and even with tryting to pass --includedir to configure. So I
+# manually copy the zlib *.h files into the png dir - JDH
png: zlib
rm -rf libpng-${PNGVERSION}
- tar xvfj libpng-${PNGVERSION}.tar.bz2
+ tar xvfj libpng-${PNGVERSION}.tar.bz2
cd libpng-${PNGVERSION} &&\
- export CFLAGS="${CFLAGS}" &&\
- export LDFLAGS="${LDFLAGS}" &&\
+ cp ${SRCDIR}/zlib-${ZLIBVERSION}/*.h . && \
+ export CFLAGS="${CFLAGS} -I${SRCDIR}/zlib-${ZLIBVERSION}" &&\
+ export LDFLAGS="-L${SRCDIR}/zlib-${ZLIBVERSION}" &&\
./configure --disable-shared &&\
make -j3 &&\
cp .libs/libpng.a .
@@ -69,6 +64,16 @@
mingw32-make -j3 &&\
cp objs/libfreetype.a .
+freetype_hide:
+ rm -rf freetype-${FREETYPEVERSION}
+ tar xvfj freetype-${FREETYPEVERSION}.tar.bz2
+ cd freetype-${FREETYPEVERSION} &&\
+ export CFLAGS=${CFLAGS} &&\
+ ./configure --disable-shared &&\
+ cp builds/win32/w32-mingw32.mk config.mk &&\
+ make -j3 &&\
+ cp objs/libfreetype.a .
+
tcltk:
rm -rf tcl${TCLTKVERSION}
rm -rf tk${TCLTKVERSION}
@@ -83,7 +88,21 @@
cd matplotlib-${MPLVERSION} &&\
rm -rf build &&\
cp ../data/setup*.* . &&\
- ${PYTHON} setupwin.py build_ext -c mingw32 -I ${PY_INCLUDE} -L ${PY_LINKER} bdist_wininst &&\
+ ${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:
+ #rm -rf matplotlib-${MPLVERSION}
+ #tar xvzf matplotlib-${MPLVERSION}.tar.gz
+ cd matplotlib-${MPLVERSION} &&\
+ rm -rf build lib/matplotlib/*.pyd lib/matplotlib/*.pyc lib/matplotlib/backends/*.pyd lib/matplotlib/backends/*.pyc &&\
+ cp ../data/setup*.* . &&\
+ ${PYTHON} setup.py build_ext -c mingw32 -I ${PY_INCLUDE} -L ${PY_LINKER} --inplace
+ cd matplotlib-${MPLVERSION}/lib &&\
+ ${PYTHON} -c 'import matplotlib; matplotlib.use("Agg"); from pylab import *; print matplotlib.__file__; plot([1,2,3]); savefig("test.png")'
+
+test:
+ ${PYTHON} -c 'import matplotlib; matplotlib.use("Agg"); from pylab import *; print matplotlib.__file__; plot([1,2,3]); savefig("test.png")'
+
all: fetch_deps dependencies installers
Modified: trunk/matplotlib/release/win32/data/setupwin.py
===================================================================
--- trunk/matplotlib/release/win32/data/setupwin.py 2009-06-10 16:41:06 UTC (rev 7207)
+++ trunk/matplotlib/release/win32/data/setupwin.py 2009-06-10 17:39:01 UTC (rev 7208)
@@ -2,16 +2,11 @@
try:
# Python 2.6
- # Replace the msvcr func to return an empty list
+ # Replace the msvcr func to return an 'msvcr71'
cygwinccompiler.get_msvcr
- cygwinccompiler.get_msvcr = lambda: []
+ cygwinccompiler.get_msvcr = lambda: ['msvcr71']
except AttributeError:
- # Before Python 2.6
- # Wrap the init func to clear to dll libs
- def new_init(self, **kwargs):
- cygwinccompiler.CygwinCCompiler.__init__(self, **kwargs)
- self.dll_libraries = []
- cygwinccompiler.CygwinCCompiler.__init__ = new_init
+ pass
execfile('setup.py')
Modified: trunk/matplotlib/release/win32/data/setupwinegg.py
===================================================================
--- trunk/matplotlib/release/win32/data/setupwinegg.py 2009-06-10 16:41:06 UTC (rev 7207)
+++ trunk/matplotlib/release/win32/data/setupwinegg.py 2009-06-10 17:39:01 UTC (rev 7208)
@@ -7,12 +7,7 @@
cygwinccompiler.get_msvcr = lambda: []
except AttributeError:
- # Before Python 2.6
- # Wrap the init func to clear to dll libs
- def new_init(self, **kwargs):
- cygwinccompiler.CygwinCCompiler.__init__(self, **kwargs)
- self.dll_libraries = []
- cygwinccompiler.CygwinCCompiler.__init__ = new_init
+ pass
from setuptools import setup
execfile('setup.py',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2009-06-10 16:41:07
|
Revision: 7207
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7207&view=rev
Author: mdboom
Date: 2009-06-10 16:41:06 +0000 (Wed, 10 Jun 2009)
Log Message:
-----------
Bug: 2671465 quiver plot adds unwanted lines to image
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/quiver.py
Modified: trunk/matplotlib/lib/matplotlib/quiver.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/quiver.py 2009-06-09 22:40:35 UTC (rev 7206)
+++ trunk/matplotlib/lib/matplotlib/quiver.py 2009-06-10 16:41:06 UTC (rev 7207)
@@ -500,6 +500,10 @@
minsh = self.minshaft * self.headlength
N = len(length)
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)
+
# x, y: normal horizontal arrow
x = np.array([0, -self.headaxislength,
-self.headlength, 0], np.float64)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <he...@us...> - 2009-06-09 22:41:32
|
Revision: 7206
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7206&view=rev
Author: heeres
Date: 2009-06-09 22:40:35 +0000 (Tue, 09 Jun 2009)
Log Message:
-----------
mplot3d: make Poly3DCollection ScalarMappable, support in Axes3D.plot_surface.
Fix-up and extend contours. Add examples.
Modified Paths:
--------------
trunk/matplotlib/doc/mpl_toolkits/mplot3d/tutorial.rst
trunk/matplotlib/examples/mplot3d/surface3d_demo.py
trunk/matplotlib/lib/mpl_toolkits/mplot3d/art3d.py
trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py
Added Paths:
-----------
trunk/matplotlib/examples/mplot3d/contour3d_demo2.py
trunk/matplotlib/examples/mplot3d/surface3d_demo2.py
Modified: trunk/matplotlib/doc/mpl_toolkits/mplot3d/tutorial.rst
===================================================================
--- trunk/matplotlib/doc/mpl_toolkits/mplot3d/tutorial.rst 2009-06-09 16:47:46 UTC (rev 7205)
+++ trunk/matplotlib/doc/mpl_toolkits/mplot3d/tutorial.rst 2009-06-09 22:40:35 UTC (rev 7206)
@@ -38,12 +38,14 @@
.. automethod:: Axes3D.plot_surface
.. plot:: mpl_examples/mplot3d/surface3d_demo.py
+.. plot:: mpl_examples/mplot3d/surface3d_demo2.py
Contour plots
=============
.. automethod:: Axes3D.contour
.. plot:: mpl_examples/mplot3d/contour3d_demo.py
+.. plot:: mpl_examples/mplot3d/contour3d_demo2.py
Filled contour plots
====================
Added: trunk/matplotlib/examples/mplot3d/contour3d_demo2.py
===================================================================
--- trunk/matplotlib/examples/mplot3d/contour3d_demo2.py (rev 0)
+++ trunk/matplotlib/examples/mplot3d/contour3d_demo2.py 2009-06-09 22:40:35 UTC (rev 7206)
@@ -0,0 +1,12 @@
+from mpl_toolkits.mplot3d import axes3d
+import pylab
+import random
+
+fig = pylab.figure()
+ax = axes3d.Axes3D(fig)
+X, Y, Z = axes3d.get_test_data(0.05)
+cset = ax.contour(X, Y, Z, 16, extend3d=True)
+ax.clabel(cset, fontsize=9, inline=1)
+
+pylab.show()
+
Modified: trunk/matplotlib/examples/mplot3d/surface3d_demo.py
===================================================================
--- trunk/matplotlib/examples/mplot3d/surface3d_demo.py 2009-06-09 16:47:46 UTC (rev 7205)
+++ trunk/matplotlib/examples/mplot3d/surface3d_demo.py 2009-06-09 22:40:35 UTC (rev 7206)
@@ -1,16 +1,17 @@
from mpl_toolkits.mplot3d import Axes3D
+from matplotlib import cm
import pylab
import random
import numpy as np
fig = pylab.figure()
ax = Axes3D(fig)
-X = np.arange(-5, 5, 0.5)
-Y = np.arange(-5, 5, 0.5)
+X = np.arange(-5, 5, 0.25)
+Y = np.arange(-5, 5, 0.25)
X, Y = np.meshgrid(X, Y)
R = np.sqrt(X**2 + Y**2)
Z = np.sin(R)
-ax.plot_surface(X, Y, Z, rstride=1, cstride=1, color='forestgreen')
+ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet)
pylab.show()
Added: trunk/matplotlib/examples/mplot3d/surface3d_demo2.py
===================================================================
--- trunk/matplotlib/examples/mplot3d/surface3d_demo2.py (rev 0)
+++ trunk/matplotlib/examples/mplot3d/surface3d_demo2.py 2009-06-09 22:40:35 UTC (rev 7206)
@@ -0,0 +1,18 @@
+from mpl_toolkits.mplot3d import Axes3D
+import pylab
+import random
+import numpy as np
+
+fig = pylab.figure()
+ax = Axes3D(fig)
+
+u = np.linspace(0, 2 * np.pi, 100)
+v = np.linspace(0, np.pi, 100)
+
+x = 10 * np.outer(np.cos(u), np.sin(v))
+y = 10 * np.outer(np.sin(u), np.sin(v))
+z = 10 * np.outer(np.ones(np.size(u)), np.cos(v))
+ax.plot_surface(x, y, z, rstride=4, cstride=4, color='b')
+
+pylab.show()
+
Modified: trunk/matplotlib/lib/mpl_toolkits/mplot3d/art3d.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/mplot3d/art3d.py 2009-06-09 16:47:46 UTC (rev 7205)
+++ trunk/matplotlib/lib/mpl_toolkits/mplot3d/art3d.py 2009-06-09 22:40:35 UTC (rev 7206)
@@ -10,6 +10,7 @@
from matplotlib import lines, text as mtext, path as mpath, colors as mcolors
from matplotlib.collections import Collection, LineCollection, \
PolyCollection, PatchCollection
+from matplotlib.cm import ScalarMappable
from matplotlib.patches import Patch
from matplotlib.colors import Normalize
from matplotlib.cbook import iterable
@@ -111,26 +112,30 @@
line.__class__ = Line3D
line.set_3d_properties(zs, zdir)
-def path_to_3d_segment(path, z=0, zdir='z'):
+def path_to_3d_segment(path, zs=0, zdir='z'):
'''Convert a path to a 3D segment.'''
+
+ if not iterable(zs):
+ zs = [zs] * len(path)
+
seg = []
- for (pathseg, code) in path.iter_segments():
- seg.append(pathseg)
- seg3d = [juggle_axes(x, y, z, zdir) for (x, y) in seg]
+ pathsegs = path.iter_segments(simplify=False, curves=False)
+ for (((x, y), code), z) in zip(pathsegs, zs):
+ seg.append((x, y, z))
+ seg3d = [juggle_axes(x, y, z, zdir) for (x, y, z) in seg]
return seg3d
def paths_to_3d_segments(paths, zs=0, zdir='z'):
- '''Convert paths from a collection object to 3D segments.'''
+ '''
+ Convert paths from a collection object to 3D segments.
+ '''
- try:
- zs = float(zs)
+ if not iterable(zs):
zs = [zs] * len(paths)
- except:
- pass
segments = []
- for path, z in zip(paths, zs):
- segments.append(path_to_3d_segment(path, z, zdir))
+ for path, pathz in zip(paths, zs):
+ segments.append(path_to_3d_segment(path, pathz, zdir))
return segments
class Line3DCollection(LineCollection):
@@ -255,8 +260,17 @@
'''
def __init__(self, verts, *args, **kwargs):
+ '''
+ Create a Poly3DCollection.
+
+ *verts* should contain 3D coordinates.
+
+ Note that this class does a bit of magic with the _facecolors
+ and _edgecolors properties.
+ '''
+
PolyCollection.__init__(self, verts, *args, **kwargs)
- self.set_3d_properties()
+ self._zsort = 1
def get_vector(self, segments3d):
"""Optimize points for projection"""
@@ -276,6 +290,7 @@
self._sort_zpos = min(zs)
def set_verts(self, verts, closed=True):
+ '''Set 3D vertices.'''
self.get_vector(verts)
# 2D verts will be updated at draw time
PolyCollection.set_verts(self, [], closed)
@@ -283,40 +298,73 @@
def set_3d_properties(self):
self._zsort = 1
self._facecolors3d = PolyCollection.get_facecolors(self)
- self._edgecolors3d = self.get_edgecolors()
+ self._edgecolors3d = PolyCollection.get_edgecolors(self)
def do_3d_projection(self, renderer):
+ '''
+ Perform the 3D projection for this object.
+ '''
+
+ if self._A is not None:
+ self.update_scalarmappable()
+ self._facecolors3d = self._facecolors
+
txs, tys, tzs = proj3d.proj_transform_vec(self._vec, renderer.M)
xyzlist = [(txs[si:ei], tys[si:ei], tzs[si:ei]) \
for si, ei in self._segis]
- colors = self._facecolors3d
+ # This extra fuss is to re-order face / edge colors
+ cface = self._facecolors3d
+ if len(self._edgecolors3d) != len(cface):
+ cedge = cface
+ else:
+ cedge = self._edgecolors3d
+
# if required sort by depth (furthest drawn first)
if self._zsort:
- z_segments_2d = [(min(zs), zip(xs, ys), c) for
- (xs, ys, zs), c in zip(xyzlist, colors)]
+ z_segments_2d = [(min(zs), zip(xs, ys), fc, ec) for
+ (xs, ys, zs), fc, ec in zip(xyzlist, cface, cedge)]
z_segments_2d.sort()
z_segments_2d.reverse()
else:
raise ValueError, "whoops"
- segments_2d = [s for z, s, c in z_segments_2d]
- colors = [c for z, s, c in z_segments_2d]
+
+ segments_2d = [s for z, s, fc, ec in z_segments_2d]
PolyCollection.set_verts(self, segments_2d)
- self._facecolors2d = colors
+ self._facecolors2d = [fc for z, s, fc, ec in z_segments_2d]
+ if len(self._edgecolors3d) == len(cface):
+ self._edgecolors2d = [ec for z, s, fc, ec in z_segments_2d]
+ else:
+ self._edgecolors2d = self._edgecolors3d
+
# Return zorder value
zvec = np.array([[0], [0], [self._sort_zpos], [1]])
ztrans = proj3d.proj_transform_vec(zvec, renderer.M)
return ztrans[2][0]
+ def set_facecolor(self, colors):
+ PolyCollection.set_facecolor(self, colors)
+ self._facecolors3d = PolyCollection.get_facecolor(self)
+ set_facecolors = set_facecolor
+
+ def set_edgecolor(self, colors):
+ PolyCollection.set_edgecolor(self, colors)
+ self._edgecolors3d = PolyCollection.get_edgecolor(self)
+ set_edgecolors = set_edgecolor
+
def get_facecolors(self):
return self._facecolors2d
get_facecolor = get_facecolors
+ def get_edgecolors(self):
+ return self._edgecolors2d
+ get_edgecolor = get_edgecolors
+
def draw(self, renderer):
return Collection.draw(self, renderer)
-def poly_collection_2d_to_3d(col, zs=None, zdir='z'):
+def poly_collection_2d_to_3d(col, zs=0, zdir='z'):
"""Convert a PolyCollection to a Poly3DCollection object."""
segments_3d = paths_to_3d_segments(col.get_paths(), zs, zdir)
col.__class__ = Poly3DCollection
Modified: trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py 2009-06-09 16:47:46 UTC (rev 7205)
+++ trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py 2009-06-09 22:40:35 UTC (rev 7206)
@@ -541,6 +541,10 @@
def plot_surface(self, X, Y, Z, *args, **kwargs):
'''
Create a surface plot.
+
+ By default it will be colored in shades of a solid color,
+ but it also supports color mapping by supplying the *cmap*
+ argument.
========== ================================================
Argument Description
@@ -550,6 +554,7 @@
*rstride* Array row stride (step size)
*cstride* Array column stride (step size)
*color* Color of the surface patches
+ *cmap* A colormap for the surface patches.
========== ================================================
'''
@@ -562,9 +567,11 @@
color = kwargs.pop('color', 'b')
color = np.array(colorConverter.to_rgba(color))
+ cmap = kwargs.get('cmap', None)
polys = []
- boxes = []
+ normals = []
+ avgz = []
for rs in np.arange(0, rows-1, rstride):
for cs in np.arange(0, cols-1, cstride):
ps = []
@@ -579,31 +586,53 @@
corners.append([ztop[0], ztop[-1], zbase[0], zbase[-1]])
z = np.concatenate((ztop, zleft, zbase, zright))
ps.append(z)
- boxes.append(map(np.array, zip(*corners)))
- polys.append(zip(*ps))
- lines = []
+ # The construction leaves the array with duplicate points, which
+ # are removed here.
+ ps = zip(*ps)
+ lastp = np.array([])
+ ps2 = []
+ avgzsum = 0.0
+ for p in ps:
+ if p != lastp:
+ ps2.append(p)
+ lastp = p
+ avgzsum += p[2]
+ polys.append(ps2)
+ avgz.append(avgzsum / len(ps2))
+
+ v1 = np.array(ps2[0]) - np.array(ps2[1])
+ v2 = np.array(ps2[2]) - np.array(ps2[0])
+ normals.append(np.cross(v1, v2))
+
+ polyc = art3d.Poly3DCollection(polys, *args, **kwargs)
+ if cmap is not None:
+ polyc.set_array(np.array(avgz))
+ polyc.set_linewidth(0)
+ else:
+ colors = self._shade_colors(color, normals)
+ polyc.set_facecolors(colors)
+
+ self.add_collection(polyc)
+ self.auto_scale_xyz(X, Y, Z, had_data)
+
+ return polyc
+
+ def _shade_colors(self, color, normals):
shade = []
- for box in boxes:
- n = proj3d.cross(box[0]-box[1],
- box[0]-box[2])
- n = n/proj3d.mod(n)*5
+ for n in normals:
+ n = n / proj3d.mod(n) * 5
shade.append(np.dot(n, [-1, -1, 0.5]))
- lines.append((box[0], n+box[0]))
shade = np.array(shade)
mask = ~np.isnan(shade)
norm = Normalize(min(shade[mask]), max(shade[mask]))
- colors = [color * (0.5+norm(v)*0.5) for v in shade]
- for c in colors: c[3] = 1
- polyc = art3d.Poly3DCollection(polys, facecolors=colors, \
- *args, **kwargs)
- polyc._zsort = 1
- self.add_collection(polyc)
+ color = color.copy()
+ color[3] = 1
+ colors = [color * (0.5 + norm(v) * 0.5) for v in shade]
- self.auto_scale_xyz(X, Y, Z, had_data)
- return polyc
+ return colors
def plot_wireframe(self, X, Y, Z, *args, **kwargs):
'''
@@ -653,21 +682,78 @@
return linec
- def contour(self, X, Y, Z, *args, **kwargs):
+ def _3d_extend_contour(self, cset, stride=5):
'''
+ Extend a contour in 3D by creating
+ '''
+
+ levels = cset.levels
+ colls = cset.collections
+ dz = (levels[1] - levels[0]) / 2
+
+ for z, linec in zip(levels, colls):
+ topverts = art3d.paths_to_3d_segments(linec.get_paths(), z - dz)
+ botverts = art3d.paths_to_3d_segments(linec.get_paths(), z + dz)
+
+ color = linec.get_color()[0]
+
+ polyverts = []
+ normals = []
+ nsteps = round(len(topverts[0]) / stride)
+ stepsize = (len(topverts[0]) - 1) / (nsteps - 1)
+ for i in range(int(round(nsteps)) - 1):
+ i1 = int(round(i * stepsize))
+ i2 = int(round((i + 1) * stepsize))
+ polyverts.append([topverts[0][i1],
+ topverts[0][i2],
+ botverts[0][i2],
+ botverts[0][i1]])
+
+ v1 = np.array(topverts[0][i1]) - np.array(topverts[0][i2])
+ v2 = np.array(topverts[0][i1]) - np.array(botverts[0][i1])
+ normals.append(np.cross(v1, v2))
+
+ colors = self._shade_colors(color, normals)
+ colors2 = self._shade_colors(color, normals)
+ polycol = art3d.Poly3DCollection(polyverts, facecolors=colors,
+ edgecolors=colors2)
+ self.add_collection3d(polycol)
+
+ for col in colls:
+ self.collections.remove(col)
+
+ def contour(self, X, Y, Z, levels=10, **kwargs):
+ '''
Create a 3D contour plot.
- *X*, *Y*, *Z*: data
+ ========== ================================================
+ Argument Description
+ ========== ================================================
+ *X*, *Y*, Data values as numpy.arrays
+ *Z*
+ *levels* Number of levels to use, defaults to 10. Can
+ also be a tuple of specific levels.
+ *extend3d* Whether to extend contour in 3D (default: False)
+ *stride* Stride (step size) for extending contour
+ ========== ================================================
- Keyword arguments are passed on to
+ Other keyword arguments are passed on to
:func:`~matplotlib.axes.Axes.contour`
'''
+ extend3d = kwargs.pop('extend3d', False)
+ stride = kwargs.pop('stride', 5)
+ nlevels = kwargs.pop('nlevels', 15)
+
had_data = self.has_data()
- cset = Axes.contour(self, X, Y, Z, *args, **kwargs)
- for z, linec in zip(cset.levels, cset.collections):
- art3d.line_collection_2d_to_3d(linec, z)
+ cset = Axes.contour(self, X, Y, Z, levels, **kwargs)
+ if extend3d:
+ self._3d_extend_contour(cset, stride)
+ else:
+ for z, linec in zip(cset.levels, cset.collections):
+ art3d.line_collection_2d_to_3d(linec, z)
+
self.auto_scale_xyz(X, Y, Z, had_data)
return cset
@@ -688,11 +774,8 @@
cset = Axes.contourf(self, X, Y, Z, *args, **kwargs)
levels = cset.levels
colls = cset.collections
-
for z1, z2, linec in zip(levels, levels[1:], colls):
- zs = [z1] * (len(linec.get_paths()[0]) / 2)
- zs += [z2] * (len(linec.get_paths()[0]) / 2)
- art3d.poly_collection_2d_to_3d(linec, zs)
+ art3d.poly_collection_2d_to_3d(linec, z1)
self.auto_scale_xyz(X, Y, Z, had_data)
return cset
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-06-09 16:47:51
|
Revision: 7205
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7205&view=rev
Author: jdh2358
Date: 2009-06-09 16:47:46 +0000 (Tue, 09 Jun 2009)
Log Message:
-----------
add rec_keep_fields w/ support for rec2txt
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/mlab.py
Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mlab.py 2009-06-08 20:49:29 UTC (rev 7204)
+++ trunk/matplotlib/lib/matplotlib/mlab.py 2009-06-09 16:47:46 UTC (rev 7205)
@@ -2107,8 +2107,22 @@
return newrec
+def rec_keep_fields(rec, names):
+ """
+ Return a new numpy record array with only fields listed in names
+ """
+ if cbook.is_string_like(names):
+ names = names.split(',')
+
+ arrays = []
+ for name in names:
+ arrays.append(rec[name])
+ return np.rec.fromarrays(arrays, names=names)
+
+
+
def rec_groupby(r, groupby, stats):
"""
*r* is a numpy record array
@@ -2699,7 +2713,7 @@
format.fmt = '%r'
return format
-def rec2txt(r, header=None, padding=3, precision=3):
+def rec2txt(r, header=None, padding=3, precision=3, fields=None):
"""
Returns a textual representation of a record array.
@@ -2714,6 +2728,10 @@
list of integers to apply precision individually.
Precision for non-floats is simply ignored.
+ *fields* : if not None, a list of field names to print. fields
+ can be a list of strings like ['field1', 'field2'] or a single
+ comma separated string like 'field1,field2'
+
Example::
precision=[0,2,3]
@@ -2725,6 +2743,9 @@
XYZ 6.32 -0.076
"""
+ if fields is not None:
+ r = rec_keep_fields(r, fields)
+
if cbook.is_numlike(precision):
precision = [precision]*len(r.dtype)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-06-08 20:49:38
|
Revision: 7204
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7204&view=rev
Author: jdh2358
Date: 2009-06-08 20:49:29 +0000 (Mon, 08 Jun 2009)
Log Message:
-----------
applied Goekhan's installation FAQ patch
Modified Paths:
--------------
trunk/matplotlib/doc/faq/installing_faq.rst
trunk/matplotlib/lib/matplotlib/cbook.py
Modified: trunk/matplotlib/doc/faq/installing_faq.rst
===================================================================
--- trunk/matplotlib/doc/faq/installing_faq.rst 2009-06-08 16:28:21 UTC (rev 7203)
+++ trunk/matplotlib/doc/faq/installing_faq.rst 2009-06-08 20:49:29 UTC (rev 7204)
@@ -106,6 +106,19 @@
> cd matplotlib
> python setup.py install
+If you want to be able to follow the development branch as it changes just replace
+the last step with (Make sure you have **setuptools** installed)::
+
+ > python setupegg.py develop
+
+This creates links in the right places and installs the command line script to the appropriate places.
+Then, if you want to update your **matplotlib** at any time, just do::
+
+ > svn update
+
+When you run `svn update`, if the output shows that only Python files have been updated, you are all set.
+If C files have changed, you need to run the `python setupegg develop` command again to compile them.
+
There is more information on :ref:`using Subversion <using-svn>` in
the developer docs.
Modified: trunk/matplotlib/lib/matplotlib/cbook.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/cbook.py 2009-06-08 16:28:21 UTC (rev 7203)
+++ trunk/matplotlib/lib/matplotlib/cbook.py 2009-06-08 20:49:29 UTC (rev 7204)
@@ -254,6 +254,10 @@
self.__dict__.update(kwds)
+ def __repr__(self):
+ keys = self.__dict__.keys()
+ return 'Bunch(%s)'%', '.join(['%s=%s'%(k,self.__dict__[k]) for k in keys])
+
def unique(x):
'Return a list of unique elements of *x*'
return dict([ (val, 1) for val in x]).keys()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <he...@us...> - 2009-06-08 16:28:29
|
Revision: 7203
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7203&view=rev
Author: heeres
Date: 2009-06-08 16:28:21 +0000 (Mon, 08 Jun 2009)
Log Message:
-----------
mplot3d: really add docs
Added Paths:
-----------
trunk/matplotlib/doc/mpl_toolkits/mplot3d/
trunk/matplotlib/doc/mpl_toolkits/mplot3d/api.rst
trunk/matplotlib/doc/mpl_toolkits/mplot3d/index.rst
trunk/matplotlib/doc/mpl_toolkits/mplot3d/tutorial.rst
Added: trunk/matplotlib/doc/mpl_toolkits/mplot3d/api.rst
===================================================================
--- trunk/matplotlib/doc/mpl_toolkits/mplot3d/api.rst (rev 0)
+++ trunk/matplotlib/doc/mpl_toolkits/mplot3d/api.rst 2009-06-08 16:28:21 UTC (rev 7203)
@@ -0,0 +1,25 @@
+***********
+mplot3d API
+***********
+
+:mod:`mpl_toolkits.mplot3d.axes3d`
+==================================
+
+.. automodule:: mpl_toolkits.mplot3d.axes3d
+ :members:
+ :exclude-members: contour3D, contourf3D, plot3D, scatter3D
+ :show-inheritance:
+
+:mod:`mpl_toolkits.mplot3d.art3d`
+=================================
+
+.. automodule:: mpl_toolkits.mplot3d.art3d
+ :members:
+ :show-inheritance:
+
+:mod:`mpl_toolkits.mplot3d.proj3d`
+==================================
+
+.. automodule:: mpl_toolkits.mplot3d.proj3d
+ :members:
+ :show-inheritance:
Added: trunk/matplotlib/doc/mpl_toolkits/mplot3d/index.rst
===================================================================
--- trunk/matplotlib/doc/mpl_toolkits/mplot3d/index.rst (rev 0)
+++ trunk/matplotlib/doc/mpl_toolkits/mplot3d/index.rst 2009-06-08 16:28:21 UTC (rev 7203)
@@ -0,0 +1,23 @@
+.. _toolkit_mplot3d-index:
+.. currentmodule:: mpl_toolkits.mplot3d
+
+*******
+mplot3d
+*******
+
+Matplotlib mplot3d toolkit
+==========================
+The mplot3d toolkit adds simple 3d plotting capabilities to matplotlib by
+supplying an axis object that can create a 2d projection of a 3d scene.
+In the end it produces a list of 2d lines and patches that are drawn by the
+normal matplotlib code. Therefore the resulting graph will have the same look
+and feel as regular 2d plots.
+
+Interactive backends also provide the ability to rotate and zoom the 3d scene.
+
+.. toctree::
+ :maxdepth: 2
+
+ tutorial.rst
+ api.rst
+
Added: trunk/matplotlib/doc/mpl_toolkits/mplot3d/tutorial.rst
===================================================================
--- trunk/matplotlib/doc/mpl_toolkits/mplot3d/tutorial.rst (rev 0)
+++ trunk/matplotlib/doc/mpl_toolkits/mplot3d/tutorial.rst 2009-06-08 16:28:21 UTC (rev 7203)
@@ -0,0 +1,75 @@
+.. _toolkit_mplot3d-tutorial:
+.. currentmodule:: mpl_toolkits.mplot3d
+
+****************
+mplot3d tutorial
+****************
+
+Getting started
+===============
+Create a new :class:`matplotlib.figure.Figure` and an
+:class:`~mpl_toolkits.mplot3d.Axes3D` object in it::
+
+ import pylab
+ fig = pylab.figure()
+ from mpl_toolkits.mplot3d import Axes3D
+ ax = Axes3D(fig)
+
+Line plots
+====================
+.. automethod:: Axes3D.plot
+
+.. plot:: mpl_examples/mplot3d/lines3d_demo.py
+
+Scatter plots
+=============
+.. automethod:: Axes3D.scatter
+
+.. plot:: mpl_examples/mplot3d/scatter3d_demo.py
+
+Wireframe plots
+===============
+.. automethod:: Axes3D.plot_wireframe
+
+.. plot:: mpl_examples/mplot3d/wire3d_demo.py
+
+Surface plots
+=============
+.. automethod:: Axes3D.plot_surface
+
+.. plot:: mpl_examples/mplot3d/surface3d_demo.py
+
+Contour plots
+=============
+.. automethod:: Axes3D.contour
+
+.. plot:: mpl_examples/mplot3d/contour3d_demo.py
+
+Filled contour plots
+====================
+.. automethod:: Axes3D.contourf
+
+.. plot:: mpl_examples/mplot3d/contourf3d_demo.py
+
+Polygon plots
+====================
+.. automethod:: add_collection3d
+
+.. plot:: mpl_examples/mplot3d/polys3d_demo.py
+
+Bar plots
+====================
+.. automethod:: Axes3D.bar
+
+.. plot:: mpl_examples/mplot3d/bars3d_demo.py
+
+2D plots in 3D
+====================
+.. plot:: mpl_examples/mplot3d/2dcollections3d_demo.py
+
+Text
+====================
+.. automethod:: Axes3D.text
+
+.. plot:: mpl_examples/mplot3d/text3d_demo.py
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2009-06-08 14:53:19
|
Revision: 7201
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7201&view=rev
Author: mdboom
Date: 2009-06-08 13:37:03 +0000 (Mon, 08 Jun 2009)
Log Message:
-----------
Pixel-align even long sequences of rectilinear lines.
Modified Paths:
--------------
trunk/matplotlib/src/path_converters.h
Modified: trunk/matplotlib/src/path_converters.h
===================================================================
--- trunk/matplotlib/src/path_converters.h 2009-06-08 12:57:17 UTC (rev 7200)
+++ trunk/matplotlib/src/path_converters.h 2009-06-08 13:37:03 UTC (rev 7201)
@@ -390,7 +390,7 @@
switch (quantize_mode)
{
case QUANTIZE_AUTO:
- if (total_vertices > 15)
+ if (total_vertices > 1024)
{
return false;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-06-08 14:51:30
|
Revision: 7202
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7202&view=rev
Author: jdh2358
Date: 2009-06-08 14:51:27 +0000 (Mon, 08 Jun 2009)
Log Message:
-----------
add video lecture link to nav bar
Modified Paths:
--------------
trunk/matplotlib/doc/_templates/indexsidebar.html
Modified: trunk/matplotlib/doc/_templates/indexsidebar.html
===================================================================
--- trunk/matplotlib/doc/_templates/indexsidebar.html 2009-06-08 13:37:03 UTC (rev 7201)
+++ trunk/matplotlib/doc/_templates/indexsidebar.html 2009-06-08 14:51:27 UTC (rev 7202)
@@ -3,6 +3,9 @@
<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
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-06-08 13:14:58
|
Revision: 7199
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7199&view=rev
Author: jdh2358
Date: 2009-06-08 12:49:37 +0000 (Mon, 08 Jun 2009)
Log Message:
-----------
special case 0,0 for atan2
Modified Paths:
--------------
trunk/matplotlib/lib/mpl_toolkits/mplot3d/art3d.py
Modified: trunk/matplotlib/lib/mpl_toolkits/mplot3d/art3d.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/mplot3d/art3d.py 2009-06-07 23:23:41 UTC (rev 7198)
+++ trunk/matplotlib/lib/mpl_toolkits/mplot3d/art3d.py 2009-06-08 12:49:37 UTC (rev 7199)
@@ -65,7 +65,11 @@
self._position3d + self._dir_vec], renderer.M)
dx = proj[0][1] - proj[0][0]
dy = proj[1][1] - proj[1][0]
- angle = math.degrees(math.atan2(dy, dx))
+ if dx==0. and dy==0.:
+ # atan2 raises ValueError: math domain error on 0,0
+ angle = 0.
+ else:
+ angle = math.degrees(math.atan2(dy, dx))
self.set_position((proj[0][0], proj[1][0]))
self.set_rotation(norm_text_angle(angle))
mtext.Text.draw(self, renderer)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2009-06-08 12:57:25
|
Revision: 7200
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7200&view=rev
Author: mdboom
Date: 2009-06-08 12:57:17 +0000 (Mon, 08 Jun 2009)
Log Message:
-----------
Improve alignment of markers.
Modified Paths:
--------------
trunk/matplotlib/src/_backend_agg.cpp
Modified: trunk/matplotlib/src/_backend_agg.cpp
===================================================================
--- trunk/matplotlib/src/_backend_agg.cpp 2009-06-08 12:49:37 UTC (rev 7199)
+++ trunk/matplotlib/src/_backend_agg.cpp 2009-06-08 12:57:17 UTC (rev 7200)
@@ -598,8 +598,12 @@
if (has_clippath) {
while (path_transformed.vertex(&x, &y) != agg::path_cmd_stop) {
- x = mpl_round(x); y = mpl_round(y);
+ if (MPL_notisfinite64(x) || MPL_notisfinite64(y)) {
+ continue;
+ }
+ x = (double)(int)x; y = (double)(int)y;
+
pixfmt_amask_type pfa(pixFmt, alphaMask);
amask_ren_type r(pfa);
amask_aa_renderer_type ren(r);
@@ -615,8 +619,12 @@
}
} else {
while (path_transformed.vertex(&x, &y) != agg::path_cmd_stop) {
- x = mpl_round(x); y = mpl_round(y);
+ if (MPL_notisfinite64(x) || MPL_notisfinite64(y)) {
+ continue;
+ }
+ x = (double)(int)x; y = (double)(int)y;
+
if (face.first) {
rendererAA.color(face.second);
sa.init(fillCache, fillSize, x, y);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <he...@us...> - 2009-06-07 23:23:51
|
Revision: 7198
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7198&view=rev
Author: heeres
Date: 2009-06-07 23:23:41 +0000 (Sun, 07 Jun 2009)
Log Message:
-----------
mplot3d: update axes code, add support for '3D' text.
Split and add examples and begin documentation.
Modified Paths:
--------------
trunk/matplotlib/doc/devel/documenting_mpl.rst
trunk/matplotlib/doc/users/toolkits.rst
trunk/matplotlib/lib/mpl_toolkits/mplot3d/art3d.py
trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py
trunk/matplotlib/lib/mpl_toolkits/mplot3d/axis3d.py
trunk/matplotlib/lib/mpl_toolkits/mplot3d/proj3d.py
Added Paths:
-----------
trunk/matplotlib/examples/mplot3d/2dcollections3d_demo.py
trunk/matplotlib/examples/mplot3d/bars3d_demo.py
trunk/matplotlib/examples/mplot3d/contour3d_demo.py
trunk/matplotlib/examples/mplot3d/contourf3d_demo.py
trunk/matplotlib/examples/mplot3d/lines3d_demo.py
trunk/matplotlib/examples/mplot3d/polys3d_demo.py
trunk/matplotlib/examples/mplot3d/scatter3d_demo.py
trunk/matplotlib/examples/mplot3d/surface3d_demo.py
trunk/matplotlib/examples/mplot3d/text3d_demo.py
trunk/matplotlib/examples/mplot3d/wire3d_demo.py
Removed Paths:
-------------
trunk/matplotlib/examples/mplot3d/contour.py
trunk/matplotlib/examples/mplot3d/contourf.py
trunk/matplotlib/examples/mplot3d/demo.py
trunk/matplotlib/examples/mplot3d/polys.py
trunk/matplotlib/examples/mplot3d/scatter.py
trunk/matplotlib/examples/mplot3d/surface.py
trunk/matplotlib/examples/mplot3d/wire.py
Modified: trunk/matplotlib/doc/devel/documenting_mpl.rst
===================================================================
--- trunk/matplotlib/doc/devel/documenting_mpl.rst 2009-06-07 17:36:51 UTC (rev 7197)
+++ trunk/matplotlib/doc/devel/documenting_mpl.rst 2009-06-07 23:23:41 UTC (rev 7198)
@@ -9,9 +9,11 @@
The documentation for matplotlib is generated from ReStructured Text
using the Sphinx_ documentation generation tool. Sphinx-0.5 or later
-is required. Most developers work from the sphinx subversion repository because it is a rapidly evolving project::
+is required. You might still run into problems, so most developers
+work from the sphinx source repository (Mercurial based) because it
+is a rapidly evolving project::
- svn co http://svn.python.org/projects/doctools/trunk sphinx
+ hg clone http://bitbucket.org/birkenfeld/sphinx/
cd sphinx
python setup.py install
Modified: trunk/matplotlib/doc/users/toolkits.rst
===================================================================
--- trunk/matplotlib/doc/users/toolkits.rst 2009-06-07 17:36:51 UTC (rev 7197)
+++ trunk/matplotlib/doc/users/toolkits.rst 2009-06-07 23:23:41 UTC (rev 7198)
@@ -54,6 +54,7 @@
there, but ships with matplotlib and thus may be a lighter weight
solution for some use cases.
+See :ref:`toolkit_mplot3d-index` for more documentation and examples.
.. _toolkit_axes_grid:
Added: trunk/matplotlib/examples/mplot3d/2dcollections3d_demo.py
===================================================================
--- trunk/matplotlib/examples/mplot3d/2dcollections3d_demo.py (rev 0)
+++ trunk/matplotlib/examples/mplot3d/2dcollections3d_demo.py 2009-06-07 23:23:41 UTC (rev 7198)
@@ -0,0 +1,24 @@
+from mpl_toolkits.mplot3d import Axes3D
+import numpy as np
+import pylab
+
+fig = pylab.figure()
+ax = Axes3D(fig)
+
+x = np.linspace(0, 1, 100)
+y = np.sin(x * 2 * np.pi) / 2 + 0.5
+ax.plot(x, y, zs=0, zdir='z', label='zs=0, zdir=z')
+
+colors = ('r', 'g', 'b', 'k')
+for c in colors:
+ x = np.random.sample(20)
+ y = np.random.sample(20)
+ ax.scatter(x, y, 0, zdir='y', c=c)
+
+ax.legend()
+ax.set_xlim3d(0, 1)
+ax.set_ylim3d(0, 1)
+ax.set_zlim3d(0, 1)
+
+pylab.show()
+
Added: trunk/matplotlib/examples/mplot3d/bars3d_demo.py
===================================================================
--- trunk/matplotlib/examples/mplot3d/bars3d_demo.py (rev 0)
+++ trunk/matplotlib/examples/mplot3d/bars3d_demo.py 2009-06-07 23:23:41 UTC (rev 7198)
@@ -0,0 +1,20 @@
+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)
+for c, z in zip(['r', 'g', 'b', 'y'], [30, 20, 10, 0]):
+ xs = np.arange(20)
+ ys = [random.random() for x in xs]
+ ax.bar(xs, ys, zs=z, zdir='y', color=c, alpha=0.8)
+
+ax.set_xlabel('X')
+ax.set_ylabel('Y')
+ax.set_zlabel('Z')
+
+pylab.show()
+
Deleted: trunk/matplotlib/examples/mplot3d/contour.py
===================================================================
--- trunk/matplotlib/examples/mplot3d/contour.py 2009-06-07 17:36:51 UTC (rev 7197)
+++ trunk/matplotlib/examples/mplot3d/contour.py 2009-06-07 23:23:41 UTC (rev 7198)
@@ -1,12 +0,0 @@
-from mpl_toolkits.mplot3d import axes3d
-import pylab
-import random
-
-fig = pylab.figure()
-ax = axes3d.Axes3D(fig)
-X, Y, Z = axes3d.get_test_data(0.05)
-cset = ax.contour3D(X, Y, Z)
-ax.clabel(cset, fontsize=9, inline=1)
-
-pylab.show()
-
Copied: trunk/matplotlib/examples/mplot3d/contour3d_demo.py (from rev 7162, trunk/matplotlib/examples/mplot3d/contour.py)
===================================================================
--- trunk/matplotlib/examples/mplot3d/contour3d_demo.py (rev 0)
+++ trunk/matplotlib/examples/mplot3d/contour3d_demo.py 2009-06-07 23:23:41 UTC (rev 7198)
@@ -0,0 +1,12 @@
+from mpl_toolkits.mplot3d import axes3d
+import pylab
+import random
+
+fig = pylab.figure()
+ax = axes3d.Axes3D(fig)
+X, Y, Z = axes3d.get_test_data(0.05)
+cset = ax.contour(X, Y, Z)
+ax.clabel(cset, fontsize=9, inline=1)
+
+pylab.show()
+
Property changes on: trunk/matplotlib/examples/mplot3d/contour3d_demo.py
___________________________________________________________________
Added: 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
Deleted: trunk/matplotlib/examples/mplot3d/contourf.py
===================================================================
--- trunk/matplotlib/examples/mplot3d/contourf.py 2009-06-07 17:36:51 UTC (rev 7197)
+++ trunk/matplotlib/examples/mplot3d/contourf.py 2009-06-07 23:23:41 UTC (rev 7198)
@@ -1,12 +0,0 @@
-from mpl_toolkits.mplot3d import axes3d
-import pylab
-import random
-
-fig = pylab.figure()
-ax = axes3d.Axes3D(fig)
-X, Y, Z = axes3d.get_test_data(0.05)
-cset = ax.contourf3D(X, Y, Z)
-ax.clabel(cset, fontsize=9, inline=1)
-
-pylab.show()
-
Copied: trunk/matplotlib/examples/mplot3d/contourf3d_demo.py (from rev 7162, trunk/matplotlib/examples/mplot3d/contourf.py)
===================================================================
--- trunk/matplotlib/examples/mplot3d/contourf3d_demo.py (rev 0)
+++ trunk/matplotlib/examples/mplot3d/contourf3d_demo.py 2009-06-07 23:23:41 UTC (rev 7198)
@@ -0,0 +1,12 @@
+from mpl_toolkits.mplot3d import axes3d
+import pylab
+import random
+
+fig = pylab.figure()
+ax = axes3d.Axes3D(fig)
+X, Y, Z = axes3d.get_test_data(0.05)
+cset = ax.contourf(X, Y, Z)
+ax.clabel(cset, fontsize=9, inline=1)
+
+pylab.show()
+
Property changes on: trunk/matplotlib/examples/mplot3d/contourf3d_demo.py
___________________________________________________________________
Added: 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
Deleted: trunk/matplotlib/examples/mplot3d/demo.py
===================================================================
--- trunk/matplotlib/examples/mplot3d/demo.py 2009-06-07 17:36:51 UTC (rev 7197)
+++ trunk/matplotlib/examples/mplot3d/demo.py 2009-06-07 23:23:41 UTC (rev 7198)
@@ -1,138 +0,0 @@
-import random
-import numpy as np
-import matplotlib.pyplot as plt
-import mpl_toolkits.mplot3d.axes3d as axes3d
-from matplotlib.colors import Normalize, colorConverter
-
-def test_scatter():
- f = plt.figure()
- ax = axes3d.Axes3D(f)
-
- n = 100
- for c,zl,zh in [('r',-50,-25),('b',-30,-5)]:
- xs,ys,zs = zip(*
- [(random.randrange(23,32),
- random.randrange(100),
- random.randrange(zl,zh)
- ) for i in range(n)])
- ax.scatter3D(xs,ys,zs, c=c)
-
- ax.set_xlabel('------------ X Label --------------------')
- ax.set_ylabel('------------ Y Label --------------------')
- ax.set_zlabel('------------ Z Label --------------------')
-
-def test_wire():
- f = plt.figure()
- ax = axes3d.Axes3D(f)
-
- X,Y,Z = axes3d.get_test_data(0.05)
- ax.plot_wireframe(X,Y,Z, rstride=10,cstride=10)
- ax.set_xlabel('X')
- ax.set_ylabel('Y')
- ax.set_zlabel('Z')
-
-def test_surface():
- f = plt.figure()
- ax = axes3d.Axes3D(f)
-
- X,Y,Z = axes3d.get_test_data(0.05)
- ax.plot_surface(X,Y,Z, rstride=10,cstride=10)
- ax.set_xlabel('X')
- ax.set_ylabel('Y')
- ax.set_zlabel('Z')
-
-def test_contour():
- f = plt.figure()
- ax = axes3d.Axes3D(f)
-
- X,Y,Z = axes3d.get_test_data(0.05)
- cset = ax.contour3D(X,Y,Z)
- ax.clabel(cset, fontsize=9, inline=1)
- ax.set_xlabel('X')
- ax.set_ylabel('Y')
- ax.set_zlabel('Z')
-
-def test_contourf():
- f = plt.figure()
- ax = axes3d.Axes3D(f)
-
- X,Y,Z = axes3d.get_test_data(0.05)
- cset = ax.contourf3D(X,Y,Z)
- ax.clabel(cset, fontsize=9, inline=1)
- ax.set_xlabel('X')
- ax.set_ylabel('Y')
- ax.set_zlabel('Z')
-
-def test_plot():
- f = plt.figure()
- ax = axes3d.Axes3D(f)
-
- xs = np.arange(0,4*np.pi+0.1,0.1)
- ys = np.sin(xs)
- ax.plot(xs,ys, label='zl')
- ax.plot(xs,ys+max(xs),label='zh')
- ax.plot(xs,ys,dir='x', label='xl')
- ax.plot(xs,ys,dir='x', z=max(xs),label='xh')
- ax.plot(xs,ys,dir='y', label='yl')
- ax.plot(xs,ys,dir='y', z=max(xs), label='yh')
- ax.set_xlabel('X')
- ax.set_ylabel('Y')
- ax.set_zlabel('Z')
- ax.legend()
-
-def test_polys():
- f = plt.figure()
- ax = axes3d.Axes3D(f)
-
- cc = lambda arg: colorConverter.to_rgba(arg, alpha=0.6)
-
- xs = np.arange(0,10,0.4)
- verts = []
- zs = [0.0,1.0,2.0,3.0]
- for z in zs:
- ys = [random.random() for x in xs]
- ys[0],ys[-1] = 0,0
- verts.append(zip(xs,ys))
-
- from matplotlib.collections import PolyCollection
- poly = PolyCollection(verts, facecolors = [cc('r'),cc('g'),cc('b'),
- cc('y')])
- poly.set_alpha(0.7)
- ax.add_collection(poly,zs=zs,dir='y')
-
- ax.set_xlim(0,10)
- ax.set_ylim(-1,4)
- ax.set_zlim(0,1)
-
-def test_scatter2D():
- f = plt.figure()
- ax = axes3d.Axes3D(f)
-
- xs = [random.random() for i in range(20)]
- ys = [random.random() for x in xs]
- ax.scatter(xs, ys)
- ax.scatter(xs, ys, dir='y', c='r')
- ax.scatter(xs, ys, dir='x', c='g')
-
-def test_bar2D():
- f = plt.figure()
- ax = axes3d.Axes3D(f)
-
- for c,z in zip(['r','g','b', 'y'],[30,20,10,0]):
- xs = np.arange(20)
- ys = [random.random() for x in xs]
- ax.bar(xs, ys, z=z, dir='y', color=c, alpha=0.8)
-
-if __name__ == "__main__":
-
- test_scatter()
- test_wire()
- test_surface()
- test_contour()
- test_contourf()
- test_plot()
- test_polys()
- test_scatter2D()
- test_bar2D()
-
- plt.show()
Added: trunk/matplotlib/examples/mplot3d/lines3d_demo.py
===================================================================
--- trunk/matplotlib/examples/mplot3d/lines3d_demo.py (rev 0)
+++ trunk/matplotlib/examples/mplot3d/lines3d_demo.py 2009-06-07 23:23:41 UTC (rev 7198)
@@ -0,0 +1,19 @@
+import matplotlib as mpl
+from mpl_toolkits.mplot3d import Axes3D
+import numpy as np
+import pylab
+
+mpl.rcParams['legend.fontsize'] = 10
+
+fig = pylab.figure()
+ax = Axes3D(fig)
+theta = np.linspace(-4 * np.pi, 4 * np.pi, 100)
+z = np.linspace(-2, 2, 100)
+r = z**2 + 1
+x = r * np.sin(theta)
+y = r * np.cos(theta)
+ax.plot(x, y, z, label='parametric curve')
+ax.legend()
+
+pylab.show()
+
Deleted: trunk/matplotlib/examples/mplot3d/polys.py
===================================================================
--- trunk/matplotlib/examples/mplot3d/polys.py 2009-06-07 17:36:51 UTC (rev 7197)
+++ trunk/matplotlib/examples/mplot3d/polys.py 2009-06-07 23:23:41 UTC (rev 7198)
@@ -1,31 +0,0 @@
-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)
-
-cc = lambda arg: colorConverter.to_rgba(arg, alpha=0.6)
-
-xs = np.arange(0, 10, 0.4)
-verts = []
-zs = [0.0, 1.0, 2.0, 3.0]
-for z in zs:
- ys = [random.random() for x in xs]
- ys[0], ys[-1] = 0, 0
- verts.append(zip(xs, ys))
-
-poly = PolyCollection(verts, facecolors = [cc('r'), cc('g'), cc('b'),
- cc('y')])
-poly.set_alpha(0.7)
-ax.add_collection(poly, zs=zs, dir='y')
-
-ax.set_xlim(0, 10)
-ax.set_ylim(-1, 4)
-ax.set_zlim(0, 1)
-
-pylab.show()
-
Copied: trunk/matplotlib/examples/mplot3d/polys3d_demo.py (from rev 7162, trunk/matplotlib/examples/mplot3d/polys.py)
===================================================================
--- trunk/matplotlib/examples/mplot3d/polys3d_demo.py (rev 0)
+++ trunk/matplotlib/examples/mplot3d/polys3d_demo.py 2009-06-07 23:23:41 UTC (rev 7198)
@@ -0,0 +1,31 @@
+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)
+
+cc = lambda arg: colorConverter.to_rgba(arg, alpha=0.6)
+
+xs = np.arange(0, 10, 0.4)
+verts = []
+zs = [0.0, 1.0, 2.0, 3.0]
+for z in zs:
+ ys = [random.random() for x in xs]
+ ys[0], ys[-1] = 0, 0
+ verts.append(zip(xs, ys))
+
+poly = PolyCollection(verts, facecolors = [cc('r'), cc('g'), cc('b'),
+ cc('y')])
+poly.set_alpha(0.7)
+ax.add_collection3d(poly, zs=zs, zdir='y')
+
+ax.set_xlim3d(0, 10)
+ax.set_ylim3d(-1, 4)
+ax.set_zlim3d(0, 1)
+
+pylab.show()
+
Property changes on: trunk/matplotlib/examples/mplot3d/polys3d_demo.py
___________________________________________________________________
Added: 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
Deleted: trunk/matplotlib/examples/mplot3d/scatter.py
===================================================================
--- trunk/matplotlib/examples/mplot3d/scatter.py 2009-06-07 17:36:51 UTC (rev 7197)
+++ trunk/matplotlib/examples/mplot3d/scatter.py 2009-06-07 23:23:41 UTC (rev 7198)
@@ -1,21 +0,0 @@
-from mpl_toolkits.mplot3d import Axes3D
-import pylab
-import random
-
-fig = pylab.figure()
-ax = Axes3D(fig)
-n = 100
-for c, zl, zh in [('r', -50, -25), ('b', -30, -5)]:
- xs, ys, zs = zip(*
- [(random.randrange(23, 32),
- random.randrange(100),
- random.randrange(zl, zh)
- ) for i in range(n)])
- ax.scatter3D(xs, ys, zs, c=c)
-
-ax.set_xlabel('X Label')
-ax.set_ylabel('Y Label')
-ax.set_zlabel('Z Label')
-
-pylab.show()
-
Copied: trunk/matplotlib/examples/mplot3d/scatter3d_demo.py (from rev 7162, trunk/matplotlib/examples/mplot3d/scatter.py)
===================================================================
--- trunk/matplotlib/examples/mplot3d/scatter3d_demo.py (rev 0)
+++ trunk/matplotlib/examples/mplot3d/scatter3d_demo.py 2009-06-07 23:23:41 UTC (rev 7198)
@@ -0,0 +1,21 @@
+from mpl_toolkits.mplot3d import Axes3D
+import pylab
+import random
+
+fig = pylab.figure()
+ax = Axes3D(fig)
+n = 100
+for c, zl, zh in [('r', -50, -25), ('b', -30, -5)]:
+ xs, ys, zs = zip(*
+ [(random.randrange(23, 32),
+ random.randrange(100),
+ random.randrange(zl, zh)
+ ) for i in range(n)])
+ ax.scatter(xs, ys, zs, c=c)
+
+ax.set_xlabel('X Label')
+ax.set_ylabel('Y Label')
+ax.set_zlabel('Z Label')
+
+pylab.show()
+
Property changes on: trunk/matplotlib/examples/mplot3d/scatter3d_demo.py
___________________________________________________________________
Added: 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
Deleted: trunk/matplotlib/examples/mplot3d/surface.py
===================================================================
--- trunk/matplotlib/examples/mplot3d/surface.py 2009-06-07 17:36:51 UTC (rev 7197)
+++ trunk/matplotlib/examples/mplot3d/surface.py 2009-06-07 23:23:41 UTC (rev 7198)
@@ -1,16 +0,0 @@
-from mpl_toolkits.mplot3d import Axes3D
-import pylab
-import random
-import numpy as np
-
-fig = pylab.figure()
-ax = Axes3D(fig)
-X = np.arange(-5, 5, 0.5)
-Y = np.arange(-5, 5, 0.5)
-X, Y = np.meshgrid(X, Y)
-R = np.sqrt(X**2 + Y**2)
-Z = np.sin(R)
-ax.plot_surface(X, Y, Z, rstride=1, cstride=1, color='forestgreen')
-
-pylab.show()
-
Copied: trunk/matplotlib/examples/mplot3d/surface3d_demo.py (from rev 7162, trunk/matplotlib/examples/mplot3d/surface.py)
===================================================================
--- trunk/matplotlib/examples/mplot3d/surface3d_demo.py (rev 0)
+++ trunk/matplotlib/examples/mplot3d/surface3d_demo.py 2009-06-07 23:23:41 UTC (rev 7198)
@@ -0,0 +1,16 @@
+from mpl_toolkits.mplot3d import Axes3D
+import pylab
+import random
+import numpy as np
+
+fig = pylab.figure()
+ax = Axes3D(fig)
+X = np.arange(-5, 5, 0.5)
+Y = np.arange(-5, 5, 0.5)
+X, Y = np.meshgrid(X, Y)
+R = np.sqrt(X**2 + Y**2)
+Z = np.sin(R)
+ax.plot_surface(X, Y, Z, rstride=1, cstride=1, color='forestgreen')
+
+pylab.show()
+
Property changes on: trunk/matplotlib/examples/mplot3d/surface3d_demo.py
___________________________________________________________________
Added: 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
Added: trunk/matplotlib/examples/mplot3d/text3d_demo.py
===================================================================
--- trunk/matplotlib/examples/mplot3d/text3d_demo.py (rev 0)
+++ trunk/matplotlib/examples/mplot3d/text3d_demo.py 2009-06-07 23:23:41 UTC (rev 7198)
@@ -0,0 +1,26 @@
+from mpl_toolkits.mplot3d import Axes3D
+import pylab
+import random
+
+fig = pylab.figure()
+ax = Axes3D(fig)
+
+zdirs = (None, 'x', 'y', 'z', (1, 1, 0), (1, 1, 1))
+xs = (2, 6, 4, 9, 7, 2)
+ys = (6, 4, 8, 7, 2, 2)
+zs = (4, 2, 5, 6, 1, 7)
+
+for zdir, x, y, z in zip(zdirs, xs, ys, zs):
+ label = '(%d, %d, %d), dir=%s' % (x, y, z, zdir)
+ ax.text(x, y, z, label, zdir)
+
+ax.set_xlim3d(0, 10)
+ax.set_ylim3d(0, 10)
+ax.set_zlim3d(0, 10)
+
+ax.set_xlabel('X axis')
+ax.set_ylabel('Y axis')
+ax.set_zlabel('Z axis')
+
+pylab.show()
+
Deleted: trunk/matplotlib/examples/mplot3d/wire.py
===================================================================
--- trunk/matplotlib/examples/mplot3d/wire.py 2009-06-07 17:36:51 UTC (rev 7197)
+++ trunk/matplotlib/examples/mplot3d/wire.py 2009-06-07 23:23:41 UTC (rev 7198)
@@ -1,12 +0,0 @@
-from mpl_toolkits.mplot3d import axes3d
-import pylab
-import random
-import numpy as np
-
-fig = pylab.figure()
-ax = axes3d.Axes3D(fig)
-X, Y, Z = axes3d.get_test_data(0.05)
-ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10)
-
-pylab.show()
-
Copied: trunk/matplotlib/examples/mplot3d/wire3d_demo.py (from rev 7162, trunk/matplotlib/examples/mplot3d/wire.py)
===================================================================
--- trunk/matplotlib/examples/mplot3d/wire3d_demo.py (rev 0)
+++ trunk/matplotlib/examples/mplot3d/wire3d_demo.py 2009-06-07 23:23:41 UTC (rev 7198)
@@ -0,0 +1,12 @@
+from mpl_toolkits.mplot3d import axes3d
+import pylab
+import random
+import numpy as np
+
+fig = pylab.figure()
+ax = axes3d.Axes3D(fig)
+X, Y, Z = axes3d.get_test_data(0.05)
+ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10)
+
+pylab.show()
+
Property changes on: trunk/matplotlib/examples/mplot3d/wire3d_demo.py
___________________________________________________________________
Added: 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
Modified: trunk/matplotlib/lib/mpl_toolkits/mplot3d/art3d.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/mplot3d/art3d.py 2009-06-07 17:36:51 UTC (rev 7197)
+++ trunk/matplotlib/lib/mpl_toolkits/mplot3d/art3d.py 2009-06-07 23:23:41 UTC (rev 7198)
@@ -2,45 +2,89 @@
# art3d.py, original mplot3d version by John Porter
# Parts rewritten by Reinier Heeres <re...@he...>
-from matplotlib import lines, text, path as mpath
+'''
+Module containing 3D artist code and functions to convert 2D
+artists into 3D versions which can be added to an Axes3D.
+'''
+
+from matplotlib import lines, text as mtext, path as mpath, colors as mcolors
from matplotlib.collections import Collection, LineCollection, \
PolyCollection, PatchCollection
-from matplotlib.patches import Patch, Rectangle
+from matplotlib.patches import Patch
from matplotlib.colors import Normalize
-from matplotlib import transforms
+from matplotlib.cbook import iterable
-import types
import numpy as np
+import math
import proj3d
-class Text3D(text.Text):
+def norm_angle(a):
+ """Return angle between -180 and +180"""
+ a = (a + 360) % 360
+ if a > 180:
+ a = a - 360
+ return a
- def __init__(self, x=0, y=0, z=0, text='', dir='z'):
- text.Text.__init__(self, x, y, text)
- self.set_3d_properties(z, dir)
+def norm_text_angle(a):
+ """Return angle between -90 and +90"""
+ a = (a + 180) % 180
+ if a > 90:
+ a = a - 180
+ return a
- def set_3d_properties(self, z=0, dir='z'):
+def get_dir_vector(zdir):
+ if zdir == 'x':
+ return np.array((1, 0, 0))
+ elif zdir == 'y':
+ return np.array((0, 1, 0))
+ elif zdir == 'z':
+ return np.array((0, 0, 1))
+ elif zdir == None:
+ return np.array((0, 0, 0))
+ elif iterable(zdir) and len(zdir) == 3:
+ return zdir
+ else:
+ raise ValueError("'x', 'y', 'z', None or vector of length 3 expected")
+
+class Text3D(mtext.Text):
+ '''
+ Text object with 3D position and (in the future) direction.
+ '''
+
+ def __init__(self, x=0, y=0, z=0, text='', zdir='z'):
+ mtext.Text.__init__(self, x, y, text)
+ self.set_3d_properties(z, zdir)
+
+ def set_3d_properties(self, z=0, zdir='z'):
x, y = self.get_position()
- self._position3d = juggle_axes(x, y, z, dir)
+ self._position3d = np.array((x, y, z))
+ self._dir_vec = get_dir_vector(zdir)
def draw(self, renderer):
- x, y, z = self._position3d
- x, y, z = proj3d.proj_transform(x, y, z, renderer.M)
- self.set_position(x, y)
- text.Text.draw(self, renderer)
+ proj = proj3d.proj_trans_points([self._position3d, \
+ self._position3d + self._dir_vec], renderer.M)
+ dx = proj[0][1] - proj[0][0]
+ dy = proj[1][1] - proj[1][0]
+ angle = math.degrees(math.atan2(dy, dx))
+ self.set_position((proj[0][0], proj[1][0]))
+ self.set_rotation(norm_text_angle(angle))
+ mtext.Text.draw(self, renderer)
-def text_2d_to_3d(obj, z=0, dir='z'):
+def text_2d_to_3d(obj, z=0, zdir='z'):
"""Convert a Text to a Text3D object."""
obj.__class__ = Text3D
- obj.set_3d_properties(z, dir)
+ obj.set_3d_properties(z, zdir)
class Line3D(lines.Line2D):
+ '''
+ 3D line object.
+ '''
def __init__(self, xs, ys, zs, *args, **kwargs):
lines.Line2D.__init__(self, [], [], *args, **kwargs)
self._verts3d = xs, ys, zs
- def set_3d_properties(self, zs=0, dir='z'):
+ def set_3d_properties(self, zs=0, zdir='z'):
xs = self.get_xdata()
ys = self.get_ydata()
try:
@@ -48,7 +92,7 @@
zs = [zs for x in xs]
except:
pass
- self._verts3d = juggle_axes(xs, ys, zs, dir)
+ self._verts3d = juggle_axes(xs, ys, zs, zdir)
def draw(self, renderer):
xs3d, ys3d, zs3d = self._verts3d
@@ -56,46 +100,58 @@
self.set_data(xs, ys)
lines.Line2D.draw(self, renderer)
-def line_2d_to_3d(line, z=0, dir='z'):
+def line_2d_to_3d(line, zs=0, zdir='z'):
+ '''
+ Convert a 2D line to 3D.
+ '''
line.__class__ = Line3D
- line.set_3d_properties(z, dir)
+ line.set_3d_properties(zs, zdir)
-def path_to_3d_segment(path, z=0, dir='z'):
- '''Convert a path to a 3d segment.'''
+def path_to_3d_segment(path, z=0, zdir='z'):
+ '''Convert a path to a 3D segment.'''
seg = []
for (pathseg, code) in path.iter_segments():
seg.append(pathseg)
- seg3d = [juggle_axes(x, y, z, dir) for (x, y) in seg]
+ seg3d = [juggle_axes(x, y, z, zdir) for (x, y) in seg]
return seg3d
-def paths_to_3d_segments(paths, zs=0, dir='z'):
- '''Convert paths from a collection object to 3d segments.'''
+def paths_to_3d_segments(paths, zs=0, zdir='z'):
+ '''Convert paths from a collection object to 3D segments.'''
try:
zs = float(zs)
- zs = [zs for i in range(len(paths))]
+ zs = [zs] * len(paths)
except:
pass
segments = []
for path, z in zip(paths, zs):
- segments.append(path_to_3d_segment(path, z, dir))
+ segments.append(path_to_3d_segment(path, z, zdir))
return segments
class Line3DCollection(LineCollection):
+ '''
+ A collection of 3D lines.
+ '''
def __init__(self, segments, *args, **kwargs):
LineCollection.__init__(self, segments, *args, **kwargs)
def set_segments(self, segments):
+ '''
+ Set 3D segments
+ '''
self._segments3d = segments
LineCollection.set_segments(self, [])
def do_3d_projection(self, renderer):
+ '''
+ Project the points according to renderer matrix.
+ '''
xyslist = [
proj3d.proj_trans_points(points, renderer.M) for points in
self._segments3d]
- segments_2d = [zip(xs,ys) for (xs,ys,zs) in xyslist]
+ segments_2d = [zip(xs, ys) for (xs, ys, zs) in xyslist]
LineCollection.set_segments(self, segments_2d)
minz = 1e9
@@ -108,22 +164,28 @@
self.do_3d_projection(renderer)
LineCollection.draw(self, renderer)
-def line_collection_2d_to_3d(col, z=0, dir='z'):
+def line_collection_2d_to_3d(col, zs=0, zdir='z'):
"""Convert a LineCollection to a Line3DCollection object."""
- segments3d = paths_to_3d_segments(col.get_paths(), z, dir)
+ segments3d = paths_to_3d_segments(col.get_paths(), zs, zdir)
col.__class__ = Line3DCollection
col.set_segments(segments3d)
class Patch3D(Patch):
+ '''
+ 3D patch object.
+ '''
def __init__(self, *args, **kwargs):
zs = kwargs.pop('zs', [])
- dir = kwargs.pop('dir', 'z')
+ zdir = kwargs.pop('zdir', 'z')
Patch.__init__(self, *args, **kwargs)
- self.set_3d_properties(zs, dir)
+ self.set_3d_properties(zs, zdir)
- def set_3d_properties(self, verts, z=0, dir='z'):
- self._segment3d = [juggle_axes(x, y, z, dir) for (x, y) in verts]
+ def set_3d_properties(self, verts, zs=0, zdir='z'):
+ if not iterable(zs):
+ zs = [zs] * len(verts)
+ self._segment3d = [juggle_axes(x, y, z, zdir) \
+ for ((x, y), z) in zip(verts, zs)]
self._facecolor3d = Patch.get_facecolor(self)
def get_path(self):
@@ -135,7 +197,7 @@
def do_3d_projection(self, renderer):
s = self._segment3d
xs, ys, zs = zip(*s)
- vxs,vys,vzs,vis = proj3d.proj_transform_clip(xs,ys,zs, renderer.M)
+ vxs, vys,vzs, vis = proj3d.proj_transform_clip(xs, ys, zs, renderer.M)
self._path2d = mpath.Path(zip(vxs, vys))
# FIXME: coloring
self._facecolor2d = self._facecolor3d
@@ -144,26 +206,29 @@
def draw(self, renderer):
Patch.draw(self, renderer)
-def patch_2d_to_3d(patch, z=0, dir='z'):
+def patch_2d_to_3d(patch, z=0, zdir='z'):
"""Convert a Patch to a Patch3D object."""
verts = patch.get_verts()
patch.__class__ = Patch3D
- patch.set_3d_properties(verts, z, dir)
+ patch.set_3d_properties(verts, z, zdir)
class Patch3DCollection(PatchCollection):
+ '''
+ A collection of 3D patches.
+ '''
def __init__(self, *args, **kwargs):
PatchCollection.__init__(self, *args, **kwargs)
- def set_3d_properties(self, zs, dir):
+ def set_3d_properties(self, zs, zdir):
xs, ys = zip(*self.get_offsets())
- self._offsets3d = juggle_axes(xs, ys, zs, dir)
+ self._offsets3d = juggle_axes(xs, ys, zs, zdir)
self._facecolor3d = self.get_facecolor()
self._edgecolor3d = self.get_edgecolor()
def do_3d_projection(self, renderer):
- xs,ys,zs = self._offsets3d
- vxs,vys,vzs,vis = proj3d.proj_transform_clip(xs,ys,zs, renderer.M)
+ xs, ys, zs = self._offsets3d
+ vxs, vys, vzs, vis = proj3d.proj_transform_clip(xs, ys, zs, renderer.M)
#FIXME: mpl allows us no way to unset the collection alpha value
self._alpha = None
self.set_facecolors(zalpha(self._facecolor3d, vzs))
@@ -175,19 +240,22 @@
def draw(self, renderer):
PatchCollection.draw(self, renderer)
-def patch_collection_2d_to_3d(col, zs=0, dir='z'):
+def patch_collection_2d_to_3d(col, zs=0, zdir='z'):
"""Convert a PatchCollection to a Patch3DCollection object."""
col.__class__ = Patch3DCollection
- col.set_3d_properties(zs, dir)
+ col.set_3d_properties(zs, zdir)
class Poly3DCollection(PolyCollection):
+ '''
+ A collection of 3D polygons.
+ '''
def __init__(self, verts, *args, **kwargs):
PolyCollection.__init__(self, verts, *args, **kwargs)
self.set_3d_properties()
def get_vector(self, segments3d):
- """optimise points for projection"""
+ """Optimize points for projection"""
si = 0
ei = 0
segis = []
@@ -195,11 +263,11 @@
for p in segments3d:
points.extend(p)
ei = si+len(p)
- segis.append((si,ei))
+ segis.append((si, ei))
si = ei
- xs,ys,zs = zip(*points)
+ xs, ys, zs = zip(*points)
ones = np.ones(len(xs))
- self._vec = np.array([xs,ys,zs,ones])
+ self._vec = np.array([xs, ys, zs, ones])
self._segis = segis
self._sort_zpos = min(zs)
@@ -221,14 +289,14 @@
# if required sort by depth (furthest drawn first)
if self._zsort:
- z_segments_2d = [(min(zs),zip(xs,ys),c) for
- (xs,ys,zs),c in zip(xyzlist,colors)]
+ z_segments_2d = [(min(zs), zip(xs, ys), c) for
+ (xs, ys, zs), c in zip(xyzlist, colors)]
z_segments_2d.sort()
z_segments_2d.reverse()
else:
raise ValueError, "whoops"
- segments_2d = [s for z,s,c in z_segments_2d]
- colors = [c for z,s,c in z_segments_2d]
+ segments_2d = [s for z, s, c in z_segments_2d]
+ colors = [c for z, s, c in z_segments_2d]
PolyCollection.set_verts(self, segments_2d)
self._facecolors2d = colors
@@ -244,21 +312,23 @@
def draw(self, renderer):
return Collection.draw(self, renderer)
-def poly_collection_2d_to_3d(col, zs=None, dir='z'):
+def poly_collection_2d_to_3d(col, zs=None, zdir='z'):
"""Convert a PolyCollection to a Poly3DCollection object."""
- segments_3d = paths_to_3d_segments(col.get_paths(), zs, dir)
+ segments_3d = paths_to_3d_segments(col.get_paths(), zs, zdir)
col.__class__ = Poly3DCollection
col.set_verts(segments_3d)
col.set_3d_properties()
-def juggle_axes(xs,ys,zs, dir):
+def juggle_axes(xs, ys, zs, zdir):
"""
- Depending on the direction of the plot re-order the axis.
- This is so that 2d plots can be plotted along any direction.
+ Reorder coordinates so that zdir
"""
- if dir == 'x': return zs,xs,ys
- elif dir == 'y': return xs,zs,ys
- else: return xs,ys,zs
+ if zdir == 'x':
+ return zs, xs, ys
+ elif zdir == 'y':
+ return xs, zs, ys
+ else:
+ return xs, ys, zs
def iscolor(c):
try:
@@ -269,8 +339,8 @@
def get_colors(c, num):
"""Stretch the color argument to provide the required number num"""
- if type(c)==type("string"):
- c = colors.colorConverter.to_rgba(colors)
+ if type(c) == type("string"):
+ c = mcolors.colorConverter.to_rgba(c)
if iscolor(c):
return [c] * num
@@ -285,9 +355,9 @@
def zalpha(colors, zs):
"""Modify the alphas of the color list according to depth"""
- colors = get_colors(colors,len(zs))
- norm = Normalize(min(zs),max(zs))
- sats = 1 - norm(zs)*0.7
- colors = [(c[0],c[1],c[2],c[3]*s) for c,s in zip(colors,sats)]
+ colors = get_colors(colors, len(zs))
+ norm = Normalize(min(zs), max(zs))
+ sats = 1 - norm(zs) * 0.7
+ colors = [(c[0], c[1], c[2], c[3] * s) for c, s in zip(colors, sats)]
return colors
Modified: trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py 2009-06-07 17:36:51 UTC (rev 7197)
+++ trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py 2009-06-07 23:23:41 UTC (rev 7198)
@@ -4,17 +4,14 @@
# Parts fixed by Reinier Heeres <re...@he...>
"""
-3D projection glued onto 2D Axes.
-
-Axes3D
+Module containing Axes3D, an object which can plot 3D objects on a
+2D matplotlib figure.
"""
-from matplotlib import pyplot as plt
-import random
-
from matplotlib.axes import Axes
from matplotlib import cbook
from matplotlib.transforms import Bbox
+from matplotlib import collections
import numpy as np
from matplotlib.colors import Normalize, colorConverter
@@ -25,32 +22,23 @@
def sensible_format_data(self, value):
"""Used to generate more comprehensible numbers in status bar"""
if abs(value) > 1e4 or abs(value)<1e-3:
- s = '%1.4e'% value
+ s = '%1.4e' % value
return self._formatSciNotation(s)
else:
return '%4.3f' % value
def unit_bbox():
- box = Bbox(np.array([[0,0],[1,1]]))
+ box = Bbox(np.array([[0, 0], [1, 1]]))
return box
-class Axes3DI(Axes):
- """Wrap an Axes object
-
- The x,y data coordinates, which are manipulated by set_xlim and
- set_ylim are used as the target view coordinates by the 3D
- transformations. These coordinates are mostly invisible to the
- outside world.
-
- set_w_xlim, set_w_ylim and set_w_zlim manipulate the 3D world
- coordinates which are scaled to represent the data and are stored
- in the xy_dataLim, zz_datalim bboxes.
-
- The axes representing the x,y,z world dimensions are self.w_xaxis,
- self.w_yaxis and self.w_zaxis. They can probably be controlled in
- more or less the normal ways.
+class Axes3D(Axes):
"""
- def __init__(self, fig, rect=[0.0, 0.0, 1.0, 1.0], *args, **kwargs):
+ 3D axes object.
+ """
+
+ def __init__(self, fig, rect=None, *args, **kwargs):
+ if rect is None:
+ rect = [0.0, 0.0, 1.0, 1.0]
self.fig = fig
self.cids = []
@@ -87,71 +75,47 @@
ydwl = (0.95/self.dist)
ydw = (0.9/self.dist)
- self.set_xlim(-xdwl,xdw)
- self.set_ylim(-ydwl,ydw)
+ Axes.set_xlim(self, -xdwl, xdw)
+ Axes.set_ylim(self, -ydwl, ydw)
- def really_set_xlim(self, vmin, vmax):
- self.viewLim.intervalx().set_bounds(vmin, vmax)
-
- def really_set_ylim(self, vmin, vmax):
- self.viewLim.intervaly().set_bounds(vmin, vmax)
-
- def vlim_argument(self, get_lim, *args):
- if not args:
- vmin,vmax = get_lim()
- elif len(args)==2:
- vmin,vmax = args
- elif len(args)==1:
- vmin,vmax = args[0]
- return vmin,vmax
-
- def nset_xlim(self, *args):
- raise
- vmin,vmax = self.vlim_argument(self.get_xlim)
- print 'xlim', vmin,vmax
-
- def nset_ylim(self, *args):
- vmin,vmax = self.vlim_argument(self.get_ylim)
- print 'ylim', vmin,vmax
-
def create_axes(self):
- self.w_xaxis = axis3d.XAxis('x',self.xy_viewLim.intervalx,
+ self.w_xaxis = axis3d.XAxis('x', self.xy_viewLim.intervalx,
self.xy_dataLim.intervalx, self)
- self.w_yaxis = axis3d.YAxis('y',self.xy_viewLim.intervaly,
+ self.w_yaxis = axis3d.YAxis('y', self.xy_viewLim.intervaly,
self.xy_dataLim.intervaly, self)
- self.w_zaxis = axis3d.ZAxis('z',self.zz_viewLim.intervalx,
+ self.w_zaxis = axis3d.ZAxis('z', self.zz_viewLim.intervalx,
self.zz_dataLim.intervalx, self)
- def unit_cube(self,vals=None):
- minx,maxx,miny,maxy,minz,maxz = vals or self.get_w_lims()
- xs,ys,zs = ([minx,maxx,maxx,minx,minx,maxx,maxx,minx],
- [miny,miny,maxy,maxy,miny,miny,maxy,maxy],
- [minz,minz,minz,minz,maxz,maxz,maxz,maxz])
- return zip(xs,ys,zs)
+ def unit_cube(self, vals=None):
+ minx, maxx, miny, maxy, minz, maxz = vals or self.get_w_lims()
+ xs, ys, zs = ([minx, maxx, maxx, minx, minx, maxx, maxx, minx],
+ [miny, miny, maxy, maxy, miny, miny, maxy, maxy],
+ [minz, minz, minz, minz, maxz, maxz, maxz, maxz])
+ return zip(xs, ys, zs)
- def tunit_cube(self,vals=None,M=None):
+ def tunit_cube(self, vals=None, M=None):
if M is None:
M = self.M
xyzs = self.unit_cube(vals)
- tcube = proj3d.proj_points(xyzs,M)
+ tcube = proj3d.proj_points(xyzs, M)
return tcube
- def tunit_edges(self, vals=None,M=None):
- tc = self.tunit_cube(vals,M)
- edges = [(tc[0],tc[1]),
- (tc[1],tc[2]),
- (tc[2],tc[3]),
- (tc[3],tc[0]),
+ def tunit_edges(self, vals=None, M=None):
+ tc = self.tunit_cube(vals, M)
+ edges = [(tc[0], tc[1]),
+ (tc[1], tc[2]),
+ (tc[2], tc[3]),
+ (tc[3], tc[0]),
- (tc[0],tc[4]),
- (tc[1],tc[5]),
- (tc[2],tc[6]),
- (tc[3],tc[7]),
+ (tc[0], tc[4]),
+ (tc[1], tc[5]),
+ (tc[2], tc[6]),
+ (tc[3], tc[7]),
- (tc[4],tc[5]),
- (tc[5],tc[6]),
- (tc[6],tc[7]),
- (tc[7],tc[4])]
+ (tc[4], tc[5]),
+ (tc[5], tc[6]),
+ (tc[6], tc[7]),
+ (tc[7], tc[4])]
return edges
def draw(self, renderer):
@@ -189,22 +153,19 @@
def get_axis_position(self):
vals = self.get_w_lims()
- tc = self.tunit_cube(vals,self.M)
- xhigh = tc[1][2]>tc[2][2]
- yhigh = tc[3][2]>tc[2][2]
- zhigh = tc[0][2]>tc[2][2]
- return xhigh,yhigh,zhigh
+ tc = self.tunit_cube(vals, self.M)
+ xhigh = tc[1][2] > tc[2][2]
+ yhigh = tc[3][2] > tc[2][2]
+ zhigh = tc[0][2] > tc[2][2]
+ return xhigh, yhigh, zhigh
def update_datalim(self, xys, **kwargs):
pass
- def update_datalim_numerix(self, x, y):
- pass
-
- def auto_scale_xyz(self, X,Y,Z=None,had_data=None):
- x,y,z = map(np.asarray, (X,Y,Z))
+ def auto_scale_xyz(self, X, Y, Z=None, had_data=None):
+ x, y, z = map(np.asarray, (X, Y, Z))
try:
- x,y = x.flatten(),y.flatten()
+ x, y = x.flatten(), y.flatten()
if Z is not None:
z = z.flatten()
except AttributeError:
@@ -225,55 +186,63 @@
# of data and decides how to scale the view portal to fit it.
self.set_top_view()
- if not self._ready: return
+ if not self._ready:
+ return
- if not self.get_autoscale_on(): return
+ if not self.get_autoscale_on():
+ return
if scalex:
- self.set_w_xlim(self.xy_dataLim.intervalx)
+ self.set_xlim3d(self.xy_dataLim.intervalx)
if scaley:
- self.set_w_ylim(self.xy_dataLim.intervaly)
+ self.set_ylim3d(self.xy_dataLim.intervaly)
if scalez:
- self.set_w_zlim(self.zz_dataLim.intervalx)
+ self.set_zlim3d(self.zz_dataLim.intervalx)
def get_w_lims(self):
'''Get 3d world limits.'''
- minpy,maxx = self.get_w_xlim()
- miny,maxy = self.get_w_ylim()
- minz,maxz = self.get_w_zlim()
- return minpy,maxx,miny,maxy,minz,maxz
+ minpy, maxx = self.get_xlim3d()
+ miny, maxy = self.get_ylim3d()
+ minz, maxz = self.get_zlim3d()
+ return minpy, maxx, miny, maxy, minz, maxz
def _determine_lims(self, xmin=None, xmax=None, *args, **kwargs):
if xmax is None and cbook.iterable(xmin):
xmin, xmax = xmin
return (xmin, xmax)
- def set_w_zlim(self, *args, **kwargs):
- '''Set 3d z limits.'''
+ def set_xlim3d(self, *args, **kwargs):
+ '''Set 3D x limits.'''
lims = self._determine_lims(*args, **kwargs)
- self.zz_viewLim.intervalx = lims
+ self.xy_viewLim.intervalx = lims
return lims
- def set_w_xlim(self, *args, **kwargs):
- '''Set 3d x limits.'''
+ def set_ylim3d(self, *args, **kwargs):
+ '''Set 3D y limits.'''
lims = self._determine_lims(*args, **kwargs)
- self.xy_viewLim.intervalx = lims
+ self.xy_viewLim.intervaly = lims
return lims
- def set_w_ylim(self, *args, **kwargs):
- '''Set 3d y limits.'''
+ def set_zlim3d(self, *args, **kwargs):
+ '''Set 3D z limits.'''
lims = self._determine_lims(*args, **kwargs)
- self.xy_viewLim.intervaly = lims
+ self.zz_viewLim.intervalx = lims
return lims
- def get_w_zlim(self):
- return self.zz_viewLim.intervalx
-
- def get_w_xlim(self):
+ def get_xlim3d(self):
+ '''Get 3D x limits.'''
return self.xy_viewLim.intervalx
- def get_w_ylim(self):
+ def get_ylim3d(self):
+ '''Get 3D y limits.'''
return self.xy_viewLim.intervaly
+ def get_zlim3d(self):
+ '''Get 3D z limits.'''
+ return self.zz_viewLim.intervalx
+
+ def clabel(self, *args, **kwargs):
+ return None
+
def pany(self, numsteps):
print 'numsteps', numsteps
@@ -296,23 +265,23 @@
point.
"""
- relev,razim = np.pi * self.elev/180, np.pi * self.azim/180
+ relev, razim = np.pi * self.elev/180, np.pi * self.azim/180
- xmin,xmax = self.get_w_xlim()
- ymin,ymax = self.get_w_ylim()
- zmin,zmax = self.get_w_zlim()
+ xmin, xmax = self.get_xlim3d()
+ ymin, ymax = self.get_ylim3d()
+ zmin, zmax = self.get_zlim3d()
# transform to uniform world coordinates 0-1.0,0-1.0,0-1.0
- worldM = proj3d.world_transformation(xmin,xmax,
- ymin,ymax,
- zmin,zmax)
+ worldM = proj3d.world_transformation(xmin, xmax,
+ ymin, ymax,
+ zmin, zmax)
# look into the middle of the new coordinates
- R = np.array([0.5,0.5,0.5])
+ R = np.array([0.5, 0.5, 0.5])
- xp = R[0] + np.cos(razim)*np.cos(relev)*self.dist
- yp = R[1] + np.sin(razim)*np.cos(relev)*self.dist
- zp = R[2] + np.sin(relev)*self.dist
+ xp = R[0] + np.cos(razim) * np.cos(relev) * self.dist
+ yp = R[1] + np.sin(razim) * np.cos(relev) * self.dist
+ zp = R[2] + np.sin(relev) * self.dist
E = np.array((xp, yp, zp))
self.eye = E
@@ -321,24 +290,24 @@
if abs(relev) > np.pi/2:
# upside down
- V = np.array((0,0,-1))
+ V = np.array((0, 0, -1))
else:
- V = np.array((0,0,1))
- zfront,zback = -self.dist,self.dist
+ V = np.array((0, 0, 1))
+ zfront, zback = -self.dist, self.dist
- viewM = proj3d.view_transformation(E,R,V)
- perspM = proj3d.persp_transformation(zfront,zback)
- M0 = np.dot(viewM,worldM)
- M = np.dot(perspM,M0)
+ viewM = proj3d.view_transformation(E, R, V)
+ perspM = proj3d.persp_transformation(zfront, zback)
+ M0 = np.dot(viewM, worldM)
+ M = np.dot(perspM, M0)
return M
def mouse_init(self):
self.button_pressed = None
canv = self.figure.canvas
if canv != None:
- c1 = canv.mpl_connect('motion_notify_event', self.on_move)
- c2 = canv.mpl_connect('button_press_event', self.button_press)
- c3 = canv.mpl_connect('button_release_event', self.button_release)
+ c1 = canv.mpl_connect('motion_notify_event', self._on_move)
+ c2 = canv.mpl_connect('button_press_event', self._button_press)
+ c3 = canv.mpl_connect('button_release_event', self._button_release)
self.cids = [c1, c2, c3]
def cla(self):
@@ -348,11 +317,11 @@
self.cids = []
Axes.cla(self)
- def button_press(self, event):
+ def _button_press(self, event):
self.button_pressed = event.button
- self.sx,self.sy = event.xdata,event.ydata
+ self.sx, self.sy = event.xdata, event.ydata
- def button_release(self, event):
+ def _button_release(self, event):
self.button_pressed = None
def format_xdata(self, x):
@@ -361,10 +330,11 @@
self.fmt_xdata if it is callable, else will fall back on the xaxis
major formatter
"""
- try: return self.fmt_xdata(x)
+ try:
+ return self.fmt_xdata(x)
except TypeError:
fmt = self.w_xaxis.get_major_formatter()
- return sensible_format_data(fmt,x)
+ return sensible_format_data(fmt, x)
def format_ydata(self, y):
"""
@@ -372,28 +342,30 @@
self.fmt_ydata if it is callable, else will fall back on the yaxis
major formatter
"""
- try: return self.fmt_ydata(y)
+ try:
+ return self.fmt_ydata(y)
except TypeError:
fmt = self.w_yaxis.get_major_formatter()
- return sensible_format_data(fmt,y)
+ return sensible_format_data(fmt, y)
def format_zdata(self, z):
"""
- Return y string formatted. This function will use the attribute
- self.fmt_ydata if it is callable, else will fall back on the yaxis
+ Return z string formatted. This function will use the attribute
+ self.fmt_zdata if it is callable, else will fall back on the yaxis
major formatter
"""
- try: return self.fmt_zdata(z)
- except (AttributeError,TypeError):
+ try:
+ return self.fmt_zdata(z)
+ except (AttributeError, TypeError):
fmt = self.w_zaxis.get_major_formatter()
- return sensible_format_data(fmt,z)
+ return sensible_format_data(fmt, z)
def format_coord(self, xd, yd):
- """Given the 2D view coordinates attempt to guess a 3D coordinate
-
- Looks for the nearest edge to the point and then assumes that the point is
- at the same z location as the nearest point on the edge.
"""
+ Given the 2D view coordinates attempt to guess a 3D coordinate.
+ Looks for the nearest edge to the point and then assumes that
+ the point is at the same z location as the nearest point on the edge.
+ """
if self.M is None:
return ''
@@ -402,32 +374,33 @@
return 'azimuth=%d deg, elevation=%d deg ' % (self.azim, self.elev)
# ignore xd and yd and display angles instead
- p = (xd,yd)
+ p = (xd, yd)
edges = self.tunit_edges()
#lines = [proj3d.line2d(p0,p1) for (p0,p1) in edges]
- ldists = [(proj3d.line2d_seg_dist(p0,p1,p),i) for i,(p0,p1) in enumerate(edges)]
+ ldists = [(proj3d.line2d_seg_dist(p0, p1, p), i) for \
+ i, (p0, p1) in enumerate(edges)]
ldists.sort()
# nearest edge
edgei = ldists[0][1]
- p0,p1 = edges[edgei]
+ p0, p1 = edges[edgei]
# scale the z value to match
- x0,y0,z0 = p0
- x1,y1,z1 = p1
- d0 = np.hypot(x0-xd,y0-yd)
- d1 = np.hypot(x1-xd,y1-yd)
+ x0, y0, z0 = p0
+ x1, y1, z1 = p1
+ d0 = np.hypot(x0-xd, y0-yd)
+ d1 = np.hypot(x1-xd, y1-yd)
dt = d0+d1
z = d1/dt * z0 + d0/dt * z1
- x,y,z = proj3d.inv_transform(xd,yd,z,self.M)
+ x, y, z = proj3d.inv_transform(xd, yd, z, self.M)
xs = self.format_xdata(x)
ys = self.format_ydata(y)
zs = self.format_ydata(z)
- return 'x=%s, y=%s, z=%s'%(xs,ys,zs)
+ return 'x=%s, y=%s, z=%s' % (xs, ys, zs)
- def on_move(self, event):
+ def _on_move(self, event):
"""Mouse moving
button-1 rotates
@@ -438,27 +411,26 @@
if self.M is None:
return
- # this shouldn't be called before the graph has been drawn for the first time!
+
x, y = event.xdata, event.ydata
-
# In case the mouse is out of bounds.
if x == None:
-
return
- dx,dy = x-self.sx,y-self.sy
- x0,x1 = self.get_xlim()
- y0,y1 = self.get_ylim()
+
+ dx, dy = x - self.sx, y - self.sy
+ x0, x1 = self.get_xlim()
+ y0, y1 = self.get_ylim()
w = (x1-x0)
h = (y1-y0)
- self.sx,self.sy = x,y
+ self.sx, self.sy = x, y
if self.button_pressed == 1:
# rotate viewing point
# get the x and y pixel coords
if dx == 0 and dy == 0:
return
- self.elev = axis3d.norm_angle(self.elev - (dy/h)*180)
- self.azim = axis3d.norm_angle(self.azim - (dx/w)*180)
+ self.elev = art3d.norm_angle(self.elev - (dy/h)*180)
+ self.azim = art3d.norm_angle(self.azim - (dx/w)*180)
self.get_proj()
self.figure.canvas.draw()
elif self.button_pressed == 2:
@@ -469,73 +441,122 @@
elif self.button_pressed == 3:
# zoom view
# hmmm..this needs some help from clipping....
- minpy,maxx,miny,maxy,minz,maxz = self.get_w_lims()
+ minpy, maxx, miny, maxy, minz, maxz = self.get_w_lims()
df = 1-((h - dy)/h)
dx = (maxx-minpy)*df
dy = (maxy-miny)*df
dz = (maxz-minz)*df
- self.set_w_xlim(minpy-dx,maxx+dx)
- self.set_w_ylim(miny-dy,maxy+dy)
- self.set_w_zlim(minz-dz,maxz+dz)
+ self.set_xlim3d(minpy - dx, maxx + dx)
+ self.set_ylim3d(miny - dy, maxy + dy)
+ self.set_zlim3d(minz - dz, maxz + dz)
self.get_proj()
self.figure.canvas.draw()
def set_xlabel(self, xlabel, fontdict=None, **kwargs):
- #par = cbook.popd(kwargs, 'par',None)
- #label.set_par(par)
+ '''Set xlabel. '''
label = self.w_xaxis.get_label()
label.set_text(xlabel)
- if fontdict is not None: label.update(fontdict)
+ if fontdict is not None:
+ label.update(fontdict)
label.update(kwargs)
return label
def set_ylabel(self, ylabel, fontdict=None, **kwargs):
+ '''Set ylabel.'''
+
label = self.w_yaxis.get_label()
label.set_text(ylabel)
- if fontdict is not None: label.update(fontdict)
+ if fontdict is not None:
+ label.update(fontdict)
label.update(kwargs)
return label
def set_zlabel(self, zlabel, fontdict=None, **kwargs):
+ '''Set zlabel.'''
+
label = self.w_zaxis.get_label()
label.set_text(zlabel)
- if fontdict is not None: label.update(fontdict)
+ if fontdict is not None:
+ label.update(fontdict)
label.update(kwargs)
return label
- def plot(self, *args, **kwargs):
+ def text(self, x, y, z, s, zdir=None):
+ '''Add text to the plot.'''
+ text = Axes.text(self, x, y, s)
+ art3d.text_2d_to_3d(text, z, zdir)
+ return text
+
+ text3D = text
+
+ def plot(self, xs, ys, *args, **kwargs):
+ '''
+ Plot 2D or 3D data.
+
+ ========== ================================================
+ Argument Description
+ ========== ================================================
+ *xs*, *ys* X, y coordinates of vertices
+
+ *zs* z value(s), either one for all points or one for
+ each point.
+ *zdir* Which direction to use as z ('x', 'y' or 'z')
+ when plotting a 2d set.
+ ========== ================================================
+
+ Other arguments are passed on to
+ :func:`~matplotlib.axes.Axes.plot`
+ '''
+
had_data = self.has_data()
+ zs = kwargs.pop('zs', 0)
+ zdir = kwargs.pop('zdir', 'z')
- zval = kwargs.pop( 'z', 0)
- zdir = kwargs.pop('dir', 'z')
- lines = Axes.plot(self, *args, **kwargs)
+ argsi = 0
+ # First argument is array of zs
+ if len(args) > 0 and cbook.iterable(args[0]) and \
+ len(xs) == len(args[0]) and cbook.is_scalar(args[0][0]):
+ zs = args[argsi]
+ argsi += 1
+
+ # First argument is z value
+ elif len(args) > 0 and cbook.is_scalar(args[0]):
+ zs = args[argsi]
+ argsi += 1
+
+ # Match length
+ if not cbook.iterable(zs):
+ zs = [zs] * len(xs)
+
+ lines = Axes.plot(self, xs, ys, *args[argsi:], **kwargs)
for line in lines:
- art3d.line_2d_to_3d(line, z=zval, dir=zdir)
+ art3d.line_2d_to_3d(line, zs=zs, zdir=zdir)
- xs = lines[0].get_xdata()
- ys = lines[0].get_ydata()
- zs = [zval for x in xs]
- xs,ys,zs = art3d.juggle_axes(xs,ys,zs,zdir)
- self.auto_scale_xyz(xs,ys,zs, had_data)
+ self.auto_scale_xyz(xs, ys, zs, had_data)
return lines
- def plot3D(self, xs, ys, zs, *args, **kwargs):
- had_data = self.has_data()
- lines = Axes.plot(self, xs,ys, *args, **kwargs)
- if len(lines)==1:
- line = lines[0]
- art3d.line_2d_to_3d(line, zs)
- self.auto_scale_xyz(xs,ys,zs, had_data)
- return lines
+ plot3D = plot
- plot3d=plot3D
-
def plot_surface(self, X, Y, Z, *args, **kwargs):
+ '''
+ Create a surface plot.
+
+ ========== ================================================
+ Argument Description
+ ========== ================================================
+ *X*, *Y*, Data values as numpy.arrays
+ *Z*
+ *rstride* Array row stride (step size)
+ *cstride* Array column stride (step size)
+ *color* Color of the surface patches
+ ========== ================================================
+ '''
+
had_data = self.has_data()
rows, cols = Z.shape
- tX,tY,tZ = np.transpose(X), np.transpose(Y), np.transpose(Z)
+ tX, tY, tZ = np.transpose(X), np.transpose(Y), np.transpose(Z)
rstride = kwargs.pop('rstride', 10)
cstride = kwargs.pop('cstride', 10)
@@ -544,21 +565,21 @@
polys = []
boxes = []
- for rs in np.arange(0,rows-1,rstride):
- for cs in np.arange(0,cols-1,cstride):
+ for rs in np.arange(0, rows-1, rstride):
+ for cs in np.arange(0, cols-1, cstride):
ps = []
corners = []
- for a,ta in [(X,tX),(Y,tY),(Z,tZ)]:
- ztop = a[rs][cs:min(cols,cs+cstride+1)]
- zleft = ta[min(cols-1,cs+cstride)][rs:min(rows,rs+rstride+1)]
- zbase = a[min(rows-1,rs+rstride)][cs:min(cols,cs+cstride+1):]
+ for a, ta in [(X, tX), (Y, tY), (Z, tZ)]:
+ ztop = a[rs][cs:min(cols, cs+cstride+1)]
+ zleft = ta[min(cols-1, cs+cstride)][rs:min(rows, rs+rstride+1)]
+ zbase = a[min(rows-1, rs+rstride)][cs:min(cols, cs+cstride+1):]
zbase = zbase[::-1]
- zright = ta[cs][rs:min(rows,rs+rstride+1):]
+ zright = ta[cs][rs:min(rows, rs+rstride+1):]
zright = zright[::-1]
- corners.append([ztop[0],ztop[-1],zbase[0],zbase[-1]])
- z = np.concatenate((ztop,zleft,zbase,zright))
+ corners.append([ztop[0], ztop[-1], zbase[0], zbase[-1]])
+ z = np.concatenate((ztop, zleft, zbase, zright))
ps.append(z)
- boxes.append(map(np.array,zip(*corners)))
+ boxes.append(map(np.array, zip(*corners)))
polys.append(zip(*ps))
lines = []
@@ -567,8 +588,8 @@
n = proj3d.cross(box[0]-box[1],
box[0]-box[2])
n = n/proj3d.mod(n)*5
- shade.append(np.dot(n,[-1,-1,0.5]))
- lines.append((box[0],n+box[0]))
+ shade.append(np.d...
[truncated message content] |
|
From: <lee...@us...> - 2009-06-07 17:36:52
|
Revision: 7197
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7197&view=rev
Author: leejjoon
Date: 2009-06-07 17:36:51 +0000 (Sun, 07 Jun 2009)
Log Message:
-----------
fix axes_grid/demo_parasite_axes.py
Modified Paths:
--------------
trunk/matplotlib/examples/axes_grid/demo_parasite_axes.py
trunk/matplotlib/examples/axes_grid/demo_parasite_axes2.py
Modified: trunk/matplotlib/examples/axes_grid/demo_parasite_axes.py
===================================================================
--- trunk/matplotlib/examples/axes_grid/demo_parasite_axes.py 2009-06-07 15:48:05 UTC (rev 7196)
+++ trunk/matplotlib/examples/axes_grid/demo_parasite_axes.py 2009-06-07 17:36:51 UTC (rev 7197)
@@ -22,8 +22,9 @@
par2.set_ylabel("Velocity")
offset = (60, 0)
- new_axisline = par2._grid_helper.new_axisline
+ new_axisline = par2._grid_helper.new_fixed_axis
par2.axis["right2"] = new_axisline(loc="right",
+ axes=par2,
offset=offset)
Modified: trunk/matplotlib/examples/axes_grid/demo_parasite_axes2.py
===================================================================
--- trunk/matplotlib/examples/axes_grid/demo_parasite_axes2.py 2009-06-07 15:48:05 UTC (rev 7196)
+++ trunk/matplotlib/examples/axes_grid/demo_parasite_axes2.py 2009-06-07 17:36:51 UTC (rev 7197)
@@ -1,5 +1,4 @@
from mpl_toolkits.axes_grid.parasite_axes import SubplotHost
-import matplotlib.transforms as mtransforms
import matplotlib.pyplot as plt
if 1:
@@ -20,6 +19,7 @@
offset = 60, 0
new_axisline = par2.get_grid_helper().new_fixed_axis
par2.axis["right2"] = new_axisline(loc="right",
+ axes=par2,
offset=offset)
par2.axis["right2"].label.set_visible(True)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-06-07 15:48:37
|
Revision: 7196
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7196&view=rev
Author: jdh2358
Date: 2009-06-07 15:48:05 +0000 (Sun, 07 Jun 2009)
Log Message:
-----------
modifications to examples/docs to get them to build for the website
Modified Paths:
--------------
trunk/matplotlib/doc/pyplots/matplotlibrc
trunk/matplotlib/doc/pyplots/tex_demo.png
trunk/matplotlib/examples/pylab_examples/finance_work2.py
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/doc/pyplots/matplotlibrc
===================================================================
--- trunk/matplotlib/doc/pyplots/matplotlibrc 2009-06-07 14:15:28 UTC (rev 7195)
+++ trunk/matplotlib/doc/pyplots/matplotlibrc 2009-06-07 15:48:05 UTC (rev 7196)
@@ -27,7 +27,6 @@
# the default backend; one of GTK GTKAgg GTKCairo FltkAgg QtAgg TkAgg
# WX WXAgg Agg Cairo GD GDK Paint PS PDF SVG Template
backend : Agg
-numerix : numpy # numpy, Numeric or numarray
#maskedarray : False # True to use external maskedarray module
# instead of numpy.ma; this is a temporary
# setting for testing maskedarray.
Modified: trunk/matplotlib/doc/pyplots/tex_demo.png
===================================================================
(Binary files differ)
Modified: trunk/matplotlib/examples/pylab_examples/finance_work2.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/finance_work2.py 2009-06-07 14:15:28 UTC (rev 7195)
+++ trunk/matplotlib/examples/pylab_examples/finance_work2.py 2009-06-07 15:48:05 UTC (rev 7196)
@@ -1,10 +1,5 @@
-## Plot the stock price with some technical indicators
-## Example usage::
-## python stocks2.py --ticker=GE --startdate=2003
-##
-import datetime, os, urllib, optparse
+import datetime
import numpy as np
-import dateutil.parser
import matplotlib.colors as colors
import matplotlib.finance as finance
import matplotlib.dates as mdates
@@ -13,34 +8,12 @@
import matplotlib.pyplot as plt
import matplotlib.font_manager as font_manager
-today = datetime.date.today()
-optionparser = optparse.OptionParser()
+startdate = datetime.date(2006,1,1)
+today = enddate = datetime.date.today()
+ticker = 'SPY'
-optionparser.add_option('-t', '--ticker',
- dest='ticker',
- help='a stock market ticker',
- default='SPY')
-optionparser.add_option('-s', '--startdate',
- dest='startdate',
- help='the start date',
- default=(today-datetime.timedelta(days=365*2)).strftime('%Y-%m-%d'))
-
-optionparser.add_option('-e', '--enddate',
- dest='enddate',
- help='the end date',
- default=today.strftime('%Y-%m-%d'))
-
-
-(commandoptions, commandargs) = optionparser.parse_args()
-
-
-startdate = dateutil.parser.parse(commandoptions.startdate)
-enddate = dateutil.parser.parse(commandoptions.enddate)
-ticker = commandoptions.ticker
-
-
fh = finance.fetch_historical_yahoo(ticker, startdate, enddate)
# a numpy record array with fields: date, open, high, low, close, volume, adj_close)
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2009-06-07 14:15:28 UTC (rev 7195)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2009-06-07 15:48:05 UTC (rev 7196)
@@ -6019,7 +6019,7 @@
%(PolyCollection)s
- .. plot:: mpl_examples/pylab_examples/fill_between_demo.py.py
+ .. plot:: mpl_examples/pylab_examples/fill_between_demo.py
.. seealso::
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-06-07 14:16:06
|
Revision: 7195
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7195&view=rev
Author: jdh2358
Date: 2009-06-07 14:15:28 +0000 (Sun, 07 Jun 2009)
Log Message:
-----------
removed reserved name "as" from some examples
Modified Paths:
--------------
trunk/matplotlib/examples/axes_grid/inset_locator_demo.py
trunk/matplotlib/examples/axes_grid/simple_anchored_artists.py
Modified: trunk/matplotlib/examples/axes_grid/inset_locator_demo.py
===================================================================
--- trunk/matplotlib/examples/axes_grid/inset_locator_demo.py 2009-06-07 14:13:12 UTC (rev 7194)
+++ trunk/matplotlib/examples/axes_grid/inset_locator_demo.py 2009-06-07 14:15:28 UTC (rev 7195)
@@ -5,13 +5,13 @@
def add_sizebar(ax, size):
- as = AnchoredSizeBar(ax.transData,
+ asb = AnchoredSizeBar(ax.transData,
size,
str(size),
loc=8,
pad=0.1, borderpad=0.5, sep=5,
frameon=False)
- ax.add_artist(as)
+ ax.add_artist(asb)
fig = plt.figure(1, [5.5, 3])
Modified: trunk/matplotlib/examples/axes_grid/simple_anchored_artists.py
===================================================================
--- trunk/matplotlib/examples/axes_grid/simple_anchored_artists.py 2009-06-07 14:13:12 UTC (rev 7194)
+++ trunk/matplotlib/examples/axes_grid/simple_anchored_artists.py 2009-06-07 14:15:28 UTC (rev 7195)
@@ -38,13 +38,13 @@
from mpl_toolkits.axes_grid.anchored_artists import AnchoredSizeBar
# draw a horizontal bar with length of 0.1 in Data coordinate
# (ax.transData) with a label underneath.
- as = AnchoredSizeBar(ax.transData,
+ asb = AnchoredSizeBar(ax.transData,
0.1,
r"1$^{\prime}$",
loc=8,
pad=0.1, borderpad=0.5, sep=5,
frameon=False)
- ax.add_artist(as)
+ ax.add_artist(asb)
if 1:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-06-07 14:13:18
|
Revision: 7194
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7194&view=rev
Author: jdh2358
Date: 2009-06-07 14:13:12 +0000 (Sun, 07 Jun 2009)
Log Message:
-----------
update doc strings to point to new fill between demos
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2009-06-07 13:58:48 UTC (rev 7193)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2009-06-07 14:13:12 UTC (rev 7194)
@@ -6019,7 +6019,7 @@
%(PolyCollection)s
- .. plot:: mpl_examples/pylab_examples/fill_between.py
+ .. plot:: mpl_examples/pylab_examples/fill_between_demo.py.py
.. seealso::
@@ -6126,7 +6126,7 @@
%(PolyCollection)s
- .. plot:: mpl_examples/pylab_examples/fill_betweenx.py
+ .. plot:: mpl_examples/pylab_examples/fill_betweenx_demo.py
.. seealso::
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-06-07 14:11:32
|
Revision: 7192
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7192&view=rev
Author: jdh2358
Date: 2009-06-07 13:55:10 +0000 (Sun, 07 Jun 2009)
Log Message:
-----------
add support for bz2 files per sf support request 2794556
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/cbook.py
Modified: trunk/matplotlib/lib/matplotlib/cbook.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/cbook.py 2009-06-07 13:46:10 UTC (rev 7191)
+++ trunk/matplotlib/lib/matplotlib/cbook.py 2009-06-07 13:55:10 UTC (rev 7192)
@@ -314,6 +314,11 @@
# get rid of 'U' in flag for gzipped files.
flag = flag.replace('U','')
fh = gzip.open(fname, flag)
+ elif fname.endswith('.bz2'):
+ # get rid of 'U' in flag for bz2 files
+ flag = flag.replace('U','')
+ import bz2
+ fh = bz2.BZ2File(fname, flag)
else:
fh = file(fname, flag)
opened = True
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-06-07 14:10:58
|
Revision: 7191
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7191&view=rev
Author: jdh2358
Date: 2009-06-07 13:46:10 +0000 (Sun, 07 Jun 2009)
Log Message:
-----------
fixed a doc tutorial url
Modified Paths:
--------------
trunk/matplotlib/doc/users/pyplot_tutorial.rst
Modified: trunk/matplotlib/doc/users/pyplot_tutorial.rst
===================================================================
--- trunk/matplotlib/doc/users/pyplot_tutorial.rst 2009-06-07 13:08:34 UTC (rev 7190)
+++ trunk/matplotlib/doc/users/pyplot_tutorial.rst 2009-06-07 13:46:10 UTC (rev 7191)
@@ -271,4 +271,4 @@
variety of other coordinate systems one can choose -- see
:ref:`annotations-tutorial` for details. More examples can be found
in the `annotations demo
-<http://matplotlib.sf.net/examples/pylab_examples/annotation_demo.py>`_
+<http://matplotlib.sf.net/examples/pylab_examples/annotation_demo.html>`_
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-06-07 14:10:41
|
Revision: 7193
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7193&view=rev
Author: jdh2358
Date: 2009-06-07 13:58:48 +0000 (Sun, 07 Jun 2009)
Log Message:
-----------
update changelog
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-06-07 13:55:10 UTC (rev 7192)
+++ trunk/matplotlib/CHANGELOG 2009-06-07 13:58:48 UTC (rev 7193)
@@ -1,4 +1,15 @@
+2009-06-07 add support for bz2 files per sf support request 2794556 -
+ JDH
+2009-06-06 added a properties method to the artist and inspector to
+ return a dict mapping property name -> value; see sf
+ feature request 2792183 - JDH
+
+2009-06-06 added Neil's auto minor tick patch; sf patch #2789713 - JDH
+
+2009-06-06 do not apply alpha to rgba color conversion if input is
+ already rgba - JDH
+
2009-06-03 axes_grid : Initial check-in of curvelinear grid support. See
examples/axes_grid/demo_curvelinear_grid.py - JJL
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2009-06-07 13:08:40
|
Revision: 7190
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7190&view=rev
Author: leejjoon
Date: 2009-06-07 13:08:34 +0000 (Sun, 07 Jun 2009)
Log Message:
-----------
fix typo in axes_grid/clip_path.py
Modified Paths:
--------------
trunk/matplotlib/lib/mpl_toolkits/axes_grid/clip_path.py
Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/clip_path.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/clip_path.py 2009-06-06 21:35:36 UTC (rev 7189)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/clip_path.py 2009-06-07 13:08:34 UTC (rev 7190)
@@ -4,6 +4,7 @@
def atan2(dy, dx):
if dx == 0 and dx == 0:
+ print "warning"
return 0
else:
return math.atan2(dy, dx)
@@ -45,7 +46,7 @@
segx, segy = [], []
if dx == 0. and dy == 0:
- dx = x[+1] - x[i]
+ dx = x[i+1] - x[i]
dy = y[i+1] - y[i]
a = degrees(atan2(dy, dx))
@@ -59,7 +60,7 @@
ns = i+1
if dx == 0. and dy == 0:
- dx = x[+1] - x[i]
+ dx = x[i+1] - x[i]
dy = y[i+1] - y[i]
a = degrees(atan2(dy, dx))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2009-06-06 21:36:43
|
Revision: 7189
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7189&view=rev
Author: efiring
Date: 2009-06-06 21:35:36 +0000 (Sat, 06 Jun 2009)
Log Message:
-----------
Tweak John's change to handling of rgba arrays
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/colors.py
Modified: trunk/matplotlib/lib/matplotlib/colors.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/colors.py 2009-06-06 18:21:51 UTC (rev 7188)
+++ trunk/matplotlib/lib/matplotlib/colors.py 2009-06-06 21:35:36 UTC (rev 7189)
@@ -361,27 +361,35 @@
then an empty array will be returned. Same for an empty list.
"""
try:
- if c.lower() == 'none':
- return np.zeros((0,4), dtype=np.float_)
+ nc = len(c)
+ except TypeError:
+ raise ValueError(
+ "Cannot convert argument type %s to rgba array" % type(c))
+ try:
+ if nc == 0 or c.lower() == 'none':
+ return np.zeros((0,4), dtype=np.float)
except AttributeError:
pass
- if len(c) == 0:
- return np.zeros((0,4), dtype=np.float_)
try:
- result = np.array([self.to_rgba(c, alpha)], dtype=np.float_)
+ # Single value? Put it in an array with a single row.
+ return np.array([self.to_rgba(c, alpha)], dtype=np.float)
except ValueError:
if isinstance(c, np.ndarray):
if c.ndim != 2 and c.dtype.kind not in 'SU':
raise ValueError("Color array must be two-dimensional")
- if len(c.shape)==2 and c.shape[-1]==4:
+ if (c.ndim == 2 and c.shape[1] == 4 and c.dtype.kind == 'f'):
+ if (c.ravel() > 1).any() or (c.ravel() < 0).any():
+ raise ValueError(
+ "number in rgba sequence is outside 0-1 range")
# looks like rgba already, nothing to be done; do
# we want to apply alpha here if
# (c[:,3]==1).all() ?
- return c
- result = np.zeros((len(c), 4))
+ return np.asarray(c, np.float)
+ # It must be some other sequence of color specs.
+ result = np.zeros((nc, 4), dtype=np.float)
for i, cc in enumerate(c):
- result[i] = self.to_rgba(cc, alpha) # change in place
- return np.asarray(result, np.float_)
+ result[i] = self.to_rgba(cc, alpha)
+ return result
colorConverter = ColorConverter()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2009-06-06 18:21:52
|
Revision: 7188
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7188&view=rev
Author: efiring
Date: 2009-06-06 18:21:51 +0000 (Sat, 06 Jun 2009)
Log Message:
-----------
Try to improve the cursor readout and status message.
This could be done better with changes to the backends.
The status (pan/zoom etc) should be indicated via the
state of the buttons, e.g. using radio buttons, rather
than by printing text. The readout should be positioned
to minimize jumping around of the text.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/lib/matplotlib/backend_bases.py
trunk/matplotlib/lib/matplotlib/ticker.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2009-06-06 18:18:54 UTC (rev 7187)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2009-06-06 18:21:51 UTC (rev 7188)
@@ -2468,12 +2468,14 @@
def format_coord(self, x, y):
'return a format string formatting the *x*, *y* coord'
if x is None:
- x = '???'
+ xs = '???'
+ else:
+ xs = self.format_xdata(x)
if y is None:
- y = '???'
- xs = self.format_xdata(x)
- ys = self.format_ydata(y)
- return 'x=%s, y=%s'%(xs,ys)
+ ys = '???'
+ else:
+ ys = self.format_ydata(y)
+ return 'x=%s y=%s'%(xs,ys)
#### Interactive manipulation
Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backend_bases.py 2009-06-06 18:18:54 UTC (rev 7187)
+++ trunk/matplotlib/lib/matplotlib/backend_bases.py 2009-06-06 18:21:51 UTC (rev 7188)
@@ -1460,7 +1460,7 @@
restore_bbox = tight_bbox.adjust_bbox(self.figure, format,
bbox_inches)
-
+
_bbox_inches_restore = (bbox_inches, restore_bbox)
else:
_bbox_inches_restore = None
@@ -1896,7 +1896,7 @@
except OverflowError: pass
else:
if len(self.mode):
- self.set_message('%s : %s' % (self.mode, s))
+ self.set_message('%s, %s' % (self.mode, s))
else:
self.set_message(s)
else: self.set_message(self.mode)
@@ -1923,7 +1923,7 @@
'button_press_event', self.press_pan)
self._idRelease = self.canvas.mpl_connect(
'button_release_event', self.release_pan)
- self.mode = 'pan/zoom mode'
+ self.mode = 'pan/zoom'
self.canvas.widgetlock(self)
else:
self.canvas.widgetlock.release(self)
@@ -2193,7 +2193,7 @@
if self._active:
self._idPress = self.canvas.mpl_connect('button_press_event', self.press_zoom)
self._idRelease = self.canvas.mpl_connect('button_release_event', self.release_zoom)
- self.mode = 'Zoom to rect mode'
+ self.mode = 'zoom rect'
self.canvas.widgetlock(self)
else:
self.canvas.widgetlock.release(self)
Modified: trunk/matplotlib/lib/matplotlib/ticker.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/ticker.py 2009-06-06 18:18:54 UTC (rev 7187)
+++ trunk/matplotlib/lib/matplotlib/ticker.py 2009-06-06 18:21:51 UTC (rev 7188)
@@ -344,7 +344,7 @@
def format_data_short(self,value):
'return a short formatted string representation of a number'
- return '%1.3g'%value
+ return '%-12g'%value
def format_data(self,value):
'return a formatted string representation of a number'
@@ -525,7 +525,7 @@
def format_data_short(self,value):
'return a short formatted string representation of a number'
- return '%1.3g'%value
+ return '%-12g'%value
def is_decade(self, x):
n = self.nearest_long(x)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|