You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(115) |
Aug
(120) |
Sep
(137) |
Oct
(170) |
Nov
(461) |
Dec
(263) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(120) |
Feb
(74) |
Mar
(35) |
Apr
(74) |
May
(245) |
Jun
(356) |
Jul
(240) |
Aug
(115) |
Sep
(78) |
Oct
(225) |
Nov
(98) |
Dec
(271) |
2009 |
Jan
(132) |
Feb
(84) |
Mar
(74) |
Apr
(56) |
May
(90) |
Jun
(79) |
Jul
(83) |
Aug
(296) |
Sep
(214) |
Oct
(76) |
Nov
(82) |
Dec
(66) |
2010 |
Jan
(46) |
Feb
(58) |
Mar
(51) |
Apr
(77) |
May
(58) |
Jun
(126) |
Jul
(128) |
Aug
(64) |
Sep
(50) |
Oct
(44) |
Nov
(48) |
Dec
(54) |
2011 |
Jan
(68) |
Feb
(52) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
1
|
2
(1) |
3
(1) |
4
(1) |
5
|
6
|
7
(3) |
8
|
9
(1) |
10
|
11
(6) |
12
(1) |
13
(2) |
14
|
15
(1) |
16
(1) |
17
|
18
(3) |
19
(3) |
20
(3) |
21
(2) |
22
(7) |
23
(4) |
24
(7) |
25
(2) |
26
(2) |
27
(2) |
28
(15) |
29
(5) |
30
(1) |
|
|
|
From: <ef...@us...> - 2008-04-25 16:45:36
|
Revision: 5075 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5075&view=rev Author: efiring Date: 2008-04-25 09:45:30 -0700 (Fri, 25 Apr 2008) Log Message: ----------- Enforce python 2.4 or later; some other version-related cleanup Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/__init__.py trunk/matplotlib/setup.py trunk/matplotlib/setupext.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-04-25 15:43:06 UTC (rev 5074) +++ trunk/matplotlib/CHANGELOG 2008-04-25 16:45:30 UTC (rev 5075) @@ -1,4 +1,7 @@ +2008-04-25 Enforce python >= 2.4; remove subprocess build - EF +2008-04-25 Enforce the numpy requirement at build time - JDH + 2008-04-24 Make numpy 1.1 and python 2.3 required when importing matplotlib - EF Modified: trunk/matplotlib/lib/matplotlib/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/__init__.py 2008-04-25 15:43:06 UTC (rev 5074) +++ trunk/matplotlib/lib/matplotlib/__init__.py 2008-04-25 16:45:30 UTC (rev 5075) @@ -95,10 +95,8 @@ from rcsetup import validate_cairo_format major, minor1, minor2, s, tmp = sys.version_info -_python23 = major>=2 and minor1>=3 +_python24 = major>=2 and minor1>=4 -_havemath = _python23 - try: import datetime import dateutil @@ -111,14 +109,14 @@ #except ImportError: _have_pkg_resources = False #else: _have_pkg_resources = True -if not _python23: - raise SystemExit('matplotlib requires Python 2.3 or later') +if not _python24: + raise SystemExit('matplotlib requires Python 2.4 or later') import numpy nn = numpy.__version__.split('.') if not (int(nn[0]) >= 1 and int(nn[1]) >= 1): raise SystemExit( - 'numpy >= 1.1 is required; you have %s' % numpy.__version__) + 'numpy 1.1 or later is required; you have %s' % numpy.__version__) def is_string_like(obj): if hasattr(obj, 'shape'): return 0 Modified: trunk/matplotlib/setup.py =================================================================== --- trunk/matplotlib/setup.py 2008-04-25 15:43:06 UTC (rev 5074) +++ trunk/matplotlib/setup.py 2008-04-25 16:45:30 UTC (rev 5075) @@ -20,28 +20,15 @@ import sys major, minor1, minor2, s, tmp = sys.version_info -if major==2 and minor1<=3: - # setuptools monkeypatches distutils.core.Distribution to support - # package_data - try: import setuptools - except ImportError: - raise SystemExit("""\ -matplotlib requires setuptools for installation with python-2.3. Visit: -http://cheeseshop.python.org/pypi/setuptools -for installation instructions for the proper version of setuptools for your -system. If this is your first time upgrading matplotlib with the new -setuptools requirement, you must delete the old matplotlib install -directory.""") +if major==2 and minor1<4 or major<2: + raise SystemExit("""matplotlib requires Python 2.4 or later.""") -if major==2 and minor1<3 or major<2: - raise SystemExit("""matplotlib requires Python 2.3 or later.""") - import glob from distutils.core import setup from setupext import build_agg, build_gtkagg, build_tkagg, build_wxagg,\ build_ft2font, build_image, build_windowing, build_path, \ build_contour, build_nxutils, build_traits, build_gdk, \ - build_subprocess, build_ttconv, print_line, print_status, print_message, \ + build_ttconv, print_line, print_status, print_message, \ print_raw, check_for_freetype, check_for_libpng, check_for_gtk, \ check_for_tk, check_for_wx, check_for_numpy, check_for_qt, check_for_qt4, \ check_for_cairo, check_provide_traits, check_provide_pytz, \ @@ -100,25 +87,8 @@ ]} if not check_for_numpy(): - sys.exit() + sys.exit(1) -try: import subprocess -except ImportError: havesubprocess = False -else: havesubprocess = True - -if havesubprocess and sys.version < '2.4': - # Python didn't come with subprocess, so let's make sure it's - # not in some Python egg (e.g. an older version of matplotlib) - # that may get removed. - subprocess_dir = os.path.dirname(subprocess.__file__) - if subprocess_dir.endswith('.egg/subprocess'): - havesubprocess = False - -if not havesubprocess: - packages.append('subprocess') - if sys.platform == 'win32': - build_subprocess(ext_modules, packages) - if not check_for_freetype(): sys.exit(1) Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2008-04-25 15:43:06 UTC (rev 5074) +++ trunk/matplotlib/setupext.py 2008-04-25 16:45:30 UTC (rev 5075) @@ -532,21 +532,17 @@ return False def check_for_numpy(): - gotit = False try: import numpy except ImportError: print_status("numpy", "no") - print_message("You must install numpy to build matplotlib.") - return False - - major, minor1, minor2 = map(int, numpy.__version__.split('.')[:3]) - if major<1 or (major==1 and minor1<1): - print_status("numpy version", "no") print_message("You must install numpy 1.1 or later to build matplotlib.") - return False - + nn = numpy.__version__.split('.') + if not (int(nn[0]) >= 1 and int(nn[1]) >= 1): + print_message( + 'numpy 1.1 or later is required; you have %s' % numpy.__version__) + return False module = Extension('test', []) add_numpy_flags(module) add_base_flags(module) @@ -554,16 +550,13 @@ print_status("numpy", numpy.__version__) if not find_include_file(module.include_dirs, os.path.join("numpy", "arrayobject.h")): print_message("Could not find the headers for numpy. You may need to install the development package.") + return False return True def add_numpy_flags(module): "Add the modules flags to build extensions which use numpy" import numpy - # TODO: Remove this try statement when it is no longer needed - try: - module.include_dirs.append(numpy.get_include()) - except AttributeError: - module.include_dirs.append(numpy.get_numpy_include()) + module.include_dirs.append(numpy.get_include()) def add_agg_flags(module): 'Add the module flags to build extensions which use agg' @@ -1267,10 +1260,3 @@ BUILT_GDK = True -def build_subprocess(ext_modules, packages): - module = Extension( - 'subprocess._subprocess', - ['src/_subprocess.c', ], - ) - add_base_flags(module) - ext_modules.append(module) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2008-04-25 15:43:58
|
Revision: 5074 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5074&view=rev Author: jdh2358 Date: 2008-04-25 08:43:06 -0700 (Fri, 25 Apr 2008) Log Message: ----------- added numpy version check at build time Modified Paths: -------------- trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2008-04-24 18:31:10 UTC (rev 5073) +++ trunk/matplotlib/setupext.py 2008-04-25 15:43:06 UTC (rev 5074) @@ -539,6 +539,14 @@ print_status("numpy", "no") print_message("You must install numpy to build matplotlib.") return False + + major, minor1, minor2 = map(int, numpy.__version__.split('.')[:3]) + if major<1 or (major==1 and minor1<1): + print_status("numpy version", "no") + print_message("You must install numpy 1.1 or later to build matplotlib.") + + return False + module = Extension('test', []) add_numpy_flags(module) add_base_flags(module) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2008-04-24 18:31:15
|
Revision: 5073 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5073&view=rev Author: efiring Date: 2008-04-24 11:31:10 -0700 (Thu, 24 Apr 2008) Log Message: ----------- Enforce numpy >= 1.1 and python >= 2.3 when importing matplotlib. Numpy svn passes the test now. Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/__init__.py trunk/matplotlib/lib/matplotlib/transforms.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-04-24 17:57:57 UTC (rev 5072) +++ trunk/matplotlib/CHANGELOG 2008-04-24 18:31:10 UTC (rev 5073) @@ -1,3 +1,7 @@ + +2008-04-24 Make numpy 1.1 and python 2.3 required when importing + matplotlib - EF + 2008-04-24 Fix compilation issues on VS2003 (Thanks Martin Spacek for all the help) - MGD @@ -3443,4 +3447,4 @@ 2003-11-21 - make a dash-dot dict for the GC 2003-12-15 - fix install path bug -t \ No newline at end of file +t Modified: trunk/matplotlib/lib/matplotlib/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/__init__.py 2008-04-24 17:57:57 UTC (rev 5072) +++ trunk/matplotlib/lib/matplotlib/__init__.py 2008-04-24 18:31:10 UTC (rev 5073) @@ -112,10 +112,13 @@ #else: _have_pkg_resources = True if not _python23: - def enumerate(seq): - for i in range(len(seq)): - yield i, seq[i] + raise SystemExit('matplotlib requires Python 2.3 or later') +import numpy +nn = numpy.__version__.split('.') +if not (int(nn[0]) >= 1 and int(nn[1]) >= 1): + raise SystemExit( + 'numpy >= 1.1 is required; you have %s' % numpy.__version__) def is_string_like(obj): if hasattr(obj, 'shape'): return 0 Modified: trunk/matplotlib/lib/matplotlib/transforms.py =================================================================== --- trunk/matplotlib/lib/matplotlib/transforms.py 2008-04-24 17:57:57 UTC (rev 5072) +++ trunk/matplotlib/lib/matplotlib/transforms.py 2008-04-24 18:31:10 UTC (rev 5073) @@ -693,10 +693,7 @@ if len(xy) == 0: return - try: - xym = ma.masked_invalid(xy) # maybe add copy=False - except AttributeError: # masked_invalid not exposed in npy 1.04 - xym = ma.masked_where(~npy.isfinite(xy), xy) + xym = ma.masked_invalid(xy) # maybe add copy=False if (xym.count(axis=1)!=2).all(): return This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-04-24 17:58:04
|
Revision: 5072 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5072&view=rev Author: mdboom Date: 2008-04-24 10:57:57 -0700 (Thu, 24 Apr 2008) Log Message: ----------- Trying to fix build for Eric (by including png.h first) Modified Paths: -------------- trunk/matplotlib/src/_image.cpp Modified: trunk/matplotlib/src/_image.cpp =================================================================== --- trunk/matplotlib/src/_image.cpp 2008-04-24 13:23:05 UTC (rev 5071) +++ trunk/matplotlib/src/_image.cpp 2008-04-24 17:57:57 UTC (rev 5072) @@ -1,3 +1,10 @@ +#include <png.h> + +// To remove a gcc warning +#ifdef _POSIX_C_SOURCE +#undef _POSIX_C_SOURCE +#endif + #include "Python.h" //after png.h due to setjmp bug #include <string> @@ -5,7 +12,6 @@ #include <fstream> #include <cmath> #include <cstdio> -#include <png.h> #define PY_ARRAY_TYPES_PREFIX NumPy #include "numpy/arrayobject.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-04-24 13:23:48
|
Revision: 5071 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5071&view=rev Author: mdboom Date: 2008-04-24 06:23:05 -0700 (Thu, 24 Apr 2008) Log Message: ----------- Remove a bunch of compiler warnings. Modified Paths: -------------- trunk/matplotlib/CXX/WrapPython.h trunk/matplotlib/agg24/src/agg_curves.cpp trunk/matplotlib/src/_backend_agg.cpp trunk/matplotlib/src/_gtkagg.cpp trunk/matplotlib/src/_image.cpp trunk/matplotlib/src/_path.cpp trunk/matplotlib/src/_ttconv.cpp trunk/matplotlib/src/ft2font.cpp trunk/matplotlib/src/ft2font.h trunk/matplotlib/ttconv/pprdrv_tt.cpp Modified: trunk/matplotlib/CXX/WrapPython.h =================================================================== --- trunk/matplotlib/CXX/WrapPython.h 2008-04-24 12:54:25 UTC (rev 5070) +++ trunk/matplotlib/CXX/WrapPython.h 2008-04-24 13:23:05 UTC (rev 5071) @@ -38,12 +38,13 @@ #ifndef __PyCXX_wrap_python_hxx__ #define __PyCXX_wrap_python_hxx__ +// pull in python definitions +#include <Python.h> + // On some platforms we have to include time.h to get select defined #if !defined(__WIN32__) && !defined(WIN32) && !defined(_WIN32) && !defined(_WIN64) #include <sys/time.h> #endif -// pull in python definitions -#include <Python.h> #endif Modified: trunk/matplotlib/agg24/src/agg_curves.cpp =================================================================== --- trunk/matplotlib/agg24/src/agg_curves.cpp 2008-04-24 12:54:25 UTC (rev 5070) +++ trunk/matplotlib/agg24/src/agg_curves.cpp 2008-04-24 13:23:05 UTC (rev 5071) @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -29,20 +29,20 @@ //------------------------------------------------------------------------ - void curve3_inc::approximation_scale(double s) - { + void curve3_inc::approximation_scale(double s) + { m_scale = s; } //------------------------------------------------------------------------ - double curve3_inc::approximation_scale() const - { + double curve3_inc::approximation_scale() const + { return m_scale; } //------------------------------------------------------------------------ - void curve3_inc::init(double x1, double y1, - double x2, double y2, + void curve3_inc::init(double x1, double y1, + double x2, double y2, double x3, double y3) { m_start_x = x1; @@ -55,13 +55,13 @@ double dx2 = x3 - x2; double dy2 = y3 - y2; - double len = sqrt(dx1 * dx1 + dy1 * dy1) + sqrt(dx2 * dx2 + dy2 * dy2); + double len = sqrt(dx1 * dx1 + dy1 * dy1) + sqrt(dx2 * dx2 + dy2 * dy2); m_num_steps = uround(len * 0.25 * m_scale); if(m_num_steps < 4) { - m_num_steps = 4; + m_num_steps = 4; } double subdivide_step = 1.0 / m_num_steps; @@ -72,7 +72,7 @@ m_saved_fx = m_fx = x1; m_saved_fy = m_fy = y1; - + m_saved_dfx = m_dfx = tmpx + (x2 - x1) * (2.0 * subdivide_step); m_saved_dfy = m_dfy = tmpy + (y2 - y1) * (2.0 * subdivide_step); @@ -115,10 +115,10 @@ --m_step; return path_cmd_line_to; } - m_fx += m_dfx; + m_fx += m_dfx; m_fy += m_dfy; - m_dfx += m_ddfx; - m_dfy += m_ddfy; + m_dfx += m_ddfx; + m_dfy += m_ddfy; *x = m_fx; *y = m_fy; --m_step; @@ -126,8 +126,8 @@ } //------------------------------------------------------------------------ - void curve3_div::init(double x1, double y1, - double x2, double y2, + void curve3_div::init(double x1, double y1, + double x2, double y2, double x3, double y3) { m_points.remove_all(); @@ -138,19 +138,19 @@ } //------------------------------------------------------------------------ - void curve3_div::recursive_bezier(double x1, double y1, - double x2, double y2, + void curve3_div::recursive_bezier(double x1, double y1, + double x2, double y2, double x3, double y3, unsigned level) { - if(level > curve_recursion_limit) + if(level > curve_recursion_limit) { return; } // Calculate all the mid-points of the line segments //---------------------- - double x12 = (x1 + x2) / 2; + double x12 = (x1 + x2) / 2; double y12 = (y1 + y2) / 2; double x23 = (x2 + x3) / 2; double y23 = (y2 + y3) / 2; @@ -163,7 +163,7 @@ double da; if(d > curve_collinearity_epsilon) - { + { // Regular case //----------------- if(d * d <= m_distance_tolerance_square * (dx*dx + dy*dy)) @@ -187,7 +187,7 @@ // Finally we can stop the recursion //---------------------- m_points.add(point_d(x123, y123)); - return; + return; } } } @@ -222,13 +222,13 @@ // Continue subdivision //---------------------- - recursive_bezier(x1, y1, x12, y12, x123, y123, level + 1); - recursive_bezier(x123, y123, x23, y23, x3, y3, level + 1); + recursive_bezier(x1, y1, x12, y12, x123, y123, level + 1); + recursive_bezier(x123, y123, x23, y23, x3, y3, level + 1); } //------------------------------------------------------------------------ - void curve3_div::bezier(double x1, double y1, - double x2, double y2, + void curve3_div::bezier(double x1, double y1, + double x2, double y2, double x3, double y3) { m_points.add(point_d(x1, y1)); @@ -241,23 +241,25 @@ //------------------------------------------------------------------------ - void curve4_inc::approximation_scale(double s) - { + void curve4_inc::approximation_scale(double s) + { m_scale = s; } //------------------------------------------------------------------------ - double curve4_inc::approximation_scale() const - { + double curve4_inc::approximation_scale() const + { return m_scale; } //------------------------------------------------------------------------ +#if defined(_MSC_VER) && _MSC_VER <= 1200 static double MSC60_fix_ICE(double v) { return v; } +#endif //------------------------------------------------------------------------ - void curve4_inc::init(double x1, double y1, - double x2, double y2, + void curve4_inc::init(double x1, double y1, + double x2, double y2, double x3, double y3, double x4, double y4) { @@ -273,8 +275,8 @@ double dx3 = x4 - x3; double dy3 = y4 - y3; - double len = (sqrt(dx1 * dx1 + dy1 * dy1) + - sqrt(dx2 * dx2 + dy2 * dy2) + + double len = (sqrt(dx1 * dx1 + dy1 * dy1) + + sqrt(dx2 * dx2 + dy2 * dy2) + sqrt(dx3 * dx3 + dy3 * dy3)) * 0.25 * m_scale; #if defined(_MSC_VER) && _MSC_VER <= 1200 @@ -285,7 +287,7 @@ if(m_num_steps < 4) { - m_num_steps = 4; + m_num_steps = 4; } double subdivide_step = 1.0 / m_num_steps; @@ -296,7 +298,7 @@ double pre2 = 3.0 * subdivide_step2; double pre4 = 6.0 * subdivide_step2; double pre5 = 6.0 * subdivide_step3; - + double tmp1x = x1 - x2 * 2.0 + x3; double tmp1y = y1 - y2 * 2.0 + y3; @@ -357,10 +359,10 @@ m_fx += m_dfx; m_fy += m_dfy; - m_dfx += m_ddfx; - m_dfy += m_ddfy; - m_ddfx += m_dddfx; - m_ddfy += m_dddfy; + m_dfx += m_ddfx; + m_dfy += m_ddfy; + m_ddfx += m_dddfx; + m_ddfy += m_dddfy; *x = m_fx; *y = m_fy; @@ -372,8 +374,8 @@ //------------------------------------------------------------------------ - void curve4_div::init(double x1, double y1, - double x2, double y2, + void curve4_div::init(double x1, double y1, + double x2, double y2, double x3, double y3, double x4, double y4) { @@ -385,13 +387,13 @@ } //------------------------------------------------------------------------ - void curve4_div::recursive_bezier(double x1, double y1, - double x2, double y2, - double x3, double y3, + void curve4_div::recursive_bezier(double x1, double y1, + double x2, double y2, + double x3, double y3, double x4, double y4, unsigned level) { - if(level > curve_recursion_limit) + if(level > curve_recursion_limit) { return; } @@ -542,7 +544,7 @@ } break; - case 3: + case 3: // Regular case //----------------- if((d2 + d3)*(d2 + d3) <= m_distance_tolerance_square * (dx*dx + dy*dy)) @@ -592,14 +594,14 @@ // Continue subdivision //---------------------- - recursive_bezier(x1, y1, x12, y12, x123, y123, x1234, y1234, level + 1); - recursive_bezier(x1234, y1234, x234, y234, x34, y34, x4, y4, level + 1); + recursive_bezier(x1, y1, x12, y12, x123, y123, x1234, y1234, level + 1); + recursive_bezier(x1234, y1234, x234, y234, x34, y34, x4, y4, level + 1); } //------------------------------------------------------------------------ - void curve4_div::bezier(double x1, double y1, - double x2, double y2, - double x3, double y3, + void curve4_div::bezier(double x1, double y1, + double x2, double y2, + double x3, double y3, double x4, double y4) { m_points.add(point_d(x1, y1)); Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2008-04-24 12:54:25 UTC (rev 5070) +++ trunk/matplotlib/src/_backend_agg.cpp 2008-04-24 13:23:05 UTC (rev 5071) @@ -1,12 +1,22 @@ /* A rewrite of _backend_agg using PyCXX to handle ref counting, etc.. */ +#include <png.h> +// To remove a gcc warning +#ifdef _POSIX_C_SOURCE +#undef _POSIX_C_SOURCE +#endif + +#include "ft2font.h" +#include "_image.h" +#include "_backend_agg.h" +#include "mplutils.h" + #include <iostream> #include <fstream> #include <cmath> #include <cstdio> #include <stdexcept> -#include <png.h> #include <time.h> #include <algorithm> @@ -23,11 +33,6 @@ #include "agg_conv_shorten_path.h" #include "util/agg_color_conv_rgb8.h" -#include "ft2font.h" -#include "_image.h" -#include "_backend_agg.h" -#include "mplutils.h" - #include "swig_runtime.h" #include "MPL_isnan.h" @@ -295,8 +300,8 @@ SnapData SafeSnap::snap (const float& x, const float& y) { - xsnap = (int)x + 0.5; - ysnap = (int)y + 0.5; + xsnap = (int)(x + 0.5f); + ysnap = (int)(y + 0.5f); if ( first || ( (xsnap!=lastxsnap) || (ysnap!=lastysnap) ) ) { lastxsnap = xsnap; @@ -737,8 +742,8 @@ args.verify_length(4, 6); - float x = Py::Float(args[0]); - float y = Py::Float(args[1]); + double x = Py::Float(args[0]); + double y = Py::Float(args[1]); Image *image = static_cast<Image*>(args[2].ptr()); Py::Object box_obj = args[3]; Py::Object clippath; Modified: trunk/matplotlib/src/_gtkagg.cpp =================================================================== --- trunk/matplotlib/src/_gtkagg.cpp 2008-04-24 12:54:25 UTC (rev 5070) +++ trunk/matplotlib/src/_gtkagg.cpp 2008-04-24 13:23:05 UTC (rev 5071) @@ -1,3 +1,6 @@ +#include <pygobject.h> +#include <pygtk/pygtk.h> + #include <cstring> #include <cerrno> #include <cstdio> @@ -6,10 +9,6 @@ #include <utility> #include <fstream> - -#include <pygobject.h> -#include <pygtk/pygtk.h> - #include "agg_basics.h" #include "_backend_agg.h" #define PY_ARRAY_TYPES_PREFIX NumPy Modified: trunk/matplotlib/src/_image.cpp =================================================================== --- trunk/matplotlib/src/_image.cpp 2008-04-24 12:54:25 UTC (rev 5070) +++ trunk/matplotlib/src/_image.cpp 2008-04-24 13:23:05 UTC (rev 5071) @@ -1,3 +1,6 @@ +#include "Python.h" //after png.h due to setjmp bug +#include <string> + #include <iostream> #include <fstream> #include <cmath> @@ -4,9 +7,6 @@ #include <cstdio> #include <png.h> -#include "Python.h" //after png.h due to setjmp bug -#include <string> - #define PY_ARRAY_TYPES_PREFIX NumPy #include "numpy/arrayobject.h" @@ -936,10 +936,10 @@ png_byte* ptr = (rgba) ? &(row[x*4]) : &(row[x*3]); size_t offset = y*A->strides[0] + x*A->strides[1]; //if ((y<10)&&(x==10)) std::cout << "r = " << ptr[0] << " " << ptr[0]/255.0 << std::endl; - *(float*)(A->data + offset + 0*A->strides[2]) = ptr[0]/255.0; - *(float*)(A->data + offset + 1*A->strides[2]) = ptr[1]/255.0; - *(float*)(A->data + offset + 2*A->strides[2]) = ptr[2]/255.0; - *(float*)(A->data + offset + 3*A->strides[2]) = rgba ? ptr[3]/255.0 : 1.0; + *(float*)(A->data + offset + 0*A->strides[2]) = (float)(ptr[0]/255.0f); + *(float*)(A->data + offset + 1*A->strides[2]) = (float)(ptr[1]/255.0f); + *(float*)(A->data + offset + 2*A->strides[2]) = (float)(ptr[2]/255.0f); + *(float*)(A->data + offset + 3*A->strides[2]) = rgba ? (float)(ptr[3]/255.0f) : 1.0f; } } @@ -1434,7 +1434,7 @@ while(xs2 != xl && xo > xm) { xs1 = xs2; xs2 = xs1+1; - xm = 0.5*(*xs1 + *xs2); + xm = 0.5f*(*xs1 + *xs2); j++; } *colstart = j - j_last; @@ -1447,7 +1447,7 @@ while(ys2 != yl && yo > ym) { ys1 = ys2; ys2 = ys1+1; - ym = 0.5*(*ys1 + *ys2); + ym = 0.5f*(*ys1 + *ys2); j++; } *rowstart = j - j_last; Modified: trunk/matplotlib/src/_path.cpp =================================================================== --- trunk/matplotlib/src/_path.cpp 2008-04-24 12:54:25 UTC (rev 5070) +++ trunk/matplotlib/src/_path.cpp 2008-04-24 13:23:05 UTC (rev 5071) @@ -1,9 +1,9 @@ +#include "agg_py_path_iterator.h" +#include "agg_py_transforms.h" + #include <limits> #include <math.h> -#include "agg_py_path_iterator.h" -#include "agg_py_transforms.h" - #include "CXX/Extensions.hxx" #include "agg_conv_curve.h" Modified: trunk/matplotlib/src/_ttconv.cpp =================================================================== --- trunk/matplotlib/src/_ttconv.cpp 2008-04-24 12:54:25 UTC (rev 5070) +++ trunk/matplotlib/src/_ttconv.cpp 2008-04-24 13:23:05 UTC (rev 5071) @@ -83,11 +83,11 @@ int fonttype; std::vector<int> glyph_ids; - static const char *kwlist[] = { + static const char *kwlist[] = { "filename", "output", "fonttype", "glyph_ids", NULL }; if (! PyArg_ParseTupleAndKeywords - (args, kwds, - "sO&i|O&:convert_ttf_to_ps", + (args, kwds, + "sO&i|O&:convert_ttf_to_ps", (char**)kwlist, &filename, fileobject_to_PythonFileWriter, @@ -96,9 +96,9 @@ pyiterable_to_vector_int, &glyph_ids)) return NULL; - + if (fonttype != 3 && fonttype != 42) { - PyErr_SetString(PyExc_ValueError, + PyErr_SetString(PyExc_ValueError, "fonttype must be either 3 (raw Postscript) or 42 " "(embedded Truetype)"); return NULL; @@ -109,7 +109,7 @@ } catch (TTException& e) { PyErr_SetString(PyExc_RuntimeError, e.getMessage()); return NULL; - } catch (PythonExceptionOccurred& e) { + } catch (PythonExceptionOccurred& ) { return NULL; } catch (...) { PyErr_SetString(PyExc_RuntimeError, "Unknown C++ exception"); @@ -144,8 +144,8 @@ static const char *kwlist[] = { "filename", "glyph_ids", NULL }; if (! PyArg_ParseTupleAndKeywords - (args, kwds, - "s|O&:convert_ttf_to_ps", + (args, kwds, + "s|O&:convert_ttf_to_ps", (char **)kwlist, &filename, pyiterable_to_vector_int, @@ -163,7 +163,7 @@ } catch (TTException& e) { PyErr_SetString(PyExc_RuntimeError, e.getMessage()); return NULL; - } catch (PythonExceptionOccurred& e) { + } catch (PythonExceptionOccurred& ) { return NULL; } catch (...) { PyErr_SetString(PyExc_RuntimeError, "Unknown C++ exception"); @@ -174,7 +174,7 @@ } static PyMethodDef ttconv_methods[] = { - {"convert_ttf_to_ps", (PyCFunction)convert_ttf_to_ps, METH_KEYWORDS, + {"convert_ttf_to_ps", (PyCFunction)convert_ttf_to_ps, METH_KEYWORDS, "convert_ttf_to_ps(filename, output, fonttype, glyph_ids)\n" "\n" "Converts the Truetype font into a Type 3 or Type 42 Postscript font, " @@ -191,7 +191,7 @@ "then all glyphs will be included. If any of the glyphs specified are " "composite glyphs, then the component glyphs will also be included." }, - {"get_pdf_charprocs", (PyCFunction)py_get_pdf_charprocs, METH_KEYWORDS, + {"get_pdf_charprocs", (PyCFunction)py_get_pdf_charprocs, METH_KEYWORDS, "get_pdf_charprocs(filename, glyph_ids)\n" "\n" "Given a Truetype font file, returns a dictionary containing the PDF Type 3\n" @@ -211,7 +211,7 @@ #define PyMODINIT_FUNC void #endif PyMODINIT_FUNC -initttconv(void) +initttconv(void) { PyObject* m; Modified: trunk/matplotlib/src/ft2font.cpp =================================================================== --- trunk/matplotlib/src/ft2font.cpp 2008-04-24 12:54:25 UTC (rev 5070) +++ trunk/matplotlib/src/ft2font.cpp 2008-04-24 13:23:05 UTC (rev 5071) @@ -1,6 +1,6 @@ -#include <sstream> #include "ft2font.h" #include "mplutils.h" +#include <sstream> #define FIXED_MAJOR(val) (*((short *) &val+1)) #define FIXED_MINOR(val) (*((short *) &val+0)) Modified: trunk/matplotlib/src/ft2font.h =================================================================== --- trunk/matplotlib/src/ft2font.h 2008-04-24 12:54:25 UTC (rev 5070) +++ trunk/matplotlib/src/ft2font.h 2008-04-24 13:23:05 UTC (rev 5071) @@ -1,6 +1,8 @@ /* A python interface to freetype2 */ #ifndef _FT2FONT_H #define _FT2FONT_H +#include "CXX/Extensions.hxx" +#include "CXX/Objects.hxx" #include <iostream> #include <vector> #include <string> @@ -15,8 +17,6 @@ #include FT_TYPE1_TABLES_H #include FT_TRUETYPE_TABLES_H } -#include "CXX/Extensions.hxx" -#include "CXX/Objects.hxx" // the freetype string rendered into a width, height buffer Modified: trunk/matplotlib/ttconv/pprdrv_tt.cpp =================================================================== --- trunk/matplotlib/ttconv/pprdrv_tt.cpp 2008-04-24 12:54:25 UTC (rev 5070) +++ trunk/matplotlib/ttconv/pprdrv_tt.cpp 2008-04-24 13:23:05 UTC (rev 5071) @@ -16,7 +16,7 @@ ** documentation. This software is provided "as is" without express or ** implied warranty. ** -** TrueType font support. These functions allow PPR to generate +** TrueType font support. These functions allow PPR to generate ** PostScript fonts from Microsoft compatible TrueType font files. ** ** Last revised 19 December 1995. @@ -31,7 +31,7 @@ #include <sstream> /*========================================================================== -** Convert the indicated Truetype font file to a type 42 or type 3 +** Convert the indicated Truetype font file to a type 42 or type 3 ** PostScript font and insert it in the output stream. ** ** All the routines from here to the end of file file are involved @@ -42,7 +42,7 @@ ** Endian conversion routines. ** These routines take a BYTE pointer ** and return a value formed by reading -** bytes starting at that point. +** bytes starting at that point. ** ** These routines read the big-endian ** values which are used in TrueType @@ -55,14 +55,14 @@ ULONG getULONG(BYTE *p) { int x; - ULONG val=0; + ULONG val=0; for(x=0; x<4; x++) { val *= 0x100; - val += p[x]; + val += p[x]; } - + return val; } /* end of ftohULONG() */ @@ -72,14 +72,14 @@ USHORT getUSHORT(BYTE *p) { int x; - USHORT val=0; + USHORT val=0; for(x=0; x<2; x++) { val *= 0x100; - val += p[x]; + val += p[x]; } - + return val; } /* end of getUSHORT() */ @@ -92,7 +92,7 @@ Fixed val={0,0}; val.whole = ((s[0] * 256) + s[1]); - val.fraction = ((s[2] * 256) + s[3]); + val.fraction = ((s[2] * 256) + s[3]); return val; } /* end of getFixed() */ @@ -102,16 +102,16 @@ ** The font's "file" and "offset_table" fields must be set before this ** routine is called. ** -** This first argument is a TrueType font structure, the second +** This first argument is a TrueType font structure, the second ** argument is the name of the table to retrieve. A table name -** is always 4 characters, though the last characters may be +** is always 4 characters, though the last characters may be ** padding spaces. -----------------------------------------------------------------------*/ BYTE *GetTable(struct TTFONT *font, const char *name) { BYTE *ptr; ULONG x; - + #ifdef DEBUG_TRUETYPE debug("GetTable(file,font,\"%s\")",name); #endif @@ -127,20 +127,20 @@ BYTE *table; offset = getULONG( ptr + 8 ); - length = getULONG( ptr + 12 ); + length = getULONG( ptr + 12 ); table = (BYTE*)calloc( sizeof(BYTE), length ); try { #ifdef DEBUG_TRUETYPE debug("Loading table \"%s\" from offset %d, %d bytes",name,offset,length); #endif - + if( fseek( font->file, (long)offset, SEEK_SET ) ) throw TTException("TrueType font may be corrupt (reason 3)"); - + if( fread(table,sizeof(BYTE),length,font->file) != (sizeof(BYTE) * length)) throw TTException("TrueType font may be corrupt (reason 4)"); - } catch (TTException& e) { + } catch (TTException& ) { free(table); throw; } @@ -156,7 +156,7 @@ } /* end of GetTable() */ /*-------------------------------------------------------------------- -** Load the 'name' table, get information from it, +** Load the 'name' table, get information from it, ** and store that information in the font structure. ** ** The 'name' table contains information such as the name of @@ -171,7 +171,7 @@ int platform,encoding; /* Current platform id, encoding id, */ int language,nameid; /* language id, name id, */ int offset,length; /* offset and length of string. */ - + #ifdef DEBUG_TRUETYPE debug("Read_name()"); #endif @@ -188,7 +188,7 @@ try { numrecords = getUSHORT( table_ptr + 2 ); /* number of names */ strings = table_ptr + getUSHORT( table_ptr + 4 ); /* start of string storage */ - + ptr2 = table_ptr + 6; for(x=0; x < numrecords; x++,ptr2+=12) { @@ -202,7 +202,7 @@ #ifdef DEBUG_TRUETYPE debug("platform %d, encoding %d, language 0x%x, name %d, offset %d, length %d", platform,encoding,language,nameid,offset,length); -#endif +#endif /* Copyright notice */ if( platform == 1 && nameid == 0 ) @@ -211,14 +211,14 @@ strncpy(font->Copyright,(const char*)strings+offset,length); font->Copyright[length]=(char)NULL; replace_newlines_with_spaces(font->Copyright); - + #ifdef DEBUG_TRUETYPE debug("font->Copyright=\"%s\"",font->Copyright); #endif continue; } - + /* Font Family name */ if( platform == 1 && nameid == 1 ) { @@ -226,7 +226,7 @@ strncpy(font->FamilyName,(const char*)strings+offset,length); font->FamilyName[length]=(char)NULL; replace_newlines_with_spaces(font->FamilyName); - + #ifdef DEBUG_TRUETYPE debug("font->FamilyName=\"%s\"",font->FamilyName); #endif @@ -241,14 +241,14 @@ strncpy(font->Style,(const char*)strings+offset,length); font->Style[length]=(char)NULL; replace_newlines_with_spaces(font->Style); - + #ifdef DEBUG_TRUETYPE debug("font->Style=\"%s\"",font->Style); #endif continue; } - - + + /* Full Font name */ if( platform == 1 && nameid == 4 ) { @@ -256,14 +256,14 @@ strncpy(font->FullName,(const char*)strings+offset,length); font->FullName[length]=(char)NULL; replace_newlines_with_spaces(font->FullName); - + #ifdef DEBUG_TRUETYPE debug("font->FullName=\"%s\"",font->FullName); #endif continue; } - - + + /* Version string */ if( platform == 1 && nameid == 5 ) { @@ -277,8 +277,8 @@ #endif continue; } - - + + /* PostScript name */ if( platform == 1 && nameid == 6 ) { @@ -292,8 +292,8 @@ #endif continue; } - - + + /* Trademark string */ if( platform == 1 && nameid == 7 ) { @@ -301,15 +301,15 @@ strncpy(font->Trademark,(const char*)strings+offset,length); font->Trademark[length]=(char)NULL; replace_newlines_with_spaces(font->Trademark); - + #ifdef DEBUG_TRUETYPE debug("font->Trademark=\"%s\"",font->Trademark); #endif continue; } - + } - } catch (TTException& e) { + } catch (TTException& ) { free(table_ptr); throw; } @@ -443,20 +443,20 @@ /* Some information from the "post" table. */ ItalicAngle = getFixed( font->post_table + 4 ); stream.printf("/ItalicAngle %d.%d def\n",ItalicAngle.whole,ItalicAngle.fraction); - stream.printf("/isFixedPitch %s def\n", getULONG( font->post_table + 12 ) ? "true" : "false" ); + stream.printf("/isFixedPitch %s def\n", getULONG( font->post_table + 12 ) ? "true" : "false" ); stream.printf("/UnderlinePosition %d def\n", (int)getFWord( font->post_table + 8 ) ); - stream.printf("/UnderlineThickness %d def\n", (int)getFWord( font->post_table + 10 ) ); - stream.putline("end readonly def"); - } /* end of ttfont_FontInfo() */ + stream.printf("/UnderlineThickness %d def\n", (int)getFWord( font->post_table + 10 ) ); + stream.putline("end readonly def"); + } /* end of ttfont_FontInfo() */ /*------------------------------------------------------------------- ** sfnts routines -** These routines generate the PostScript "sfnts" array which +** These routines generate the PostScript "sfnts" array which ** contains one or more strings which contain a reduced version ** of the TrueType font. ** ** A number of functions are required to accomplish this rather -** complicated task. +** complicated task. -------------------------------------------------------------------*/ int string_len; int line_len; @@ -498,9 +498,9 @@ stream.putchar('\n'); line_len=0; } - + } /* end of sfnts_pputBYTE() */ - + /* ** Write a USHORT as a hexadecimal value as part of the sfnts array. */ @@ -516,7 +516,7 @@ void sfnts_pputULONG(TTStreamWriter& stream, ULONG n) { int x1,x2,x3; - + x1 = n % 256; n /= 256; x2 = n % 256; @@ -531,7 +531,7 @@ } /* end of sfnts_pputULONG() */ /* -** This is called whenever it is +** This is called whenever it is ** necessary to end a string in the sfnts array. ** ** (The array must be broken into strings which are @@ -542,7 +542,7 @@ if(in_string) { string_len=0; /* fool sfnts_pputBYTE() */ - + #ifdef DEBUG_TRUETYPE_INLINE puts("\n% dummy byte:\n"); #endif @@ -562,7 +562,7 @@ */ void sfnts_new_table(TTStreamWriter& stream, ULONG length) { - if( (string_len + length) > 65528 ) + if( (string_len + length) > 65528 ) sfnts_end_string(stream); } /* end of sfnts_new_table() */ @@ -615,7 +615,7 @@ /* Start new string if necessary. */ sfnts_new_table( stream, (int)length ); - /* + /* ** Make sure the glyph is padded out to a ** two byte boundary. */ @@ -627,16 +627,16 @@ { if( (c = fgetc(font->file)) == EOF ) throw TTException("TrueType font may be corrupt (reason 6)"); - + sfnts_pputBYTE(stream, c); total++; /* add to running total */ - } + } } free(font->loca_table); font->loca_table = NULL; - + /* Pad out to full length from table directory */ while( total < correct_total_length ) { @@ -649,7 +649,7 @@ /* ** Here is the routine which ties it all together. ** -** Create the array called "sfnts" which +** Create the array called "sfnts" which ** holds the actual TrueType data. */ void ttfont_sfnts(TTStreamWriter& stream, struct TTFONT *font) @@ -673,7 +673,7 @@ ULONG length; ULONG checksum; } tables[9]; - + BYTE *ptr; /* A pointer into the origional table directory. */ ULONG x,y; /* General use loop countes. */ int c; /* Input character. */ @@ -684,8 +684,8 @@ ptr = font->offset_table + 12; nextoffset=0; count=0; - - /* + + /* ** Find the tables we want and store there vital ** statistics in tables[]. */ @@ -697,7 +697,7 @@ if( diff > 0 ) /* If we are past it. */ { tables[x].length = 0; - diff = 0; + diff = 0; } else if( diff < 0 ) /* If we haven't hit it yet. */ { @@ -711,12 +711,12 @@ tables[x].length = getULONG( ptr + 12 ); nextoffset += ( ((tables[x].length + 3) / 4) * 4 ); count++; - ptr += 16; + ptr += 16; } } while(diff != 0); - + } /* end of for loop which passes over the table directory */ - + /* Begin the sfnts array. */ sfnts_start(stream); @@ -724,10 +724,10 @@ /* Start by copying the TrueType version number. */ ptr = font->offset_table; for(x=0; x < 4; x++) - { + { sfnts_pputBYTE( stream, *(ptr++) ); } - + /* Now, generate those silly numTables numbers. */ sfnts_pputUSHORT(stream, count); /* number of tables */ if( count == 9 ) @@ -735,11 +735,11 @@ sfnts_pputUSHORT(stream, 7); /* searchRange */ sfnts_pputUSHORT(stream, 3); /* entrySelector */ sfnts_pputUSHORT(stream, 81); /* rangeShift */ - } + } #ifdef DEBUG_TRUETYPE else { - debug("only %d tables selected",count); + debug("only %d tables selected",count); } #endif @@ -754,13 +754,13 @@ sfnts_pputBYTE( stream, table_names[x][1] ); sfnts_pputBYTE( stream, table_names[x][2] ); sfnts_pputBYTE( stream, table_names[x][3] ); - + /* Checksum */ sfnts_pputULONG( stream, tables[x].checksum ); /* Offset */ sfnts_pputULONG( stream, tables[x].newoffset + 12 + (count * 16) ); - + /* Length */ sfnts_pputULONG( stream, tables[x].length ); } @@ -770,7 +770,7 @@ { if( tables[x].length == 0 ) /* skip tables that aren't there */ continue; - + #ifdef DEBUG_TRUETYPE debug("emmiting table '%s'",table_names[x]); #endif @@ -783,22 +783,22 @@ else /* Other tables may not exceed */ { /* 65535 bytes in length. */ if( tables[x].length > 65535 ) - throw TTException("TrueType font has a table which is too long"); - + throw TTException("TrueType font has a table which is too long"); + /* Start new string if necessary. */ sfnts_new_table(stream, tables[x].length); /* Seek to proper position in the file. */ fseek( font->file, tables[x].oldoffset, SEEK_SET ); - + /* Copy the bytes of the table. */ for( y=0; y < tables[x].length; y++ ) { if( (c = fgetc(font->file)) == EOF ) throw TTException("TrueType font may be corrupt (reason 7)"); - + sfnts_pputBYTE(stream, c); - } + } } /* Padd it out to a four byte boundary. */ @@ -815,39 +815,39 @@ } /* End of loop for all tables */ /* Close the array. */ - sfnts_end_string(stream); + sfnts_end_string(stream); stream.putline("]def"); } /* end of ttfont_sfnts() */ - -/*-------------------------------------------------------------- -** Create the CharStrings dictionary which will translate -** PostScript character names to TrueType font character + +/*-------------------------------------------------------------- +** Create the CharStrings dictionary which will translate +** PostScript character names to TrueType font character ** indexes. ** ** If we are creating a type 3 instead of a type 42 font, ** this array will instead convert PostScript character names ** to executable proceedures. --------------------------------------------------------------*/ -const char *Apple_CharStrings[]={ -".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign", -"dollar","percent","ampersand","quotesingle","parenleft","parenright", +const char *Apple_CharStrings[]={ +".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign", +"dollar","percent","ampersand","quotesingle","parenleft","parenright", "asterisk","plus", "comma","hyphen","period","slash","zero","one","two", -"three","four","five","six","seven","eight","nine","colon","semicolon", +"three","four","five","six","seven","eight","nine","colon","semicolon", "less","equal","greater","question","at","A","B","C","D","E","F","G","H","I", "J","K", "L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z", "bracketleft","backslash","bracketright","asciicircum","underscore","grave", -"a","b","c","d","e","f","g","h","i","j","k", "l","m","n","o","p","q","r","s", +"a","b","c","d","e","f","g","h","i","j","k", "l","m","n","o","p","q","r","s", "t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde", "Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis", "aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla", -"eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex", +"eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex", "idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde", "uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent", "sterling","section","bullet","paragraph","germandbls","registered", "copyright","trademark","acute","dieresis","notequal","AE","Oslash", "infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff", "summation","product","pi","integral","ordfeminine","ordmasculine","Omega", -"ae","oslash","questiondown","exclamdown","logicalnot","radical","florin", +"ae","oslash","questiondown","exclamdown","logicalnot","radical","florin", "approxequal","Delta","guillemotleft","guillemotright","ellipsis", "nobreakspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash", "quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge", @@ -861,7 +861,7 @@ "Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior", "twosuperior","threesuperior","onehalf","onequarter","threequarters","franc", "Gbreve","gbreve","Idot","Scedilla","scedilla","Cacute","cacute","Ccaron", -"ccaron","dmacron","markingspace","capslock","shift","propeller","enter", +"ccaron","dmacron","markingspace","capslock","shift","propeller","enter", "markingtabrtol","markingtabltor","control","markingdeleteltor", "markingdeletertol","option","escape","parbreakltor","parbreakrtol", "newpage","checkmark","linebreakltor","linebreakrtol","markingnobreakspace", @@ -879,7 +879,7 @@ ULONG len; GlyphIndex = (int)getUSHORT( font->post_table + 34 + (charindex * 2) ); - + if( GlyphIndex <= 257 ) /* If a standard Apple name, */ { return Apple_CharStrings[GlyphIndex]; @@ -887,7 +887,7 @@ else /* Otherwise, use one */ { /* of the pascal strings. */ GlyphIndex -= 258; - + /* Set pointer to start of Pascal strings. */ ptr = (char*)(font->post_table + 34 + (font->numGlyphs * 2)); @@ -897,7 +897,7 @@ ptr += len; len = (ULONG)*(ptr++); } - + if( len >= sizeof(temp) ) throw TTException("TrueType font file contains a very long PostScript name"); @@ -914,16 +914,16 @@ void ttfont_CharStrings(TTStreamWriter& stream, struct TTFONT *font, std::vector<int>& glyph_ids) { Fixed post_format; - + /* The 'post' table format number. */ post_format = getFixed( font->post_table ); - + if( post_format.whole != 2 || post_format.fraction != 0 ) throw TTException("TrueType fontdoes not have a format 2.0 'post' table"); /* Emmit the start of the PostScript code to define the dictionary. */ stream.printf("/CharStrings %d dict dup begin\n", glyph_ids.size()); - + /* Emmit one key-value pair for each glyph. */ for(std::vector<int>::const_iterator i = glyph_ids.begin(); i != glyph_ids.end(); ++i) @@ -935,13 +935,13 @@ else /* type 3 */ { stream.printf("/%s{",ttfont_CharStrings_getname(font, *i)); - + tt_type3_charproc(stream, font, *i); - + stream.putline("}_d"); /* "} bind def" */ } } - + stream.putline("end readonly def"); } /* end of ttfont_CharStrings() */ @@ -971,8 +971,8 @@ stream.putline("/BuildChar {"); stream.putline(" 1 index /Encoding get exch get"); stream.putline(" 1 index /BuildGlyph get exec"); - stream.putline("}_d"); - + stream.putline("}_d"); + stream.putchar('\n'); } @@ -999,7 +999,7 @@ stream.putline("{/TrueDict where{pop}{(%%[ Error: no TrueType rasterizer ]%%)= flush}ifelse"); /* Since we are expected to use Apple's TrueDict TrueType */ - /* reasterizer, change the font type to 3. */ + /* reasterizer, change the font type to 3. */ stream.putline("/FontType 3 def"); /* Define a string to hold the state of the Apple */ @@ -1035,7 +1035,7 @@ /* Exchange the CharStrings dictionary and the charname, */ /* but if the answer was false, replace the character name */ - /* with ".notdef". */ + /* with ".notdef". */ stream.putline(" {exch}{exch pop /.notdef}ifelse"); /* stack: CharStrings charname */ @@ -1060,7 +1060,7 @@ stream.putline(" /BuildChar{"); stream.putline(" 1 index /Encoding get exch get"); stream.putline(" 1 index /BuildGlyph get exec"); - stream.putline(" }bind def"); + stream.putline(" }bind def"); /* Here we close the condition which is true */ /* if the printer has no built-in TrueType */ @@ -1071,7 +1071,7 @@ stream.putline("FontName currentdict end definefont pop"); stream.putline("%%EOF"); - } /* end of ttfont_trailer() */ + } /* end of ttfont_trailer() */ /*------------------------------------------------------------------ ** This is the externally callable routine which inserts the font. @@ -1080,7 +1080,7 @@ void read_font(const char *filename, font_type_enum target_type, std::vector<int>& glyph_ids, TTFONT& font) { BYTE *ptr; - + /* Decide what type of PostScript font we will be generating. */ font.target_type = target_type; @@ -1094,24 +1094,24 @@ /* Allocate space for the unvarying part of the offset table. */ assert(font.offset_table == NULL); font.offset_table = (BYTE*)calloc( 12, sizeof(BYTE) ); - + /* Read the first part of the offset table. */ if( fread( font.offset_table, sizeof(BYTE), 12, font.file ) != 12 ) throw TTException("TrueType font may be corrupt (reason 1)"); - + /* Determine how many directory entries there are. */ font.numTables = getUSHORT( font.offset_table + 4 ); #ifdef DEBUG_TRUETYPE debug("numTables=%d",(int)font.numTables); #endif - + /* Expand the memory block to hold the whole thing. */ font.offset_table = (BYTE*)realloc( font.offset_table, sizeof(BYTE) * (12 + font.numTables * 16) ); - + /* Read the rest of the table directory. */ if( fread( font.offset_table + 12, sizeof(BYTE), (font.numTables*16), font.file ) != (font.numTables*16) ) throw TTException("TrueType font may be corrupt (reason 2)"); - + /* Extract information from the "Offset" table. */ font.TTVersion = getFixed( font.offset_table ); @@ -1133,7 +1133,7 @@ throw TTException("TrueType font is unusable because indexToLocFormat != 0"); if( getSHORT(ptr+52) != 0 ) throw TTException("TrueType font is unusable because glyphDataFormat != 0"); - } catch (TTException& e) { + } catch (TTException& ) { free(ptr); throw; } @@ -1177,7 +1177,7 @@ } /* end of insert_ttfont() */ -void insert_ttfont(const char *filename, TTStreamWriter& stream, +void insert_ttfont(const char *filename, TTStreamWriter& stream, font_type_enum target_type, std::vector<int>& glyph_ids) { struct TTFONT font; @@ -1233,9 +1233,9 @@ } TTFONT::TTFONT() : - file(NULL), + file(NULL), PostName(NULL), - FullName(NULL), + FullName(NULL), FamilyName(NULL), Style(NULL), Copyright(NULL), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-04-24 12:54:30
|
Revision: 5070 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5070&view=rev Author: mdboom Date: 2008-04-24 05:54:25 -0700 (Thu, 24 Apr 2008) Log Message: ----------- Fix compilation issues on VS2003. (Thanks Martin Spacek) Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/src/_backend_agg.cpp trunk/matplotlib/src/agg_py_path_iterator.h trunk/matplotlib/src/mplutils.h Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-04-24 12:34:47 UTC (rev 5069) +++ trunk/matplotlib/CHANGELOG 2008-04-24 12:54:25 UTC (rev 5070) @@ -1,3 +1,6 @@ +2008-04-24 Fix compilation issues on VS2003 (Thanks Martin Spacek for + all the help) - MGD + 2008-04-24 Fix sub/superscripts when the size of the font has been changed - MGD Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2008-04-24 12:34:47 UTC (rev 5069) +++ trunk/matplotlib/src/_backend_agg.cpp 2008-04-24 12:54:25 UTC (rev 5070) @@ -270,8 +270,8 @@ double l, b, r, t; if (py_convert_bbox(cliprect.ptr(), l, b, r, t)) { - rasterizer->clip_box(int(round(l)) + 1, height - int(round(b)), - int(round(r)), height - int(round(t))); + rasterizer->clip_box(int(mpl_round(l)) + 1, height - int(mpl_round(b)), + int(mpl_round(r)), height - int(mpl_round(t))); } _VERBOSE("RendererAgg::set_clipbox done"); @@ -807,7 +807,7 @@ if (gc.linewidth != 0.0) { double linewidth = gc.linewidth; if (!gc.isaa) { - linewidth = (linewidth < 0.5) ? 0.5 : round(linewidth); + linewidth = (linewidth < 0.5) ? 0.5 : mpl_round(linewidth); } if (gc.dashes.size() == 0) { stroke_t stroke(path); @@ -1576,7 +1576,7 @@ int newwidth = 0; int newheight = 0; Py::String data; - if (xmin < xmax and ymin < ymax) { + if (xmin < xmax && ymin < ymax) { // Expand the bounds by 1 pixel on all sides xmin = std::max(0, xmin - 1); ymin = std::max(0, ymin - 1); Modified: trunk/matplotlib/src/agg_py_path_iterator.h =================================================================== --- trunk/matplotlib/src/agg_py_path_iterator.h 2008-04-24 12:34:47 UTC (rev 5069) +++ trunk/matplotlib/src/agg_py_path_iterator.h 2008-04-24 12:54:25 UTC (rev 5070) @@ -6,12 +6,9 @@ #include "numpy/arrayobject.h" #include "agg_path_storage.h" #include "MPL_isnan.h" +#include "mplutils.h" #include <queue> -static inline double my_round(double v) { - return (double)(int)(v + ((v >= 0.0) ? 0.5 : -0.5)); -} - class PathIterator { PyArrayObject* m_vertices; @@ -161,8 +158,8 @@ cmd = m_source->vertex(x, y); if (m_quantize && agg::is_vertex(cmd)) { - *x = my_round(*x) + 0.5; - *y = my_round(*y) + 0.5; + *x = mpl_round(*x) + 0.5; + *y = mpl_round(*y) + 0.5; } return cmd; } @@ -218,8 +215,8 @@ // Do any quantization if requested if (m_quantize && agg::is_vertex(cmd)) { - *x = my_round(*x) + 0.5; - *y = my_round(*y) + 0.5; + *x = mpl_round(*x) + 0.5; + *y = mpl_round(*y) + 0.5; } //if we are starting a new path segment, move to the first point Modified: trunk/matplotlib/src/mplutils.h =================================================================== --- trunk/matplotlib/src/mplutils.h 2008-04-24 12:34:47 UTC (rev 5069) +++ trunk/matplotlib/src/mplutils.h 2008-04-24 12:54:25 UTC (rev 5070) @@ -1,4 +1,4 @@ -/* mplutils.h -- +/* mplutils.h -- * * $Header$ * $Log$ @@ -26,6 +26,10 @@ #undef MAX #define MAX(a, b) (((a) > (b)) ? (a) : (b)) +inline double mpl_round(double v) { + return (double)(int)(v + ((v >= 0.0) ? 0.5 : -0.5)); +} + class Printf { private : This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-04-24 12:35:10
|
Revision: 5069 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5069&view=rev Author: mdboom Date: 2008-04-24 05:34:47 -0700 (Thu, 24 Apr 2008) Log Message: ----------- Merged revisions 5061-5068 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint ........ r5068 | mdboom | 2008-04-24 08:31:53 -0400 (Thu, 24 Apr 2008) | 2 lines Fix sub/superscript placement when the size of font has been changed. ........ Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/mathtext.py Property Changed: ---------------- trunk/matplotlib/ Property changes on: trunk/matplotlib ___________________________________________________________________ Name: svnmerge-integrated - /branches/v0_91_maint:1-5060 + /branches/v0_91_maint:1-5068 Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-04-24 12:31:53 UTC (rev 5068) +++ trunk/matplotlib/CHANGELOG 2008-04-24 12:34:47 UTC (rev 5069) @@ -1,3 +1,6 @@ +2008-04-24 Fix sub/superscripts when the size of the font has been + changed - MGD + 2008-04-22 Use "svg.embed_char_paths" consistently everywhere - MGD 2008-04-20 Add support to MaxNLocator for symmetric axis autoscaling. - EF Modified: trunk/matplotlib/lib/matplotlib/mathtext.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mathtext.py 2008-04-24 12:31:53 UTC (rev 5068) +++ trunk/matplotlib/lib/matplotlib/mathtext.py 2008-04-24 12:34:47 UTC (rev 5069) @@ -651,7 +651,7 @@ # Some fonts don't store the xHeight, so we do a poor man's xHeight metrics = self.get_metrics(font, 'it', 'x', fontsize, dpi) return metrics.iceberg - xHeight = pclt['xHeight'] / 64.0 + xHeight = (pclt['xHeight'] / 64.0) * (fontsize / 12.0) return xHeight def get_underline_thickness(self, font, fontsize, dpi): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-04-24 12:31:58
|
Revision: 5068 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5068&view=rev Author: mdboom Date: 2008-04-24 05:31:53 -0700 (Thu, 24 Apr 2008) Log Message: ----------- Fix sub/superscript placement when the size of font has been changed. Modified Paths: -------------- branches/v0_91_maint/CHANGELOG branches/v0_91_maint/lib/matplotlib/mathtext.py Modified: branches/v0_91_maint/CHANGELOG =================================================================== --- branches/v0_91_maint/CHANGELOG 2008-04-24 12:20:23 UTC (rev 5067) +++ branches/v0_91_maint/CHANGELOG 2008-04-24 12:31:53 UTC (rev 5068) @@ -1,3 +1,6 @@ +2008-04-24 Fix sub/superscripts when the size of the font has been + changed - MGD + 2008-04-22 Use "svg.embed_char_paths" consistently everywhere - MGD 2008-04-11 Fix global font rcParam setting after initialization Modified: branches/v0_91_maint/lib/matplotlib/mathtext.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/mathtext.py 2008-04-24 12:20:23 UTC (rev 5067) +++ branches/v0_91_maint/lib/matplotlib/mathtext.py 2008-04-24 12:31:53 UTC (rev 5068) @@ -651,7 +651,7 @@ # Some fonts don't store the xHeight, so we do a poor man's xHeight metrics = self.get_metrics(font, 'it', 'x', fontsize, dpi) return metrics.iceberg - xHeight = pclt['xHeight'] / 64.0 + xHeight = (pclt['xHeight'] / 64.0) * (fontsize / 12.0) return xHeight def get_underline_thickness(self, font, fontsize, dpi): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-04-24 12:20:40
|
Revision: 5067 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5067&view=rev Author: mdboom Date: 2008-04-24 05:20:23 -0700 (Thu, 24 Apr 2008) Log Message: ----------- Fix clipping bug in Wx backend. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-04-23 17:44:15 UTC (rev 5066) +++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-04-24 12:20:23 UTC (rev 5067) @@ -283,13 +283,14 @@ if new_bounds is not None: new_bounds = new_bounds.bounds gfx_ctx = gc.gfx_ctx - if gfx_ctx._lastcliprect != new_bounds: + if True or gfx_ctx._lastcliprect != new_bounds: gfx_ctx._lastcliprect = new_bounds if new_bounds is None: gfx_ctx.ResetClip() else: - gfx_ctx.Clip(*new_bounds) - + gfx_ctx.Clip(new_bounds[0], self.height - new_bounds[1] - new_bounds[3], + new_bounds[1], new_bounds[3]) + #@staticmethod def convert_path(gfx_ctx, tpath): wxpath = gfx_ctx.CreatePath() @@ -306,7 +307,7 @@ wxpath.CloseSubpath() return wxpath convert_path = staticmethod(convert_path) - + def draw_path(self, gc, path, transform, rgbFace=None): gc.select() self.handle_clip_rectangle(gc) @@ -331,7 +332,7 @@ gc.select() self.handle_clip_rectangle(gc) gfx_ctx = gc.gfx_ctx - + font = self.get_wx_font(s, prop) color = gc.get_wxcolour(gc.get_rgb()) gfx_ctx.SetFont(font, color) @@ -347,7 +348,7 @@ xo = h * math.sin(rads) yo = h * math.cos(rads) gfx_ctx.DrawRotatedText(s, x - xo, y - yo, rads) - + gc.unselect() def new_gc(self): @@ -423,7 +424,7 @@ wxGraphicsContext that draws to it. Creating a wxGraphicsContext seems to be fairly heavy, so these objects are cached based on the bitmap object that is passed in. - + The base GraphicsContext stores colors as a RGB tuple on the unit interval, eg, (0.5, 0.0, 1.0). wxPython uses an int interval, but since wxPython colour management is rather simple, I have not chosen @@ -442,7 +443,7 @@ 'dashdot': wx.DOT_DASH, 'dotted': wx.DOT } _cache = weakref.WeakKeyDictionary() - + def __init__(self, bitmap, renderer): GraphicsContextBase.__init__(self) #assert self.Ok(), "wxMemoryDC not OK to use" @@ -455,7 +456,7 @@ gfx_ctx = wx.GraphicsContext.Create(dc) gfx_ctx._lastcliprect = None self._cache[bitmap] = dc, gfx_ctx - + self.bitmap = bitmap self.dc = dc self.gfx_ctx = gfx_ctx @@ -463,7 +464,7 @@ gfx_ctx.SetPen(self._pen) self._style = wx.SOLID self.renderer = renderer - + def select(self): """ Select the current bitmap into this wxDC instance @@ -720,7 +721,7 @@ self.macros = {} # dict from wx id to seq of macros self.Printer_Init() - + def Destroy(self, *args, **kwargs): wx.Panel.Destroy(self, *args, **kwargs) @@ -877,7 +878,7 @@ def draw_idle(self, *args, **kwargs): pass - + def draw(self, repaint=True): """ Render the figure using RendererWx instance renderer, or using a @@ -891,7 +892,7 @@ def flush_events(self): wx.Yield() - + def _get_imagesave_wildcards(self): 'return the wildcard string for the filesave dialog' default_filetype = self.get_default_filetype() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2008-04-23 17:45:51
|
Revision: 5066 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5066&view=rev Author: jdh2358 Date: 2008-04-23 10:44:15 -0700 (Wed, 23 Apr 2008) Log Message: ----------- added manuels scatter pie example Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/mlab.py trunk/matplotlib/unit/mlab_unit.py Added Paths: ----------- trunk/matplotlib/examples/scatter_piecharts.py Added: trunk/matplotlib/examples/scatter_piecharts.py =================================================================== --- trunk/matplotlib/examples/scatter_piecharts.py (rev 0) +++ trunk/matplotlib/examples/scatter_piecharts.py 2008-04-23 17:44:15 UTC (rev 5066) @@ -0,0 +1,40 @@ +""" +This example makes custom 'pie charts' as the markers for a scatter plotqu + +Thanks to Manuel Metz for the example +""" +import math +import numpy as np +import matplotlib.pyplot as plt + +# first define the ratios +r1 = 0.2 # 20% +r2 = r1 + 0.4 # 40% + +# define some sizes of the scatter marker +sizes = [60,80,120] + +# calculate the points of the first pie marker +# +# these are just the origin (0,0) + +# some points on a circle cos,sin +x = [0] + np.cos(np.linspace(0, 2*math.pi*r1, 10)).tolist() +y = [0] + np.sin(np.linspace(0, 2*math.pi*r1, 10)).tolist() +xy1 = zip(x,y) + +# ... +x = [0] + np.cos(np.linspace(2*math.pi*r1, 2*math.pi*r2, 10)).tolist() +y = [0] + np.sin(np.linspace(2*math.pi*r1, 2*math.pi*r2, 10)).tolist() +xy2 = zip(x,y) + +x = [0] + np.cos(np.linspace(2*math.pi*r2, 2*math.pi, 10)).tolist() +y = [0] + np.sin(np.linspace(2*math.pi*r2, 2*math.pi, 10)).tolist() +xy3 = zip(x,y) + + +fig = plt.figure() +ax = fig.add_subplot(111) +ax.scatter( np.arange(3), np.arange(3), marker=(xy1,0), s=sizes, facecolor='blue' ) +ax.scatter( np.arange(3), np.arange(3), marker=(xy2,0), s=sizes, facecolor='green' ) +ax.scatter( np.arange(3), np.arange(3), marker=(xy3,0), s=sizes, facecolor='red' ) +plt.show() Modified: trunk/matplotlib/lib/matplotlib/mlab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mlab.py 2008-04-23 16:54:21 UTC (rev 5065) +++ trunk/matplotlib/lib/matplotlib/mlab.py 2008-04-23 17:44:15 UTC (rev 5066) @@ -87,6 +87,7 @@ import numpy as npy + from matplotlib import nxutils from matplotlib import cbook @@ -2143,10 +2144,10 @@ def csv2rec(fname, comments='#', skiprows=0, checkrows=0, delimiter=',', - converterd=None, names=None, missing=None): + converterd=None, names=None, missing='', missingd=None): """ Load data from comma/space/tab delimited file in fname into a - numpy record array and return the record array. + numpy (m)record array and return the record array. If names is None, a header row is required to automatically assign the recarray names. The headers will be lower cased, spaces will @@ -2172,13 +2173,24 @@ names, if not None, is a list of header names. In this case, no header will be read from the file + missingd - is a dictionary mapping munged column names to field values + which signify that the field does not contain actual data and should + be masked, e.g. '0000-00-00' or 'unused' + + missing - a string whose value signals a missing field regardless of + the column it appears in, e.g. 'unused' + if no rows are found, None is returned -- see examples/loadrec.py """ if converterd is None: converterd = dict() + if missingd is None: + missingd = {} + import dateutil.parser + import datetime parsedate = dateutil.parser.parse @@ -2226,14 +2238,28 @@ process_skiprows(reader) - dateparser = dateutil.parser.parse + def ismissing(name, val): + "Should the value val in column name be masked?" - def myfloat(x): - if x==missing: - return npy.nan + if val == missing or val == missingd.get(name) or val == '': + return True else: - return float(x) + return False + def with_default_value(func, default): + def newfunc(name, val): + if ismissing(name, val): + return default + else: + return func(val) + return newfunc + + dateparser = dateutil.parser.parse + mydateparser = with_default_value(dateparser, datetime.date(1,1,1)) + myfloat = with_default_value(float, npy.nan) + myint = with_default_value(int, -1) + mystr = with_default_value(str, '') + def mydate(x): # try and return a date object d = dateparser(x) @@ -2241,16 +2267,16 @@ if d.hour>0 or d.minute>0 or d.second>0: raise ValueError('not a date') return d.date() + mydate = with_default_value(mydate, datetime.date(1,1,1)) - - def get_func(item, func): + def get_func(name, item, func): # promote functions in this order - funcmap = {int:myfloat, myfloat:mydate, mydate:dateparser, dateparser:str} - try: func(item) + funcmap = {myint:myfloat, myfloat:mydate, mydate:mydateparser, mydateparser:mystr} + try: func(name, item) except: - if func==str: + if func==mystr: raise ValueError('Could not find a working conversion function') - else: return get_func(item, funcmap[func]) # recurse + else: return get_func(name, item, funcmap[func]) # recurse else: return func @@ -2266,7 +2292,7 @@ converters = None for i, row in enumerate(reader): if i==0: - converters = [int]*len(row) + converters = [myint]*len(row) if checkrows and i>checkrows: break #print i, len(names), len(row) @@ -2276,10 +2302,10 @@ if func is None: func = converterd.get(name) if func is None: - if not item.strip(): continue + #if not item.strip(): continue func = converters[j] if len(item.strip()): - func = get_func(item, func) + func = get_func(name, item, func) converters[j] = func return converters @@ -2307,7 +2333,7 @@ item = itemd.get(item, item) cnt = seen.get(item, 0) if cnt>0: - names.append(item + '%d'%cnt) + names.append(item + '_%d'%cnt) else: names.append(item) seen[item] = cnt+1 @@ -2327,15 +2353,24 @@ # iterate over the remaining rows and convert the data to date # objects, ints, or floats as approriate rows = [] + rowmasks = [] for i, row in enumerate(reader): if not len(row): continue if row[0].startswith(comments): continue - rows.append([func(val) for func, val in zip(converters, row)]) + rows.append([func(name, val) for func, name, val in zip(converters, names, row)]) + rowmasks.append([ismissing(name, val) for name, val in zip(names, row)]) fh.close() if not len(rows): return None - r = npy.rec.fromrecords(rows, names=names) + if npy.any(rowmasks): + try: from numpy.ma import mrecords + except ImportError: + raise RuntimeError('numpy 1.05 or later is required for masked array support') + else: + r = mrecords.fromrecords(rows, names=names, mask=rowmasks) + else: + r = npy.rec.fromrecords(rows, names=names) return r @@ -2529,26 +2564,59 @@ -def rec2csv(r, fname, delimiter=',', formatd=None): +def rec2csv(r, fname, delimiter=',', formatd=None, missing='', + missingd=None): """ - Save the data from numpy record array r into a comma/space/tab + Save the data from numpy (m)recarray r into a comma/space/tab delimited file. The record array dtype names will be used for column headers. fname - can be a filename or a file handle. Support for gzipped files is automatic, if the filename ends in .gz + + See csv2rec and rec2csv for information about missing and + missingd, which can be used to fill in masked values into your CSV + file. """ + + if missingd is None: + missingd = dict() + + def with_mask(func): + def newfunc(val, mask, mval): + if mask: + return mval + else: + return func(val) + return newfunc + formatd = get_formatd(r, formatd) funcs = [] for i, name in enumerate(r.dtype.names): - funcs.append(csvformat_factory(formatd[name]).tostr) + funcs.append(with_mask(csvformat_factory(formatd[name]).tostr)) fh, opened = cbook.to_filehandle(fname, 'w', return_opened=True) writer = csv.writer(fh, delimiter=delimiter) header = r.dtype.names writer.writerow(header) + + # Our list of specials for missing values + mvals = [] + for name in header: + mvals.append(missingd.get(name, missing)) + + ismasked = False + if len(r): + row = r[0] + ismasked = hasattr(row, '_fieldmask') + for row in r: - writer.writerow([func(val) for func, val in zip(funcs, row)]) + if ismasked: + row, rowmask = row.item(), row._fieldmask.item() + else: + rowmask = [False] * len(row) + writer.writerow([func(val, mask, mval) for func, val, mask, mval + in zip(funcs, row, rowmask, mvals)]) if opened: fh.close() Modified: trunk/matplotlib/unit/mlab_unit.py =================================================================== --- trunk/matplotlib/unit/mlab_unit.py 2008-04-23 16:54:21 UTC (rev 5065) +++ trunk/matplotlib/unit/mlab_unit.py 2008-04-23 17:44:15 UTC (rev 5066) @@ -55,5 +55,27 @@ print 'repr(dt.type)',repr(dt.type) self.failUnless( numpy.all(ra[name] == ra2[name]) ) # should not fail with numpy 1.0.5 + def test_csv2rec_masks(self): + # Make sure masked entries survive roundtrip + + csv = """date,age,weight,name +2007-01-01,12,32.2,"jdh1" +0000-00-00,0,23,"jdh2" +2007-01-03,,32.5,"jdh3" +2007-01-04,12,NaN,"jdh4" +2007-01-05,-1,NULL,""" + missingd = dict(date='0000-00-00', age='-1', weight='NULL') + fh = StringIO.StringIO(csv) + r1 = mlab.csv2rec(fh, missingd=missingd) + fh = StringIO.StringIO() + mlab.rec2csv(r1, fh, missingd=missingd) + fh.seek(0) + r2 = mlab.csv2rec(fh, missingd=missingd) + + self.failUnless( numpy.all( r2['date'].mask == [0,1,0,0,0] )) + self.failUnless( numpy.all( r2['age'].mask == [0,0,1,0,1] )) + self.failUnless( numpy.all( r2['weight'].mask == [0,0,0,0,1] )) + self.failUnless( numpy.all( r2['name'].mask == [0,0,0,0,1] )) + if __name__=='__main__': unittest.main() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2008-04-23 16:54:23
|
Revision: 5065 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5065&view=rev Author: efiring Date: 2008-04-23 09:54:21 -0700 (Wed, 23 Apr 2008) Log Message: ----------- Allow for numpy 1.04, which does not have ma.masked_invalid Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/transforms.py Modified: trunk/matplotlib/lib/matplotlib/transforms.py =================================================================== --- trunk/matplotlib/lib/matplotlib/transforms.py 2008-04-23 12:37:58 UTC (rev 5064) +++ trunk/matplotlib/lib/matplotlib/transforms.py 2008-04-23 16:54:21 UTC (rev 5065) @@ -693,7 +693,10 @@ if len(xy) == 0: return - xym = ma.masked_invalid(xy) + try: + xym = ma.masked_invalid(xy) # maybe add copy=False + except AttributeError: # masked_invalid not exposed in npy 1.04 + xym = ma.masked_where(~npy.isfinite(xy), xy) if (xym.count(axis=1)!=2).all(): return This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-04-23 12:38:02
|
Revision: 5064 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5064&view=rev Author: mdboom Date: 2008-04-23 05:37:58 -0700 (Wed, 23 Apr 2008) Log Message: ----------- Use our own "round" function, since it doesn't appear to exist in VS2003 Modified Paths: -------------- trunk/matplotlib/src/agg_py_path_iterator.h Modified: trunk/matplotlib/src/agg_py_path_iterator.h =================================================================== --- trunk/matplotlib/src/agg_py_path_iterator.h 2008-04-23 07:21:03 UTC (rev 5063) +++ trunk/matplotlib/src/agg_py_path_iterator.h 2008-04-23 12:37:58 UTC (rev 5064) @@ -8,6 +8,10 @@ #include "MPL_isnan.h" #include <queue> +static inline double my_round(double v) { + return (double)(int)(v + ((v >= 0.0) ? 0.5 : -0.5)); +} + class PathIterator { PyArrayObject* m_vertices; @@ -157,8 +161,8 @@ cmd = m_source->vertex(x, y); if (m_quantize && agg::is_vertex(cmd)) { - *x = round(*x) + 0.5; - *y = round(*y) + 0.5; + *x = my_round(*x) + 0.5; + *y = my_round(*y) + 0.5; } return cmd; } @@ -214,8 +218,8 @@ // Do any quantization if requested if (m_quantize && agg::is_vertex(cmd)) { - *x = round(*x) + 0.5; - *y = round(*y) + 0.5; + *x = my_round(*x) + 0.5; + *y = my_round(*y) + 0.5; } //if we are starting a new path segment, move to the first point This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2008-04-23 07:21:22
|
Revision: 5063 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5063&view=rev Author: efiring Date: 2008-04-23 00:21:03 -0700 (Wed, 23 Apr 2008) Log Message: ----------- Update dataLim only if some valid data are available. This change means that plot([nan]) will generate an empty plot instead of raising an obscure exception. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/transforms.py Modified: trunk/matplotlib/lib/matplotlib/transforms.py =================================================================== --- trunk/matplotlib/lib/matplotlib/transforms.py 2008-04-22 18:55:36 UTC (rev 5062) +++ trunk/matplotlib/lib/matplotlib/transforms.py 2008-04-23 07:21:03 UTC (rev 5063) @@ -693,6 +693,9 @@ if len(xy) == 0: return + xym = ma.masked_invalid(xy) + if (xym.count(axis=1)!=2).all(): + return points, minpos, changed = update_path_extents( Path(xy), None, self._points, self._minpos, ignore) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2008-04-22 18:55:46
|
Revision: 5062 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5062&view=rev Author: efiring Date: 2008-04-22 11:55:36 -0700 (Tue, 22 Apr 2008) Log Message: ----------- Restore ability of backend_driver.py to drive cairo.svg, etc. Modified Paths: -------------- trunk/matplotlib/examples/backend_driver.py Modified: trunk/matplotlib/examples/backend_driver.py =================================================================== --- trunk/matplotlib/examples/backend_driver.py 2008-04-22 15:09:24 UTC (rev 5061) +++ trunk/matplotlib/examples/backend_driver.py 2008-04-22 18:55:36 UTC (rev 5062) @@ -126,11 +126,6 @@ def drive(backend, python=['python'], switches = []): exclude = failbackend.get(backend, []) - # Strip off the format specifier, if any. - if backend.startswith('cairo'): - _backend = 'cairo' - else: - _backend = backend # Clear the destination directory for the examples path = backend @@ -163,7 +158,7 @@ tmpfile.writelines(( 'from __future__ import division\n', 'import matplotlib\n', - 'matplotlib.use("%s")\n' % _backend, + 'matplotlib.use("%s")\n' % backend, 'from pylab import savefig\n', )) for line in file(fname): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-04-22 15:10:42
|
Revision: 5061 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5061&view=rev Author: mdboom Date: 2008-04-22 08:09:24 -0700 (Tue, 22 Apr 2008) Log Message: ----------- Merged revisions 5039-5060 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint ........ r5046 | dsdale | 2008-04-18 11:20:03 -0400 (Fri, 18 Apr 2008) | 4 lines dont remove repaint/update from draw(), or updates to the figure after the initial draw will be ignored. We need a different solution for the double drawing problem reported for the Wx and Qt* backends ........ r5050 | dsdale | 2008-04-19 10:22:11 -0400 (Sat, 19 Apr 2008) | 3 lines improve conversion from str to char*, avoid deprecation warnings during build ........ r5058 | mdboom | 2008-04-22 11:01:00 -0400 (Tue, 22 Apr 2008) | 2 lines Fix inconsistency between svg.embed_chars and svg.embed_char_paths ........ r5060 | mdboom | 2008-04-22 11:06:01 -0400 (Tue, 22 Apr 2008) | 2 lines Fix inconsistency between svg.embed_chars and svg.embed_char_paths ........ Modified Paths: -------------- trunk/matplotlib/CHANGELOG Property Changed: ---------------- trunk/matplotlib/ Property changes on: trunk/matplotlib ___________________________________________________________________ Name: svnmerge-integrated - /branches/v0_91_maint:1-5038 + /branches/v0_91_maint:1-5060 Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-04-22 15:06:01 UTC (rev 5060) +++ trunk/matplotlib/CHANGELOG 2008-04-22 15:09:24 UTC (rev 5061) @@ -3437,3 +3437,4 @@ 2003-11-21 - make a dash-dot dict for the GC 2003-12-15 - fix install path bug +t \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-04-22 15:08:00
|
Revision: 5060 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5060&view=rev Author: mdboom Date: 2008-04-22 08:06:01 -0700 (Tue, 22 Apr 2008) Log Message: ----------- Fix inconsistency between svg.embed_chars and svg.embed_char_paths Modified Paths: -------------- branches/v0_91_maint/lib/matplotlib/config/mplconfig.py Modified: branches/v0_91_maint/lib/matplotlib/config/mplconfig.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/config/mplconfig.py 2008-04-22 15:03:25 UTC (rev 5059) +++ branches/v0_91_maint/lib/matplotlib/config/mplconfig.py 2008-04-22 15:06:01 UTC (rev 5060) @@ -99,7 +99,7 @@ class svg(TConfig): image_inline = T.true image_noscale = T.false - embed_chars = T.true + embed_char_paths = T.true class lines(TConfig): linewidth = T.Float(1.0) @@ -435,7 +435,7 @@ 'pdf.fonttype' : (self.tconfig.backend.pdf, 'fonttype'), 'svg.image_inline' : (self.tconfig.backend.svg, 'image_inline'), 'svg.image_noscale' : (self.tconfig.backend.svg, 'image_noscale'), - 'svg.embed_char_paths' : (self.tconfig.backend.svg, 'embed_chars'), + 'svg.embed_char_paths' : (self.tconfig.backend.svg, 'embed_char_paths'), } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-04-22 15:05:42
|
Revision: 5059 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5059&view=rev Author: mdboom Date: 2008-04-22 08:03:25 -0700 (Tue, 22 Apr 2008) Log Message: ----------- Fix inconsistency between svg.embed_chars and svg.embed_char_paths Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/config/mplconfig.py Modified: trunk/matplotlib/lib/matplotlib/config/mplconfig.py =================================================================== --- trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2008-04-22 15:01:00 UTC (rev 5058) +++ trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2008-04-22 15:03:25 UTC (rev 5059) @@ -99,7 +99,7 @@ class svg(TConfig): image_inline = T.true image_noscale = T.false - embed_chars = T.true + embed_char_paths = T.true class lines(TConfig): linewidth = T.Float(1.0) @@ -437,7 +437,7 @@ 'pdf.fonttype' : (self.tconfig.backend.pdf, 'fonttype'), 'svg.image_inline' : (self.tconfig.backend.svg, 'image_inline'), 'svg.image_noscale' : (self.tconfig.backend.svg, 'image_noscale'), - 'svg.embed_char_paths' : (self.tconfig.backend.svg, 'embed_chars'), + 'svg.embed_char_paths' : (self.tconfig.backend.svg, 'embed_char_paths'), } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-04-22 15:02:15
|
Revision: 5058 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5058&view=rev Author: mdboom Date: 2008-04-22 08:01:00 -0700 (Tue, 22 Apr 2008) Log Message: ----------- Fix inconsistency between svg.embed_chars and svg.embed_char_paths Modified Paths: -------------- branches/v0_91_maint/CHANGELOG branches/v0_91_maint/matplotlibrc.template Modified: branches/v0_91_maint/CHANGELOG =================================================================== --- branches/v0_91_maint/CHANGELOG 2008-04-22 14:59:03 UTC (rev 5057) +++ branches/v0_91_maint/CHANGELOG 2008-04-22 15:01:00 UTC (rev 5058) @@ -1,3 +1,5 @@ +2008-04-22 Use "svg.embed_char_paths" consistently everywhere - MGD + 2008-04-11 Fix global font rcParam setting after initialization time. - MGD Modified: branches/v0_91_maint/matplotlibrc.template =================================================================== --- branches/v0_91_maint/matplotlibrc.template 2008-04-22 14:59:03 UTC (rev 5057) +++ branches/v0_91_maint/matplotlibrc.template 2008-04-22 15:01:00 UTC (rev 5058) @@ -156,7 +156,7 @@ # 'tex': As TeX-like text. Text between $'s will be # formatted as a TeX math expression. # This setting has no effect when text.usetex is True. - # In that case, all text will be sent to TeX for + # In that case, all text will be sent to TeX for # processing. # The following settings allow you to select the fonts in math mode. @@ -171,7 +171,7 @@ #mathtext.fontset : cm # Should be 'cm' (Computer Modern), 'stix', # 'stixsans' or 'custom' #mathtext.fallback_to_cm : True # When True, use symbols from the Computer Modern - # fonts when a symbol can not be found in one of + # fonts when a symbol can not be found in one of # the custom math fonts. ### AXES @@ -291,7 +291,7 @@ # svg backend params #svg.image_inline : True # write raster image data directly into the svg file #svg.image_noscale : False # suppress scaling of raster data embedded in SVG -#svg.embed_chars : True # embed character outlines in the SVG file +#svg.embed_char_paths : True # embed character outlines in the SVG file # Set the verbose flags. This controls how much information # matplotlib gives you at runtime and where it goes. The verbosity This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-04-22 14:59:43
|
Revision: 5057 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5057&view=rev Author: mdboom Date: 2008-04-22 07:59:03 -0700 (Tue, 22 Apr 2008) Log Message: ----------- Fix inconsistency between svg.embed_chars and svg.embed_char_paths Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/matplotlibrc.template Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-04-22 12:15:13 UTC (rev 5056) +++ trunk/matplotlib/CHANGELOG 2008-04-22 14:59:03 UTC (rev 5057) @@ -1,3 +1,5 @@ +2008-04-22 Use "svg.embed_char_paths" consistently everywhere - MGD + 2008-04-20 Add support to MaxNLocator for symmetric axis autoscaling. - EF 2008-04-20 Fix double-zoom bug. - MM Modified: trunk/matplotlib/matplotlibrc.template =================================================================== --- trunk/matplotlib/matplotlibrc.template 2008-04-22 12:15:13 UTC (rev 5056) +++ trunk/matplotlib/matplotlibrc.template 2008-04-22 14:59:03 UTC (rev 5057) @@ -292,7 +292,7 @@ # svg backend params #svg.image_inline : True # write raster image data directly into the svg file #svg.image_noscale : False # suppress scaling of raster data embedded in SVG -#svg.embed_chars : True # embed character outlines in the SVG file +#svg.embed_char_paths : True # embed character outlines in the SVG file # Set the verbose flags. This controls how much information # matplotlib gives you at runtime and where it goes. The verbosity This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-04-22 12:15:22
|
Revision: 5056 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5056&view=rev Author: mdboom Date: 2008-04-22 05:15:13 -0700 (Tue, 22 Apr 2008) Log Message: ----------- Removing my "bone-headed" "not"s and "or"s. Including "math.h" in an attempt to get VS2003 working. Modified Paths: -------------- trunk/matplotlib/src/_path.cpp Modified: trunk/matplotlib/src/_path.cpp =================================================================== --- trunk/matplotlib/src/_path.cpp 2008-04-21 08:17:45 UTC (rev 5055) +++ trunk/matplotlib/src/_path.cpp 2008-04-22 12:15:13 UTC (rev 5056) @@ -1,3 +1,6 @@ +#include <limits> +#include <math.h> + #include "agg_py_path_iterator.h" #include "agg_py_transforms.h" @@ -997,10 +1000,10 @@ std::swap(bx0, bx1); if (by1 < by0) std::swap(by0, by1); - if (not ((bx1 <= ax0) or - (by1 <= ay0) or - (bx0 >= ax1) or - (by0 >= ay1))) + if (!((bx1 <= ax0) || + (by1 <= ay0) || + (bx0 >= ax1) || + (by0 >= ay1))) ++count; } else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2008-04-21 08:17:48
|
Revision: 5055 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5055&view=rev Author: efiring Date: 2008-04-21 01:17:45 -0700 (Mon, 21 Apr 2008) Log Message: ----------- Bugfix: set_ticks was not respecting axis orientation Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axis.py Modified: trunk/matplotlib/lib/matplotlib/axis.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axis.py 2008-04-21 08:00:03 UTC (rev 5054) +++ trunk/matplotlib/lib/matplotlib/axis.py 2008-04-21 08:17:45 UTC (rev 5055) @@ -1060,8 +1060,12 @@ """ ### XXX if the user changes units, the information will be lost here ticks = self.convert_units(ticks) - if len(ticks): - self.set_view_interval(min(ticks), max(ticks)) + if len(ticks) > 1: + xleft, xright = self.get_view_interval() + if xright > xleft: + self.set_view_interval(min(ticks), max(ticks)) + else: + self.set_view_interval(max(ticks), min(ticks)) if minor: self.set_minor_locator(FixedLocator(ticks)) return self.get_minor_ticks(len(ticks)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2008-04-21 08:00:17
|
Revision: 5054 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5054&view=rev Author: efiring Date: 2008-04-21 01:00:03 -0700 (Mon, 21 Apr 2008) Log Message: ----------- Support 0-centered axis in MaxNLocator Modified Paths: -------------- trunk/matplotlib/API_CHANGES trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/ticker.py Modified: trunk/matplotlib/API_CHANGES =================================================================== --- trunk/matplotlib/API_CHANGES 2008-04-20 10:45:32 UTC (rev 5053) +++ trunk/matplotlib/API_CHANGES 2008-04-21 08:00:03 UTC (rev 5054) @@ -1,5 +1,8 @@ + New kwarg, "symmetric", in MaxNLocator + allows one require an axis to be centered on zero. + toolkits must now be imported from mpl_toolkits (not matplotlib.toolkits) - + TRANSFORMS REFACTORING The primary goal of this refactoring was to make it easier to Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-04-20 10:45:32 UTC (rev 5053) +++ trunk/matplotlib/CHANGELOG 2008-04-21 08:00:03 UTC (rev 5054) @@ -1,3 +1,5 @@ +2008-04-20 Add support to MaxNLocator for symmetric axis autoscaling. - EF + 2008-04-20 Fix double-zoom bug. - MM 2008-04-15 Speed up color mapping. - EF Modified: trunk/matplotlib/lib/matplotlib/ticker.py =================================================================== --- trunk/matplotlib/lib/matplotlib/ticker.py 2008-04-20 10:45:32 UTC (rev 5053) +++ trunk/matplotlib/lib/matplotlib/ticker.py 2008-04-21 08:00:03 UTC (rev 5054) @@ -845,10 +845,14 @@ Select no more than N intervals at nice locations. """ - def __init__(self, nbins = 10, steps = None, trim = True, integer=False): + def __init__(self, nbins = 10, steps = None, + trim = True, + integer=False, + symmetric=False): self._nbins = int(nbins) self._trim = trim self._integer = integer + self._symmetric = symmetric if steps is None: self._steps = [1, 1.5, 2, 2.5, 3, 4, 5, 6, 8, 10] else: @@ -890,6 +894,10 @@ def autoscale(self): dmin, dmax = self.axis.get_data_interval() + if self._symmetric: + maxabs = max(abs(dmin), abs(dmax)) + dmin = -maxabs + dmax = maxabs dmin, dmax = mtransforms.nonsingular(dmin, dmax, expander = 0.05) return npy.take(self.bin_boundaries(dmin, dmax), [0,-1]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mme...@us...> - 2008-04-20 10:45:37
|
Revision: 5053 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5053&view=rev Author: mmetz_bn Date: 2008-04-20 03:45:32 -0700 (Sun, 20 Apr 2008) Log Message: ----------- Fixed double-zoom bug Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/backend_bases.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-04-20 01:33:46 UTC (rev 5052) +++ trunk/matplotlib/CHANGELOG 2008-04-20 10:45:32 UTC (rev 5053) @@ -1,3 +1,5 @@ +2008-04-20 Fix double-zoom bug. - MM + 2008-04-15 Speed up color mapping. - EF 2008-04-12 Speed up zooming and panning of dense images. - EF Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backend_bases.py 2008-04-20 01:33:46 UTC (rev 5052) +++ trunk/matplotlib/lib/matplotlib/backend_bases.py 2008-04-20 10:45:32 UTC (rev 5053) @@ -1508,6 +1508,8 @@ 'the release mouse button callback in zoom to rect mode' if not self._xypress: return + last_a = [] + for cur_xypress in self._xypress: x, y = event.x, event.y lastx, lasty, a, ind, lim, trans = cur_xypress @@ -1526,28 +1528,42 @@ x, y = inverse.transform_point( (x, y) ) Xmin,Xmax=a.get_xlim() Ymin,Ymax=a.get_ylim() + + # detect twinx,y axes and avoid double zooming + twinx, twiny = False, False + if last_a: + for la in last_a: + if a._shared_x_axes.joined(a,la): twinx=True + if a._shared_y_axes.joined(a,la): twiny=True + last_a.append(a) - if Xmin < Xmax: - if x<lastx: x0, x1 = x, lastx - else: x0, x1 = lastx, x - if x0 < Xmin: x0=Xmin - if x1 > Xmax: x1=Xmax + if twinx: + x0, x1 = Xmin, Xmax else: - if x>lastx: x0, x1 = x, lastx - else: x0, x1 = lastx, x - if x0 > Xmin: x0=Xmin - if x1 < Xmax: x1=Xmax + if Xmin < Xmax: + if x<lastx: x0, x1 = x, lastx + else: x0, x1 = lastx, x + if x0 < Xmin: x0=Xmin + if x1 > Xmax: x1=Xmax + else: + if x>lastx: x0, x1 = x, lastx + else: x0, x1 = lastx, x + if x0 > Xmin: x0=Xmin + if x1 < Xmax: x1=Xmax - if Ymin < Ymax: - if y<lasty: y0, y1 = y, lasty - else: y0, y1 = lasty, y - if y0 < Ymin: y0=Ymin - if y1 > Ymax: y1=Ymax + if twiny: + y0, y1 = Ymin, Ymax else: - if y>lasty: y0, y1 = y, lasty - else: y0, y1 = lasty, y - if y0 > Ymin: y0=Ymin - if y1 < Ymax: y1=Ymax + if Ymin < Ymax: + if y<lasty: y0, y1 = y, lasty + else: y0, y1 = lasty, y + if y0 < Ymin: y0=Ymin + if y1 > Ymax: y1=Ymax + else: + if y>lasty: y0, y1 = y, lasty + else: y0, y1 = lasty, y + if y0 > Ymin: y0=Ymin + if y1 < Ymax: y1=Ymax if self._button_pressed == 1: a.set_xlim((x0, x1)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2008-04-20 01:33:48
|
Revision: 5052 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5052&view=rev Author: efiring Date: 2008-04-19 18:33:46 -0700 (Sat, 19 Apr 2008) Log Message: ----------- Make FixedFormatter work on colorbar (bug report by Jiacong Huang) Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/colorbar.py Modified: trunk/matplotlib/lib/matplotlib/colorbar.py =================================================================== --- trunk/matplotlib/lib/matplotlib/colorbar.py 2008-04-20 00:57:40 UTC (rev 5051) +++ trunk/matplotlib/lib/matplotlib/colorbar.py 2008-04-20 01:33:46 UTC (rev 5052) @@ -351,7 +351,7 @@ b = npy.array(locator()) b, ticks = self._locate(b) formatter.set_locs(b) - ticklabels = [formatter(t) for t in b] + ticklabels = [formatter(t, i) for i, t in enumerate(b)] offset_string = formatter.get_offset() return ticks, ticklabels, offset_string This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2008-04-20 00:57:45
|
Revision: 5051 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5051&view=rev Author: efiring Date: 2008-04-19 17:57:40 -0700 (Sat, 19 Apr 2008) Log Message: ----------- Make alpha work for contour and contourf (thanks to Stephane Raynaud) Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/contour.py Modified: trunk/matplotlib/lib/matplotlib/contour.py =================================================================== --- trunk/matplotlib/lib/matplotlib/contour.py 2008-04-19 14:22:11 UTC (rev 5050) +++ trunk/matplotlib/lib/matplotlib/contour.py 2008-04-20 00:57:40 UTC (rev 5051) @@ -325,7 +325,8 @@ levels = self.label_levels fslist = self.fslist trans = self.ax.transData - _colors = self.label_mappable.to_rgba(self.label_cvalues) + _colors = self.label_mappable.to_rgba(self.label_cvalues, + alpha=self.alpha) fmt = self.fmt for icon, lev, color, cvalue, fsize in zip(self.label_indices, self.label_levels, @@ -456,7 +457,8 @@ nchunk = self.nchunk) col = collections.PolyCollection(nlist, antialiaseds = (self.antialiased,), - edgecolors= 'None') + edgecolors= 'none', + alpha=self.alpha) self.ax.add_collection(col) self.collections.append(col) @@ -469,7 +471,8 @@ nlist = C.trace(level, points = 0) col = collections.LineCollection(nlist, linewidths = width, - linestyle = lstyle) + linestyle = lstyle, + alpha=self.alpha) if level < 0.0 and self.monochrome: ls = mpl.rcParams['contour.negative_linestyle'] @@ -491,8 +494,10 @@ self.to_rgba(self.cvalues, alpha=self.alpha)] self.tcolors = tcolors for color, collection in zip(tcolors, self.collections): + collection.set_alpha(self.alpha) collection.set_color(color) for label, cv in zip(self.cl, self.cl_cvalues): + label.set_alpha(self.alpha) label.set_color(self.label_mappable.to_rgba(cv)) # add label colors cm.ScalarMappable.changed(self) @@ -718,11 +723,11 @@ return tlinestyles def get_alpha(self): - '''For compatibility with artists, return self.alpha''' + '''returns alpha to be applied to all ContourSet artists''' return self.alpha def set_alpha(self, alpha): - '''For compatibility with artists, set self.alpha''' + '''sets alpha for all ContourSet artists''' self.alpha = alpha self.changed() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |