From: <as...@us...> - 2010-01-16 19:20:09
|
Revision: 8083 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8083&view=rev Author: astraw Date: 2010-01-16 19:20:03 +0000 (Sat, 16 Jan 2010) Log Message: ----------- Don't create minor ticks on top of existing major ticks (Neil Crighton). Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/ticker.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2010-01-16 19:19:14 UTC (rev 8082) +++ trunk/matplotlib/CHANGELOG 2010-01-16 19:20:03 UTC (rev 8083) @@ -1,3 +1,6 @@ +2009-01-16 Don't create minor ticks on top of existing major + ticks. Patch by Neil Crighton. -ADS + 2009-01-16 Ensure three minor ticks always drawn (SF# 2924245). Patch by Neil Crighton. -ADS Modified: trunk/matplotlib/lib/matplotlib/ticker.py =================================================================== --- trunk/matplotlib/lib/matplotlib/ticker.py 2010-01-16 19:19:14 UTC (rev 8082) +++ trunk/matplotlib/lib/matplotlib/ticker.py 2010-01-16 19:20:03 UTC (rev 8083) @@ -1334,10 +1334,15 @@ vmin, vmax = self.axis.get_view_interval() if vmin > vmax: vmin,vmax = vmax,vmin + locs = locs[(vmin < locs) & (locs < vmax)] - return self.raise_if_exceeds(locs[(vmin < locs) & (locs < vmax)]) + # don't create minor ticks on top of existing major ticks + diff = 0.5 * abs(locs[1] - locs[0]) + locs = [l for l in locs if (np.abs(l - majorlocs) > diff).all()] + return self.raise_if_exceeds(np.array(locs)) + class OldAutoLocator(Locator): """ On autoscale this class picks the best MultipleLocator to set the This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2010-01-16 22:08:01
|
Revision: 8084 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8084&view=rev Author: jdh2358 Date: 2010-01-16 22:07:53 +0000 (Sat, 16 Jan 2010) Log Message: ----------- upgraded CXX to 6.1.1 Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/CXX/Config.hxx trunk/matplotlib/CXX/Exception.hxx trunk/matplotlib/CXX/Extensions.hxx trunk/matplotlib/CXX/IndirectPythonInterface.cxx trunk/matplotlib/CXX/IndirectPythonInterface.hxx trunk/matplotlib/CXX/Objects.hxx trunk/matplotlib/CXX/Version.hxx trunk/matplotlib/CXX/WrapPython.h trunk/matplotlib/CXX/cxx_extensions.cxx trunk/matplotlib/CXX/cxxextensions.c trunk/matplotlib/CXX/cxxsupport.cxx Added Paths: ----------- trunk/matplotlib/CXX/IndirectPythonInterface.cxx~ trunk/matplotlib/CXX/Python2/ trunk/matplotlib/CXX/Python2/Config.hxx trunk/matplotlib/CXX/Python2/CxxDebug.hxx trunk/matplotlib/CXX/Python2/Exception.hxx trunk/matplotlib/CXX/Python2/ExtensionModule.hxx trunk/matplotlib/CXX/Python2/ExtensionOldType.hxx trunk/matplotlib/CXX/Python2/ExtensionType.hxx trunk/matplotlib/CXX/Python2/ExtensionTypeBase.hxx trunk/matplotlib/CXX/Python2/Extensions.hxx trunk/matplotlib/CXX/Python2/IndirectPythonInterface.cxx trunk/matplotlib/CXX/Python2/IndirectPythonInterface.hxx trunk/matplotlib/CXX/Python2/Objects.hxx trunk/matplotlib/CXX/Python2/PythonType.hxx trunk/matplotlib/CXX/Python2/cxx_extensions.cxx trunk/matplotlib/CXX/Python2/cxxextensions.c trunk/matplotlib/CXX/Python2/cxxsupport.cxx trunk/matplotlib/CXX/Python3/ trunk/matplotlib/CXX/Python3/Config.hxx trunk/matplotlib/CXX/Python3/CxxDebug.hxx trunk/matplotlib/CXX/Python3/Exception.hxx trunk/matplotlib/CXX/Python3/ExtensionModule.hxx trunk/matplotlib/CXX/Python3/ExtensionOldType.hxx trunk/matplotlib/CXX/Python3/ExtensionType.hxx trunk/matplotlib/CXX/Python3/ExtensionTypeBase.hxx trunk/matplotlib/CXX/Python3/Extensions.hxx trunk/matplotlib/CXX/Python3/IndirectPythonInterface.cxx trunk/matplotlib/CXX/Python3/IndirectPythonInterface.hxx trunk/matplotlib/CXX/Python3/Objects.hxx trunk/matplotlib/CXX/Python3/PythonType.hxx trunk/matplotlib/CXX/Python3/cxx_extensions.cxx trunk/matplotlib/CXX/Python3/cxxextensions.c trunk/matplotlib/CXX/Python3/cxxsupport.cxx trunk/matplotlib/CXX/cxxextensions.c~ trunk/matplotlib/CXX/cxxsupport.cxx~ Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2010-01-16 19:20:03 UTC (rev 8083) +++ trunk/matplotlib/CHANGELOG 2010-01-16 22:07:53 UTC (rev 8084) @@ -1,3 +1,6 @@ + +2010-01-16 Upgraded CXX to 6.1.1 - JDH + 2009-01-16 Don't create minor ticks on top of existing major ticks. Patch by Neil Crighton. -ADS @@ -17,6 +20,7 @@ 2009-01-11 Add add_click and pop_click methods in BlockingContourLabeler. -JJL + 2010-01-03 Added rcParams['axes.color_cycle'] - EF 2010-01-03 Added Pierre's qt4 formlayout editor and toolbar button - JDH Modified: trunk/matplotlib/CXX/Config.hxx =================================================================== --- trunk/matplotlib/CXX/Config.hxx 2010-01-16 19:20:03 UTC (rev 8083) +++ trunk/matplotlib/CXX/Config.hxx 2010-01-16 22:07:53 UTC (rev 8084) @@ -34,101 +34,10 @@ // DAMAGE. // //----------------------------------------------------------------------------- +#include "CXX/WrapPython.h" -#ifndef __PyCXX_config_hh__ -#define __PyCXX_config_hh__ - -// -// Microsoft VC++ 6.0 has no traits -// -#if defined( _MSC_VER ) - -# define STANDARD_LIBRARY_HAS_ITERATOR_TRAITS 1 - -#elif defined( __GNUC__ ) -# if __GNUC__ >= 3 -# define STANDARD_LIBRARY_HAS_ITERATOR_TRAITS 1 -# else -# define STANDARD_LIBRARY_HAS_ITERATOR_TRAITS 0 -#endif - -// -// Assume all other compilers do -// +#if PY_MAJOR_VERSION == 2 +#include "CXX/Python2/Config.hxx" #else - -// Macros to deal with deficiencies in compilers -# define STANDARD_LIBRARY_HAS_ITERATOR_TRAITS 1 +#include "CXX/Python3/Config.hxx" #endif - -#if STANDARD_LIBRARY_HAS_ITERATOR_TRAITS -# define random_access_iterator_parent(itemtype) std::iterator<std::random_access_iterator_tag,itemtype,int> -#else -# define random_access_iterator_parent(itemtype) std::random_access_iterator<itemtype, int> -#endif - -// -// Which C++ standard is in use? -// -#if defined( _MSC_VER ) -# if _MSC_VER <= 1200 -// MSVC++ 6.0 -# define PYCXX_ISO_CPP_LIB 0 -# define STR_STREAM <strstream> -# define TEMPLATE_TYPENAME class -# else -# define PYCXX_ISO_CPP_LIB 1 -# define STR_STREAM <sstream> -# define TEMPLATE_TYPENAME typename -# endif -#elif defined( __GNUC__ ) -# if __GNUC__ >= 3 -# define PYCXX_ISO_CPP_LIB 1 -# define STR_STREAM <sstream> -# define TEMPLATE_TYPENAME typename -# else -# define PYCXX_ISO_CPP_LIB 0 -# define STR_STREAM <strstream> -# define TEMPLATE_TYPENAME class -# endif -#endif - -#if PYCXX_ISO_CPP_LIB -# define STR_STREAM <sstream> -# define OSTRSTREAM ostringstream -# define EXPLICIT_TYPENAME typename -# define EXPLICIT_CLASS class -# define TEMPLATE_TYPENAME typename -#else -# define STR_STREAM <strstream> -# define OSTRSTREAM ostrstream -# define EXPLICIT_TYPENAME -# define EXPLICIT_CLASS -# define TEMPLATE_TYPENAME class -#endif - -// before 2.5 Py_ssize_t was missing -#ifndef PY_MAJOR_VERSION -#error not defined PY_MAJOR_VERSION -#endif -#if PY_MAJOR_VERSION < 2 || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 5) -typedef int Py_ssize_t; -#endif - -// hash_map container usage selection -// 1) if PYCXX_USING_STD_MAP is defined PyCXX will be using std::map<> container -// implementation only. -// 2) if compilers are used other than MS Visual Studio (7.1+) or GCC 3.x -// STANDARD_LIBRARY_HAS_HASH_MAP must be defined before compilation to -// make PyCXX using hash_map container. -#if !defined( PYCXX_USING_STD_MAP ) - #if defined( _MSC_VER ) || defined( __INTEL_COMPILER ) || defined ( __ICC ) || (defined( __GNUC__ ) && ( __GNUC__ > 3 )) - # define PYCXX_USING_HASH_MAP - #else - # if defined( STANDARD_LIBRARY_HAS_HASH_MAP ) && !defined( PYCXX_USING_HASH_MAP ) - # define PYCXX_USING_HASH_MAP - # endif - #endif -#endif - -#endif // __PyCXX_config_hh__ Modified: trunk/matplotlib/CXX/Exception.hxx =================================================================== --- trunk/matplotlib/CXX/Exception.hxx 2010-01-16 19:20:03 UTC (rev 8083) +++ trunk/matplotlib/CXX/Exception.hxx 2010-01-16 22:07:53 UTC (rev 8084) @@ -34,216 +34,10 @@ // DAMAGE. // //----------------------------------------------------------------------------- - -#ifndef __CXX_Exception_h -#define __CXX_Exception_h - #include "CXX/WrapPython.h" -#include "CXX/Version.hxx" -#include "CXX/Config.hxx" -#include "CXX/IndirectPythonInterface.hxx" -#include <string> -#include <iostream> - -// This mimics the Python structure, in order to minimize confusion -namespace Py -{ - class ExtensionExceptionType; - - class Object; - - class Exception - { - public: - Exception( ExtensionExceptionType &exception, const std::string& reason ); - Exception( ExtensionExceptionType &exception, Object &reason ); - - explicit Exception () - {} - - Exception (const std::string& reason) - { - PyErr_SetString (Py::_Exc_RuntimeError(), reason.c_str()); - } - - Exception (PyObject* exception, const std::string& reason) - { - PyErr_SetString (exception, reason.c_str()); - } - - Exception (PyObject* exception, Object &reason); - - void clear() // clear the error - // technically but not philosophically const - { - PyErr_Clear(); - } - }; - - - // Abstract - class StandardError: public Exception - { - protected: - explicit StandardError() - {} - }; - - class LookupError: public StandardError - { - protected: - explicit LookupError() - {} - }; - - class ArithmeticError: public StandardError - { - protected: - explicit ArithmeticError() - {} - }; - - class EnvironmentError: public StandardError - { - protected: - explicit EnvironmentError() - {} - }; - - // Concrete - - class TypeError: public StandardError - { - public: - TypeError (const std::string& reason) - : StandardError() - { - PyErr_SetString (Py::_Exc_TypeError(),reason.c_str()); - } - }; - - class IndexError: public LookupError - { - public: - IndexError (const std::string& reason) - : LookupError() - { - PyErr_SetString (Py::_Exc_IndexError(), reason.c_str()); - } - }; - - class AttributeError: public StandardError - { - public: - AttributeError (const std::string& reason) - : StandardError() - { - PyErr_SetString (Py::_Exc_AttributeError(), reason.c_str()); - } - }; - - class NameError: public StandardError - { - public: - NameError (const std::string& reason) - : StandardError() - { - PyErr_SetString (Py::_Exc_NameError(), reason.c_str()); - } - }; - - class RuntimeError: public StandardError - { - public: - RuntimeError (const std::string& reason) - : StandardError() - { - PyErr_SetString (Py::_Exc_RuntimeError(), reason.c_str()); - } - }; - - class SystemError: public StandardError - { - public: - SystemError (const std::string& reason) - : StandardError() - { - PyErr_SetString (Py::_Exc_SystemError(),reason.c_str()); - } - }; - - class KeyError: public LookupError - { - public: - KeyError (const std::string& reason) - : LookupError() - { - PyErr_SetString (Py::_Exc_KeyError(),reason.c_str()); - } - }; - - - class ValueError: public StandardError - { - public: - ValueError (const std::string& reason) - : StandardError() - { - PyErr_SetString (Py::_Exc_ValueError(), reason.c_str()); - } - }; - - class OverflowError: public ArithmeticError - { - public: - OverflowError (const std::string& reason) - : ArithmeticError() - { - PyErr_SetString (Py::_Exc_OverflowError(), reason.c_str()); - } - }; - - class ZeroDivisionError: public ArithmeticError - { - public: - ZeroDivisionError (const std::string& reason) - : ArithmeticError() - { - PyErr_SetString (Py::_Exc_ZeroDivisionError(), reason.c_str()); - } - }; - - class FloatingPointError: public ArithmeticError - { - public: - FloatingPointError (const std::string& reason) - : ArithmeticError() - { - PyErr_SetString (Py::_Exc_FloatingPointError(), reason.c_str()); - } - }; - - class MemoryError: public StandardError - { - public: - MemoryError (const std::string& reason) - : StandardError() - { - PyErr_SetString (Py::_Exc_MemoryError(), reason.c_str()); - } - }; - - class SystemExit: public StandardError - { - public: - SystemExit (const std::string& reason) - : StandardError() - { - PyErr_SetString (Py::_Exc_SystemExit(),reason.c_str()); - } - }; - -}// Py - +#if PY_MAJOR_VERSION == 2 +#include "CXX/Python2/Exception.hxx" +#else +#include "CXX/Python3/Exception.hxx" #endif Modified: trunk/matplotlib/CXX/Extensions.hxx =================================================================== --- trunk/matplotlib/CXX/Extensions.hxx 2010-01-16 19:20:03 UTC (rev 8083) +++ trunk/matplotlib/CXX/Extensions.hxx 2010-01-16 22:07:53 UTC (rev 8084) @@ -34,895 +34,10 @@ // DAMAGE. // //----------------------------------------------------------------------------- - -#ifndef __CXX_Extensions__h -#define __CXX_Extensions__h - - -#ifdef _MSC_VER -// disable warning C4786: symbol greater than 255 character, -// okay to ignore -#pragma warning(disable: 4786) -#endif - #include "CXX/WrapPython.h" -#include "CXX/Version.hxx" -#include "CXX/Config.hxx" -#include "CXX/Objects.hxx" -extern "C" -{ - extern PyObject py_object_initializer; -} - -#include <vector> - -// std::map / hash_map selection and declarations ---------------------------- -#if !defined( PYCXX_USING_HASH_MAP ) - -#include <map> - +#if PY_MAJOR_VERSION == 2 +#include "CXX/Python2/Extensions.hxx" #else - -#if defined( __GNUC__) && !defined( _STLPORT_VERSION ) - #include <ext/hash_map> -#else - #include <hash_map> +#include "CXX/Python3/Extensions.hxx" #endif -#if defined( _STLPORT_VERSION ) - #define __PYCXX_HASHMAP_NAMESPACE std - using namespace std; -#elif defined ( _MSC_VER ) && !defined( __INTEL_COMPILER ) && !defined( __ICC ) && !defined( __ICL ) && !defined( __ECC ) - #define __PYCXX_HASHMAP_NAMESPACE stdext - using namespace stdext; -#elif defined( __INTEL_COMPILER ) || defined( __ICC ) || defined( __ICL ) || defined( __ECC ) - #define __PYCXX_HASHMAP_NAMESPACE stdext - using namespace stdext; -#elif defined( __GNUC__ ) - #define __PYCXX_HASHMAP_NAMESPACE __gnu_cxx - using namespace __gnu_cxx; -#else - #define __PYCXX_HASHMAP_NAMESPACE std - using namespace std; -#endif - -class __pycxx_str_hash_func -{ -public: - enum - { - // parameters for hash table - bucket_size = 4, // 0 < bucket_size - min_buckets = 8 // min_buckets = 2 ^^ N, 0 < N - }; - - // http://www.azillionmonkeys.com/qed/hash.html - size_t operator()( const std::string &str ) const - { - const unsigned char * data = reinterpret_cast<const unsigned char *>( str.c_str() ); - int len = (int)str.length(); - unsigned int hash = len; - unsigned int tmp; - int rem; - - if (len <= 0 || data == NULL) - return 0; - - rem = len & 3; - len >>= 2; - - /* Main loop */ - for (;len > 0; len--) - { - hash += (data[1] << 8) | data[0]; - tmp = (((data[3] << 8) | data[2]) << 11) ^ hash; - hash = (hash << 16) ^ tmp; - data += 2*sizeof (unsigned short); - hash += hash >> 11; - } - - /* Handle end cases */ - switch (rem) - { - case 3: hash += (data[1] << 8) | data[0]; - hash ^= hash << 16; - hash ^= data[sizeof (unsigned short)] << 18; - hash += hash >> 11; - break; - case 2: hash += (data[1] << 8) | data[0]; - hash ^= hash << 11; - hash += hash >> 17; - break; - case 1: hash += *data; - hash ^= hash << 10; - hash += hash >> 1; - } - - /* Force "avalanching" of final 127 bits */ - hash ^= hash << 3; - hash += hash >> 5; - hash ^= hash << 4; - hash += hash >> 17; - hash ^= hash << 25; - hash += hash >> 6; - - return hash; - } - - bool operator()(const std::string &str_1, const std::string &str_2) const - { - // test if str_1 ordered before str_2 - return str_1 < str_2; - } -}; -#endif // PYCXX_USING_HASH_MAP -// ---------------------------------------------------------------------- - -namespace Py -{ - class ExtensionModuleBase; - - // Make an Exception Type for use in raising custom exceptions - class ExtensionExceptionType : public Object - { - public: - ExtensionExceptionType(); - virtual ~ExtensionExceptionType(); - - // call init to create the type - void init( ExtensionModuleBase &module, const std::string& name, ExtensionExceptionType &parent ); - void init( ExtensionModuleBase &module, const std::string& name ); - }; - - - class MethodTable - { - public: - MethodTable(); - virtual ~MethodTable(); - - void add(const char* method_name, PyCFunction f, const char* doc="", int flag=1); - PyMethodDef* table(); - - protected: - std::vector<PyMethodDef> t; // accumulator of PyMethodDef's - PyMethodDef *mt; // Actual method table produced when full - - static PyMethodDef method (const char* method_name, PyCFunction f, int flags = 1, const char* doc=""); - - private: - // - // prevent the compiler generating these unwanted functions - // - MethodTable(const MethodTable& m); //unimplemented - void operator=(const MethodTable& m); //unimplemented - - }; // end class MethodTable - - extern "C" - { - typedef PyObject *(*method_varargs_call_handler_t)( PyObject *_self, PyObject *_args ); - typedef PyObject *(*method_keyword_call_handler_t)( PyObject *_self, PyObject *_args, PyObject *_dict ); - } - - template<class T> - class MethodDefExt : public PyMethodDef - { - public: - typedef Object (T::*method_varargs_function_t)( const Tuple &args ); - typedef Object (T::*method_keyword_function_t)( const Tuple &args, const Dict &kws ); - - MethodDefExt - ( - const char *_name, - method_varargs_function_t _function, - method_varargs_call_handler_t _handler, - const char *_doc - ) - { - ext_meth_def.ml_name = const_cast<char *>(_name); - ext_meth_def.ml_meth = _handler; - ext_meth_def.ml_flags = METH_VARARGS; - ext_meth_def.ml_doc = const_cast<char *>(_doc); - - ext_varargs_function = _function; - ext_keyword_function = NULL; - } - - MethodDefExt - ( - const char *_name, - method_keyword_function_t _function, - method_keyword_call_handler_t _handler, - const char *_doc - ) - { - ext_meth_def.ml_name = const_cast<char *>(_name); - ext_meth_def.ml_meth = method_varargs_call_handler_t( _handler ); - ext_meth_def.ml_flags = METH_VARARGS|METH_KEYWORDS; - ext_meth_def.ml_doc = const_cast<char *>(_doc); - - ext_varargs_function = NULL; - ext_keyword_function = _function; - } - - ~MethodDefExt() - {} - - PyMethodDef ext_meth_def; - method_varargs_function_t ext_varargs_function; - method_keyword_function_t ext_keyword_function; - }; - - class ExtensionModuleBase - { - public: - ExtensionModuleBase( const char *name ); - virtual ~ExtensionModuleBase(); - - Module module(void) const; // only valid after initialize() has been called - Dict moduleDictionary(void) const; // only valid after initialize() has been called - - virtual Object invoke_method_keyword( const std::string &_name, const Tuple &_args, const Dict &_keywords ) = 0; - virtual Object invoke_method_varargs( const std::string &_name, const Tuple &_args ) = 0; - - const std::string &name() const; - const std::string &fullName() const; - - protected: - // Initialize the module - void initialize( const char *module_doc ); - - const std::string module_name; - const std::string full_module_name; - MethodTable method_table; - - private: - - // - // prevent the compiler generating these unwanted functions - // - ExtensionModuleBase( const ExtensionModuleBase & ); //unimplemented - void operator=( const ExtensionModuleBase & ); //unimplemented - - }; - - extern "C" PyObject *method_keyword_call_handler( PyObject *_self_and_name_tuple, PyObject *_args, PyObject *_keywords ); - extern "C" PyObject *method_varargs_call_handler( PyObject *_self_and_name_tuple, PyObject *_args ); - extern "C" void do_not_dealloc( void * ); - - - template<TEMPLATE_TYPENAME T> - class ExtensionModule : public ExtensionModuleBase - { - public: - ExtensionModule( const char *name ) - : ExtensionModuleBase( name ) - {} - virtual ~ExtensionModule() - {} - - protected: - typedef Object (T::*method_varargs_function_t)( const Tuple &args ); - typedef Object (T::*method_keyword_function_t)( const Tuple &args, const Dict &kws ); - -#if defined( PYCXX_USING_HASH_MAP ) - typedef __PYCXX_HASHMAP_NAMESPACE::hash_map<std::string, MethodDefExt<T> *, __pycxx_str_hash_func> method_map_t; -#else - typedef std::map<std::string,MethodDefExt<T> *> method_map_t; -#endif - - static void add_varargs_method( const char *name, method_varargs_function_t function, const char *doc="" ) - { - method_map_t &mm = methods(); - - MethodDefExt<T> *method_definition = new MethodDefExt<T> - ( - name, - function, - method_varargs_call_handler, - doc - ); - - mm[std::string( name )] = method_definition; - } - - static void add_keyword_method( const char *name, method_keyword_function_t function, const char *doc="" ) - { - method_map_t &mm = methods(); - - MethodDefExt<T> *method_definition = new MethodDefExt<T> - ( - name, - function, - method_keyword_call_handler, - doc - ); - - mm[std::string( name )] = method_definition; - } - - void initialize( const char *module_doc="" ) - { - ExtensionModuleBase::initialize( module_doc ); - Dict dict( moduleDictionary() ); - - // - // put each of the methods into the modules dictionary - // so that we get called back at the function in T. - // - method_map_t &mm = methods(); - EXPLICIT_TYPENAME method_map_t::const_iterator i; - - for( i=mm.begin(); i != mm.end(); ++i ) - { - MethodDefExt<T> *method_definition = (*i).second; - - static PyObject *self = PyCObject_FromVoidPtr( this, do_not_dealloc ); - - Tuple args( 2 ); - args[0] = Object( self ); - args[1] = String( (*i).first ); - - PyObject *func = PyCFunction_New - ( - &method_definition->ext_meth_def, - new_reference_to( args ) - ); - - dict[ (*i).first ] = Object( func ); - } - } - - protected: // Tom Malcolmson reports that derived classes need access to these - - static method_map_t &methods(void) - { - static method_map_t *map_of_methods = NULL; - if( map_of_methods == NULL ) - map_of_methods = new method_map_t; - - return *map_of_methods; - } - - - // this invoke function must be called from within a try catch block - virtual Object invoke_method_keyword( const std::string &name, const Tuple &args, const Dict &keywords ) - { - method_map_t &mm = methods(); - MethodDefExt<T> *meth_def = mm[ name ]; - if( meth_def == NULL ) - { - std::string error_msg( "CXX - cannot invoke keyword method named " ); - error_msg += name; - throw RuntimeError( error_msg ); - } - - // cast up to the derived class - T *self = static_cast<T *>(this); - - return (self->*meth_def->ext_keyword_function)( args, keywords ); - } - - // this invoke function must be called from within a try catch block - virtual Object invoke_method_varargs( const std::string &name, const Tuple &args ) - { - method_map_t &mm = methods(); - MethodDefExt<T> *meth_def = mm[ name ]; - if( meth_def == NULL ) - { - std::string error_msg( "CXX - cannot invoke varargs method named " ); - error_msg += name; - throw RuntimeError( error_msg ); - } - - // cast up to the derived class - T *self = static_cast<T *>(this); - - return (self->*meth_def->ext_varargs_function)( args ); - } - - private: - // - // prevent the compiler generating these unwanted functions - // - ExtensionModule( const ExtensionModule<T> & ); //unimplemented - void operator=( const ExtensionModule<T> & ); //unimplemented - }; - - - class PythonType - { - public: - // if you define one sequence method you must define - // all of them except the assigns - - PythonType (size_t base_size, int itemsize, const char *default_name ); - virtual ~PythonType (); - - const char *getName () const; - const char *getDoc () const; - - PyTypeObject* type_object () const; - PythonType & name (const char* nam); - PythonType & doc (const char* d); - PythonType & dealloc(void (*f)(PyObject*)); - - PythonType & supportPrint(void); - PythonType & supportGetattr(void); - PythonType & supportSetattr(void); - PythonType & supportGetattro(void); - PythonType & supportSetattro(void); - PythonType & supportCompare(void); -#if PY_MAJOR_VERSION > 2 || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 1) - PythonType & supportRichCompare(void); -#endif - PythonType & supportRepr(void); - PythonType & supportStr(void); - PythonType & supportHash(void); - PythonType & supportCall(void); - PythonType & supportIter(void); - - PythonType & supportSequenceType(void); - PythonType & supportMappingType(void); - PythonType & supportNumberType(void); - PythonType & supportBufferType(void); - - protected: - PyTypeObject *table; - PySequenceMethods *sequence_table; - PyMappingMethods *mapping_table; - PyNumberMethods *number_table; - PyBufferProcs *buffer_table; - - void init_sequence(); - void init_mapping(); - void init_number(); - void init_buffer(); - - private: - // - // prevent the compiler generating these unwanted functions - // - PythonType (const PythonType& tb); // unimplemented - void operator=(const PythonType& t); // unimplemented - - }; // end of PythonType - - - - // Class PythonExtension is what you inherit from to create - // a new Python extension type. You give your class itself - // as the template paramter. - - // There are two ways that extension objects can get destroyed. - // 1. Their reference count goes to zero - // 2. Someone does an explicit delete on a pointer. - // In (1) the problem is to get the destructor called - // We register a special deallocator in the Python type object - // (see behaviors()) to do this. - // In (2) there is no problem, the dtor gets called. - - // PythonExtension does not use the usual Python heap allocator, - // instead using new/delete. We do the setting of the type object - // and reference count, usually done by PyObject_New, in the - // base class ctor. - - // This special deallocator does a delete on the pointer. - - - class PythonExtensionBase : public PyObject - { - public: - PythonExtensionBase(); - virtual ~PythonExtensionBase(); - - public: - virtual int print( FILE *, int ); - virtual Object getattr( const char * ) = 0; - virtual int setattr( const char *, const Object & ); - virtual Object getattro( const Object & ); - virtual int setattro( const Object &, const Object & ); - virtual int compare( const Object & ); - virtual Object rich_compare( const Object &, int op ); - virtual Object repr(); - virtual Object str(); - virtual long hash(); - virtual Object call( const Object &, const Object & ); - virtual Object iter(); - virtual PyObject* iternext(); - - // Sequence methods - virtual int sequence_length(); - virtual Object sequence_concat( const Object & ); - virtual Object sequence_repeat( Py_ssize_t ); - virtual Object sequence_item( Py_ssize_t ); - virtual Object sequence_slice( Py_ssize_t, Py_ssize_t ); - virtual int sequence_ass_item( Py_ssize_t, const Object & ); - virtual int sequence_ass_slice( Py_ssize_t, Py_ssize_t, const Object & ); - - // Mapping - virtual int mapping_length(); - virtual Object mapping_subscript( const Object & ); - virtual int mapping_ass_subscript( const Object &, const Object & ); - - // Number - virtual int number_nonzero(); - virtual Object number_negative(); - virtual Object number_positive(); - virtual Object number_absolute(); - virtual Object number_invert(); - virtual Object number_int(); - virtual Object number_float(); - virtual Object number_long(); - virtual Object number_oct(); - virtual Object number_hex(); - virtual Object number_add( const Object & ); - virtual Object number_subtract( const Object & ); - virtual Object number_multiply( const Object & ); - virtual Object number_divide( const Object & ); - virtual Object number_remainder( const Object & ); - virtual Object number_divmod( const Object & ); - virtual Object number_lshift( const Object & ); - virtual Object number_rshift( const Object & ); - virtual Object number_and( const Object & ); - virtual Object number_xor( const Object & ); - virtual Object number_or( const Object & ); - virtual Object number_power( const Object &, const Object & ); - - // Buffer - virtual Py_ssize_t buffer_getreadbuffer( Py_ssize_t, void** ); - virtual Py_ssize_t buffer_getwritebuffer( Py_ssize_t, void** ); - virtual Py_ssize_t buffer_getsegcount( Py_ssize_t* ); - - private: - void missing_method( void ); - static PyObject *method_call_handler( PyObject *self, PyObject *args ); - }; - - template<TEMPLATE_TYPENAME T> - class PythonExtension: public PythonExtensionBase - { - public: - static PyTypeObject* type_object() - { - return behaviors().type_object(); - } - - static int check( PyObject *p ) - { - // is p like me? - return p->ob_type == type_object(); - } - - static int check( const Object& ob ) - { - return check( ob.ptr()); - } - - - // - // every object needs getattr implemented - // to support methods - // - virtual Object getattr( const char *name ) - { - return getattr_methods( name ); - } - - protected: - explicit PythonExtension() - : PythonExtensionBase() - { - #ifdef PyObject_INIT - (void)PyObject_INIT( this, type_object() ); - #else - ob_refcnt = 1; - ob_type = type_object(); - #endif - - // every object must support getattr - behaviors().supportGetattr(); - } - - virtual ~PythonExtension() - {} - - static PythonType &behaviors() - { - static PythonType* p; - if( p == NULL ) - { -#if defined( _CPPRTTI ) || defined(__GNUG__) - const char *default_name = (typeid ( T )).name(); -#else - const char *default_name = "unknown"; -#endif - p = new PythonType( sizeof( T ), 0, default_name ); - p->dealloc( extension_object_deallocator ); - } - - return *p; - } - - - typedef Object (T::*method_varargs_function_t)( const Tuple &args ); - typedef Object (T::*method_keyword_function_t)( const Tuple &args, const Dict &kws ); - -#if defined( PYCXX_USING_HASH_MAP ) - typedef __PYCXX_HASHMAP_NAMESPACE::hash_map<std::string, MethodDefExt<T> *, __pycxx_str_hash_func> method_map_t; -#else - typedef std::map<std::string,MethodDefExt<T> *> method_map_t; -#endif - - // support the default attributes, __name__, __doc__ and methods - virtual Object getattr_default( const char *_name ) - { - std::string name( _name ); - - if( name == "__name__" && type_object()->tp_name != NULL ) - { - return Py::String( type_object()->tp_name ); - } - if( name == "__doc__" && type_object()->tp_doc != NULL ) - { - return Py::String( type_object()->tp_doc ); - } - -// trying to fake out being a class for help() -// else if( name == "__bases__" ) -// { -// return Py::Tuple(0); -// } -// else if( name == "__module__" ) -// { -// return Py::Nothing(); -// } -// else if( name == "__dict__" ) -// { -// return Py::Dict(); -// } - - return getattr_methods( _name ); - } - - // turn a name into function object - virtual Object getattr_methods( const char *_name ) - { - std::string name( _name ); - - method_map_t &mm = methods(); - - EXPLICIT_TYPENAME method_map_t::const_iterator i; - - if( name == "__methods__" ) - { - List methods; - - for( i = mm.begin(); i != mm.end(); ++i ) - methods.append( String( (*i).first ) ); - - return methods; - } - - // see if name exists and get entry with method - i = mm.find( name ); - if( i == mm.end() ) - throw AttributeError( name ); - - Tuple self( 2 ); - - self[0] = Object( this ); - self[1] = String( name ); - - MethodDefExt<T> *method_definition = i->second; - - PyObject *func = PyCFunction_New( &method_definition->ext_meth_def, self.ptr() ); - - return Object(func, true); - } - - static void add_varargs_method( const char *name, method_varargs_function_t function, const char *doc="" ) - { - method_map_t &mm = methods(); - - // check that all methods added are unique - EXPLICIT_TYPENAME method_map_t::const_iterator i; - i = mm.find( name ); - if( i != mm.end() ) - throw AttributeError( name ); - - MethodDefExt<T> *method_definition = new MethodDefExt<T> - ( - name, - function, - method_varargs_call_handler, - doc - ); - - mm[std::string( name )] = method_definition; - } - - static void add_keyword_method( const char *name, method_keyword_function_t function, const char *doc="" ) - { - method_map_t &mm = methods(); - - // check that all methods added are unique - EXPLICIT_TYPENAME method_map_t::const_iterator i; - i = mm.find( name ); - if( i != mm.end() ) - throw AttributeError( name ); - - MethodDefExt<T> *method_definition = new MethodDefExt<T> - ( - name, - function, - method_keyword_call_handler, - doc - ); - - mm[std::string( name )] = method_definition; - } - - private: - static method_map_t &methods(void) - { - static method_map_t *map_of_methods = NULL; - if( map_of_methods == NULL ) - map_of_methods = new method_map_t; - - return *map_of_methods; - } - - static PyObject *method_keyword_call_handler( PyObject *_self_and_name_tuple, PyObject *_args, PyObject *_keywords ) - { - try - { - Tuple self_and_name_tuple( _self_and_name_tuple ); - - PyObject *self_in_cobject = self_and_name_tuple[0].ptr(); - T *self = static_cast<T *>( self_in_cobject ); - - String name( self_and_name_tuple[1] ); - - method_map_t &mm = methods(); - - EXPLICIT_TYPENAME method_map_t::const_iterator i; - i = mm.find( name ); - if( i == mm.end() ) - return 0; - - MethodDefExt<T> *meth_def = i->second; - - Tuple args( _args ); - - // _keywords may be NULL so be careful about the way the dict is created - Dict keywords; - if( _keywords != NULL ) - keywords = Dict( _keywords ); - - Object result( (self->*meth_def->ext_keyword_function)( args, keywords ) ); - - return new_reference_to( result.ptr() ); - } - catch( Exception & ) - { - return 0; - } - } - - static PyObject *method_varargs_call_handler( PyObject *_self_and_name_tuple, PyObject *_args ) - { - try - { - Tuple self_and_name_tuple( _self_and_name_tuple ); - - PyObject *self_in_cobject = self_and_name_tuple[0].ptr(); - T *self = static_cast<T *>( self_in_cobject ); - - String name( self_and_name_tuple[1] ); - - method_map_t &mm = methods(); - - EXPLICIT_TYPENAME method_map_t::const_iterator i; - i = mm.find( name ); - if( i == mm.end() ) - return 0; - - MethodDefExt<T> *meth_def = i->second; - - Tuple args( _args ); - - Object result; - - // TMM: 7Jun'01 - Adding try & catch in case of STL debug-mode exceptions. - #ifdef _STLP_DEBUG - try - { - result = (self->*meth_def->ext_varargs_function)( args ); - } - catch (std::__stl_debug_exception) - { - // throw cxx::RuntimeError( sErrMsg ); - throw cxx::RuntimeError( "Error message not set yet." ); - } - #else - result = (self->*meth_def->ext_varargs_function)( args ); - #endif // _STLP_DEBUG - - return new_reference_to( result.ptr() ); - } - catch( Exception & ) - { - return 0; - } - } - - static void extension_object_deallocator ( PyObject* t ) - { - delete (T *)( t ); - } - - // - // prevent the compiler generating these unwanted functions - // - explicit PythonExtension( const PythonExtension<T>& other ); - void operator=( const PythonExtension<T>& rhs ); - }; - - // - // ExtensionObject<T> is an Object that will accept only T's. - // - template<TEMPLATE_TYPENAME T> - class ExtensionObject: public Object - { - public: - - explicit ExtensionObject ( PyObject *pyob ) - : Object( pyob ) - { - validate(); - } - - ExtensionObject( const ExtensionObject<T>& other ) - : Object( *other ) - { - validate(); - } - - ExtensionObject( const Object& other ) - : Object( *other ) - { - validate(); - } - - ExtensionObject& operator= ( const Object& rhs ) - { - return (*this = *rhs ); - } - - ExtensionObject& operator= ( PyObject* rhsp ) - { - if( ptr() == rhsp ) - return *this; - set( rhsp ); - return *this; - } - - virtual bool accepts ( PyObject *pyob ) const - { - return ( pyob && T::check( pyob )); - } - - // - // Obtain a pointer to the PythonExtension object - // - T *extensionObject(void) - { - return static_cast<T *>( ptr() ); - } - }; - -} // Namespace Py -// End of CXX_Extensions.h -#endif Modified: trunk/matplotlib/CXX/IndirectPythonInterface.cxx =================================================================== --- trunk/matplotlib/CXX/IndirectPythonInterface.cxx 2010-01-16 19:20:03 UTC (rev 8083) +++ trunk/matplotlib/CXX/IndirectPythonInterface.cxx 2010-01-16 22:07:53 UTC (rev 8084) @@ -34,564 +34,10 @@ // DAMAGE. // //----------------------------------------------------------------------------- +#include "CXX/WrapPython.h" -#include "CXX/IndirectPythonInterface.hxx" - -namespace Py -{ -bool _Buffer_Check( PyObject *op ) { return (op)->ob_type == _Buffer_Type(); } -bool _CFunction_Check( PyObject *op ) { return (op)->ob_type == _CFunction_Type(); } -bool _Class_Check( PyObject *op ) { return (op)->ob_type == _Class_Type(); } -bool _CObject_Check( PyObject *op ) { return (op)->ob_type == _CObject_Type(); } -bool _Complex_Check( PyObject *op ) { return (op)->ob_type == _Complex_Type(); } -bool _Dict_Check( PyObject *op ) { return (op)->ob_type == _Dict_Type(); } -bool _File_Check( PyObject *op ) { return (op)->ob_type == _File_Type(); } -bool _Float_Check( PyObject *op ) { return (op)->ob_type == _Float_Type(); } -bool _Function_Check( PyObject *op ) { return (op)->ob_type == _Function_Type(); } -bool _Instance_Check( PyObject *op ) { return (op)->ob_type == _Instance_Type(); } -bool _Boolean_Check( PyObject *op ) { return (op)->ob_type == _Bool_Type(); } -bool _Int_Check( PyObject *op ) { return (op)->ob_type == _Int_Type(); } -bool _List_Check( PyObject *o ) { return o->ob_type == _List_Type(); } -bool _Long_Check( PyObject *op ) { return (op)->ob_type == _Long_Type(); } -bool _Method_Check( PyObject *op ) { return (op)->ob_type == _Method_Type(); } -bool _Module_Check( PyObject *op ) { return (op)->ob_type == _Module_Type(); } -bool _Range_Check( PyObject *op ) { return (op)->ob_type == _Range_Type(); } -bool _Slice_Check( PyObject *op ) { return (op)->ob_type == _Slice_Type(); } -bool _String_Check( PyObject *o ) { return o->ob_type == _String_Type(); } -bool _TraceBack_Check( PyObject *v ) { return (v)->ob_type == _TraceBack_Type(); } -bool _Tuple_Check( PyObject *op ) { return (op)->ob_type == _Tuple_Type(); } -bool _Type_Check( PyObject *op ) { return (op)->ob_type == _Type_Type(); } - -#if PY_MAJOR_VERSION >= 2 -bool _Unicode_Check( PyObject *op ) { return (op)->ob_type == _Unicode_Type(); } -#endif - - - -#if defined(PY_WIN32_DELAYLOAD_PYTHON_DLL) - -#if defined(MS_WINDOWS) -#include <windows.h> - - -static HMODULE python_dll; - -static PyObject *ptr__Exc_ArithmeticError = NULL; -static PyObject *ptr__Exc_AssertionError = NULL; -static PyObject *ptr__Exc_AttributeError = NULL; -static PyObject *ptr__Exc_EnvironmentError = NULL; -static PyObject *ptr__Exc_EOFError = NULL; -static PyObject *ptr__Exc_Exception = NULL; -static PyObject *ptr__Exc_FloatingPointError = NULL; -static PyObject *ptr__Exc_ImportError = NULL; -static PyObject *ptr__Exc_IndexError = NULL; -static PyObject *ptr__Exc_IOError = NULL; -static PyObject *ptr__Exc_KeyboardInterrupt = NULL; -static PyObject *ptr__Exc_KeyError = NULL; -static PyObject *ptr__Exc_LookupError = NULL; -static PyObject *ptr__Exc_MemoryError = NULL; -static PyObject *ptr__Exc_MemoryErrorInst = NULL; -static PyObject *ptr__Exc_NameError = NULL; -static PyObject *ptr__Exc_NotImplementedError = NULL; -static PyObject *ptr__Exc_OSError = NULL; -static PyObject *ptr__Exc_OverflowError = NULL; -static PyObject *ptr__Exc_RuntimeError = NULL; -static PyObject *ptr__Exc_StandardError = NULL; -static PyObject *ptr__Exc_SyntaxError = NULL; -static PyObject *ptr__Exc_SystemError = NULL; -static PyObject *ptr__Exc_SystemExit = NULL; -static PyObject *ptr__Exc_TypeError = NULL; -static PyObject *ptr__Exc_ValueError = NULL; -static PyObject *ptr__Exc_ZeroDivisionError = NULL; - -#ifdef MS_WINDOWS -static PyObject *ptr__Exc_WindowsError = NULL; -#endif - -#if PY_MAJOR_VERSION >= 2 -static PyObject *ptr__Exc_IndentationError = NULL; -static PyObject *ptr__Exc_TabError = NULL; -static PyObject *ptr__Exc_UnboundLocalError = NULL; -static PyObject *ptr__Exc_UnicodeError = NULL; -#endif - -static PyObject *ptr__PyNone = NULL; - -static PyObject *ptr__PyFalse = NULL; -static PyObject *ptr__PyTrue = NULL; - -static PyTypeObject *ptr__Buffer_Type = NULL; -static PyTypeObject *ptr__CFunction_Type = NULL; -static PyTypeObject *ptr__Class_Type = NULL; -static PyTypeObject *ptr__CObject_Type = NULL; -static PyTypeObject *ptr__Complex_Type = NULL; -static PyTypeObject *ptr__Dict_Type = NULL; -static PyTypeObject *ptr__File_Type = NULL; -static PyTypeObject *ptr__Float_Type = NULL; -static PyTypeObject *ptr__Function_Type = NULL; -static PyTypeObject *ptr__Instance_Type = NULL; -static PyTypeObject *ptr__Int_Type = NULL; -static PyTypeObject *ptr__List_Type = NULL; -static PyTypeObject *ptr__Long_Type = NULL; -static PyTypeObject *ptr__Method_Type = NULL; -static PyTypeObject *ptr__Module_Type = NULL; -static PyTypeObject *ptr__Range_Type = NULL; -static PyTypeObject *ptr__Slice_Type = NULL; -static PyTypeObject *ptr__String_Type = NULL; -static PyTypeObject *ptr__TraceBack_Type = NULL; -static PyTypeObject *ptr__Tuple_Type = NULL; -static PyTypeObject *ptr__Type_Type = NULL; - -#if PY_MAJOR_VERSION >= 2 -static PyTypeObject *ptr__Unicode_Type = NULL; -#endif - -static int *ptr_Py_DebugFlag = NULL; -static int *ptr_Py_InteractiveFlag = NULL; -static int *ptr_Py_OptimizeFlag = NULL; -static int *ptr_Py_NoSiteFlag = NULL; -static int *ptr_Py_TabcheckFlag = NULL; -static int *ptr_Py_VerboseFlag = NULL; - -#if PY_MAJOR_VERSION >= 2 -static int *ptr_Py_UnicodeFlag = NULL; -#endif - -static char **ptr__Py_PackageContext = NULL; - -#ifdef Py_REF_DEBUG -int *ptr_Py_RefTotal; -#endif - - -//-------------------------------------------------------------------------------- -class GetAddressException -{ -public: - GetAddressException( const char *_name ) - : name( _name ) - {} - virtual ~GetAddressException() {} - const char *name; -}; - - -//-------------------------------------------------------------------------------- -static PyObject *GetPyObjectPointer_As_PyObjectPointer( const char *name ) -{ - FARPROC addr = GetProcAddress( python_dll, name ); - if( addr == NULL ) - throw GetAddressException( name ); - - return *(PyObject **)addr; -} - -static PyObject *GetPyObject_As_PyObjectPointer( const char *name ) -{ - FARPROC addr = GetProcAddress( python_dll, name ); - if( addr == NULL ) - throw GetAddressException( name ); - - return (PyObject *)addr; -} - -static PyTypeObject *GetPyTypeObjectPointer_As_PyTypeObjectPointer( const char *name ) -{ - FARPROC addr = GetProcAddress( python_dll, name ); - if( addr == NULL ) - throw GetAddressException( name ); - - return *(PyTypeObject **)addr; -} - -static PyTypeObject *GetPyTypeObject_As_PyTypeObjectPointer( const char *name ) -{ - FARPROC addr = GetProcAddress( python_dll, name ); - if( addr == NULL ) - throw GetAddressException( name ); - - return (PyTypeObject *)addr; -} - -static int *GetInt_as_IntPointer( const char *name ) -{ - FARPROC addr = GetProcAddress( python_dll, name ); - if( addr == NULL ) - throw GetAddressException( name ); - - return (int *)addr; -} - -static char **GetCharPointer_as_CharPointerPointer( const char *name ) -{ - FARPROC addr = GetProcAddress( python_dll, name ); - if( addr == NULL ) - throw GetAddressException( name ); - - return (char **)addr; -} - - -#ifdef _DEBUG -static const char python_dll_name_format[] = "PYTHON%1.1d%1.1d_D.DLL"; +#if PY_MAJOR_VERSION == 2 +#include "Python2/IndirectPythonInterface.cxx" #else -static const char python_dll_name_format[] = "PYTHON%1.1d%1.1d.DLL"; +#include "Python3/IndirectPythonInterface.cxx" #endif - -//-------------------------------------------------------------------------------- -bool InitialisePythonIndirectInterface() -{ - char python_dll_name[sizeof(python_dll_name_format)]; - - sprintf( python_dll_name, python_dll_name_format, PY_MAJOR_VERSION, PY_MINOR_VERSION ); - - python_dll = LoadLibrary( python_dll_name ); - if( python_dll == NULL ) - return false; - - try -{ -#ifdef Py_REF_DEBUG - ptr_Py_RefTotal = GetInt_as_IntPointer( "_Py_RefTotal" ); -#endif - ptr_Py_DebugFlag = GetInt_as_IntPointer( "Py_DebugFlag" ); - ptr_Py_InteractiveFlag = GetInt_as_IntPointer( "Py_InteractiveFlag" ); - ptr_Py_OptimizeFlag = GetInt_as_IntPointer( "Py_OptimizeFlag" ); - ptr_Py_NoSiteFlag = GetInt_as_IntPointer( "Py_NoSiteFlag" ); - ptr_Py_TabcheckFlag = GetInt_as_IntPointer( "Py_TabcheckFlag" ); - ptr_Py_VerboseFlag = GetInt_as_IntPointer( "Py_VerboseFlag" ); -#if PY_MAJOR_VERSION >= 2 - ptr_Py_UnicodeFlag = GetInt_as_IntPointer( "Py_UnicodeFlag" ); -#endif - ptr__Py_PackageContext = GetCharPointer_as_CharPointerPointer( "_Py_PackageContext" ); - - ptr__Exc_ArithmeticError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_ArithmeticError" ); - ptr__Exc_AssertionError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_AssertionError" ); - ptr__Exc_AttributeError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_AttributeError" ); - ptr__Exc_EnvironmentError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_EnvironmentError" ); - ptr__Exc_EOFError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_EOFError" ); - ptr__Exc_Exception = GetPyObjectPointer_As_PyObjectPointer( "PyExc_Exception" ); - ptr__Exc_FloatingPointError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_FloatingPointError" ); - ptr__Exc_ImportError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_ImportError" ); - ptr__Exc_IndexError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_IndexError" ); - ptr__Exc_IOError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_IOError" ); - ptr__Exc_KeyboardInterrupt = GetPyObjectPointer_As_PyObjectPointer( "PyExc_KeyboardInterrupt" ); - ptr__Exc_KeyError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_KeyError" ); - ptr__Exc_LookupError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_LookupError" ); - ptr__Exc_MemoryError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_MemoryError" ); - ptr__Exc_MemoryErrorInst = GetPyObjectPointer_As_PyObjectPointer( "PyExc_MemoryErrorInst" ); - ptr__Exc_NameError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_NameError" ); - ptr__Exc_NotImplementedError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_NotImplementedError" ); - ptr__Exc_OSError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_OSError" ); - ptr__Exc_OverflowError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_OverflowError" ); - ptr__Exc_RuntimeError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_RuntimeError" ); - ptr__Exc_StandardError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_StandardError" ); - ptr__Exc_SyntaxError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_SyntaxError" ); - ptr__Exc_SystemError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_SystemError" ); - ptr__Exc_SystemExit = GetPyObjectPointer_As_PyObjectPointer( "PyExc_SystemExit" ); - ptr__Exc_TypeError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_TypeError" ); - ptr__Exc_ValueError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_ValueError" ); -#ifdef MS_WINDOWS - ptr__Exc_WindowsError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_WindowsError" ); -#endif - ptr__Exc_ZeroDivisionError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_ZeroDivisionError" ); - -#if PY_MAJOR_VERSION >= 2 - ptr__Exc_IndentationError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_IndentationError" ); - ptr__Exc_TabError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_TabError" ); - ptr__Exc_UnboundLocalError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_UnboundLocalError" ); - ptr__Exc_UnicodeError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_UnicodeError" ); -#endif - ptr__PyNone = GetPyObject_As_PyObjectPointer( "_Py_NoneStruct" ); - - ptr__PyFalse = GetPyObject_As_PyObjectPointer( "_Py_ZeroStruct" ); - ptr__PyTrue = GetPyObject_As_PyObjectPointer( "_Py_TrueStruct" ); - - ptr__Buffer_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyBuffer_Type" ); - ptr__CFunction_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyCFunction_Type" ); - ptr__Class_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyClass_Type" ); - ptr__CObject_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyCObject_Type" ); - ptr__Complex_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyComplex_Type" ); - ptr__Dict_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyDict_Type" ); - ptr__File_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyFile_Type" ); - ptr__Float_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyFloat_Type" ); - ptr__Function_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyFunction_Type" ); - ptr__Instance_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyInstance_Type" ); - ptr__Int_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyInt_Type" ); - ptr__List_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyList_Type" ); - ptr__Long_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyLong_Type" ); - ptr__Method_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyMethod_Type" ); - ptr__Module_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyModule_Type" ); - ptr__Range_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyRange_Type" ); - ptr__Slice_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PySlice_Type" ); - ptr__String_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyString_Type" ); - ptr__TraceBack_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyTraceBack_Type" ); - ptr__Tuple_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyTuple_Type" ); - ptr__Type_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyType_Type" ); - -#if PY_MAJOR_VERSION >= 2 - ptr__Unicode_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyUnicode_Type" ); -#endif -} - catch( GetAddressException &e ) - { - OutputDebugString( python_dll_name ); - OutputDebugString( " does not contain symbol "); - OutputDebugString( e.name ); - OutputDebugString( "\n" ); - - return false; - } - - return true; -} - -// -// Wrap variables as function calls -// -PyObject * _Exc_ArithmeticError(){ return ptr__Exc_ArithmeticError; } -PyObject * _Exc_AssertionError(){ return ptr__Exc_AssertionError; } -PyObject * _Exc_AttributeError(){ return ptr__Exc_AttributeError; } -PyObject * _Exc_EnvironmentError(){ return ptr__Exc_EnvironmentError; } -PyObject * _Exc_EOFError() { return ptr__Exc_EOFError; } -PyObject * _Exc_Exception() { return ptr__Exc_Exception; } -PyObject * _Exc_FloatingPointError(){ return ptr__Exc_FloatingPointError; } -PyObject * _Exc_ImportError() { return ptr__Exc_ImportError; } -PyObject * _Exc_IndexError() { return ptr__Exc_IndexError; } -PyObject * _Exc_IOError() { return ptr__Exc_IOError; } -PyObject * _Exc_KeyboardInterrupt(){ return ptr__Exc_KeyboardInterrupt; } -PyObject * _Exc_KeyError() { return ptr__Exc_KeyError; } -PyObject * _Exc_LookupError() { return ptr__Exc_LookupError; } -PyObject * _Exc_MemoryError() { return ptr__Exc_MemoryError; } -PyObject * _Exc_MemoryErrorInst(){ return ptr__Exc_MemoryErrorInst; } -PyObject * _Exc_NameError() { return ptr__Exc_NameError; } -PyObject * _Exc_NotImplementedError(){ return ptr__Exc_NotImplementedError; } -PyObject * _Exc_OSError() { return ptr__Exc_OSError; } -PyObject * _Exc_OverflowError() { return ptr__Exc_OverflowError; } -PyObject * _Exc_RuntimeError() { return ptr__Exc_RuntimeError; } -PyObject * _Exc_StandardError() { return ptr__Exc_StandardError; } -PyObject * _Exc_SyntaxError() { return ptr__Exc_SyntaxError; } -PyObject * _Exc_SystemError() { return ptr__Exc_SystemError; } -PyObject * _Exc_SystemExit() { return ptr__Exc_SystemExit; } -PyObject * _Exc_TypeError() { return ptr__Exc_TypeError; } -PyObject * _Exc_ValueError() { return ptr__Exc_ValueError; } -#ifdef MS_WINDOWS -PyObject * _Exc_WindowsError() { return ptr__Exc_WindowsError; } -#endif -PyObject * _Exc_ZeroDivisionError(){ return ptr__Exc_ZeroDivisionError; } - -#if PY_MAJOR_VERSION >= 2 -PyObject * _Exc_IndentationError(){ return ptr__Exc_IndentationError; } -PyObject * _Exc_TabError() { return ptr__Exc_TabError; } -PyObject * _Exc_UnboundLocalError(){ return ptr__Exc_UnboundLocalError; } -PyObject * _Exc_UnicodeError() { return ptr__Exc_UnicodeError; } -#endif - -// -// wrap items in Object.h -// -PyObject * _None() { return ptr__PyNone; } - -PyObject * _False() { return ptr__PyFalse; } -PyObject * _True() { return ptr__PyTrue; } - -PyTypeObject * _Buffer_Type() { return ptr__Buffer_Type; } -PyTypeObject * _CFunction_Type(){ return ptr__CFunction_Type; } -PyTypeObject * _Class_Type() { return ptr__Class_Type; } -PyTypeObject * _CObject_Type() { return ptr__CObject_Type; } -PyTypeObject * _Complex_Type() { return ptr__Complex_Type; } -PyTypeObject * _Dict_Type() { return ptr__Dict_Type; } -PyTypeObject * _File_Type() { return ptr__File_Type; } -PyTypeObject * _Float_Type() { return ptr__Float_Type; } -PyTypeObject * _Function_Type() { return ptr__Function_Type; } -PyTypeObject * _Instance_Type() { return ptr__Instance_Type; } -PyTypeObject * _Bool_Type() { return ptr__Bool_Type; } -PyTypeObject * _Int_Type() { return ptr__Int_Type; } -PyTypeObject * _List_Type() { return ptr__List_Type; } -PyTypeObject * _Long_Type() { return ptr__Long_Type; } -PyTypeObject * _Method_Type() { return ptr__Method_Type; } -PyTypeObject * _Module_Type() { return ptr__Module_Type; } -PyTypeObject * _Range_Type() { return ptr__Range_Type; } -PyTypeObject * _Slice_Type() { return ptr__Slice_Type; } -PyTypeObject * _String_Type() { return ptr__String_Type; } -PyTypeObject * _TraceBack_Type(){ return ptr__TraceBack_Type; } -PyTypeObject * _Tuple_Type() { return ptr__Tuple_Type; } -PyTypeObject * _Type_Type() { return ptr__Type_Type; } - -#if PY_MAJOR_VERSION >= 2 -PyTypeObject * _Unicode_Type() { return ptr__Unicode_Type; } -#endif - -char *__Py_PackageContext() { return *ptr__Py_PackageContext; } - - -// -// wrap the Python Flag variables -// -int &_Py_DebugFlag() { return *ptr_Py_DebugFlag; } -int &_Py_InteractiveFlag() { return *ptr_Py_InteractiveFlag; } -int &_Py_OptimizeFlag() { return *ptr_Py_OptimizeFlag; } -int &_Py_NoSiteFlag() { return *ptr_Py_NoSiteFlag; } -int &_Py_TabcheckFlag() { return *ptr_Py_TabcheckFlag; } -int &_Py_VerboseFlag() { return *ptr_Py_VerboseFlag; } -#if PY_MAJOR_VERSION >= 2 -int &_Py_UnicodeFlag() { return *ptr_Py_UnicodeFlag; } -#endif - -void _XINCREF( PyObject *op ) -{ - // This function must match the contents of Py_XINCREF(op) - if( op == NULL ) - return; - -#ifdef Py_REF_DEBUG - (*ptr_Py_RefTotal)++; -#endif - (op)->ob_refcnt++; - -} - -void _XDECREF( PyObject *op ) -{ - // This function must match the contents of Py_XDECREF(op); - if( op == NULL ) - return; - -#ifdef P... [truncated message content] |
From: <jd...@us...> - 2010-01-16 23:00:41
|
Revision: 8086 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8086&view=rev Author: jdh2358 Date: 2010-01-16 23:00:27 +0000 (Sat, 16 Jan 2010) Log Message: ----------- move cxx6 Added Paths: ----------- trunk/matplotlib/CXX64/ Removed Paths: ------------- trunk/matplotlib/CXX/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2010-01-16 23:01:29
|
Revision: 8087 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8087&view=rev Author: jdh2358 Date: 2010-01-16 23:01:21 +0000 (Sat, 16 Jan 2010) Log Message: ----------- restore cxx5 Added Paths: ----------- trunk/matplotlib/CXX/ trunk/matplotlib/CXX/Config.hxx trunk/matplotlib/CXX/Exception.hxx trunk/matplotlib/CXX/Extensions.hxx trunk/matplotlib/CXX/IndirectPythonInterface.cxx trunk/matplotlib/CXX/IndirectPythonInterface.hxx trunk/matplotlib/CXX/Objects.hxx trunk/matplotlib/CXX/Version.hxx trunk/matplotlib/CXX/WrapPython.h trunk/matplotlib/CXX/cxx_extensions.cxx trunk/matplotlib/CXX/cxxextensions.c trunk/matplotlib/CXX/cxxsupport.cxx Added: trunk/matplotlib/CXX/Config.hxx =================================================================== --- trunk/matplotlib/CXX/Config.hxx (rev 0) +++ trunk/matplotlib/CXX/Config.hxx 2010-01-16 23:01:21 UTC (rev 8087) @@ -0,0 +1,134 @@ +//----------------------------------------------------------------------------- +// +// Copyright (c) 1998 - 2007, The Regents of the University of California +// Produced at the Lawrence Livermore National Laboratory +// All rights reserved. +// +// This file is part of PyCXX. For details,see http://cxx.sourceforge.net/. The +// full copyright notice is contained in the file COPYRIGHT located at the root +// of the PyCXX distribution. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the disclaimer below. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the disclaimer (as noted below) in the +// documentation and/or materials provided with the distribution. +// - Neither the name of the UC/LLNL nor the names of its contributors may be +// used to endorse or promote products derived from this software without +// specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OF THE UNIVERSITY OF +// CALIFORNIA, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +// DAMAGE. +// +//----------------------------------------------------------------------------- + +#ifndef __PyCXX_config_hh__ +#define __PyCXX_config_hh__ + +// +// Microsoft VC++ 6.0 has no traits +// +#if defined( _MSC_VER ) + +# define STANDARD_LIBRARY_HAS_ITERATOR_TRAITS 1 + +#elif defined( __GNUC__ ) +# if __GNUC__ >= 3 +# define STANDARD_LIBRARY_HAS_ITERATOR_TRAITS 1 +# else +# define STANDARD_LIBRARY_HAS_ITERATOR_TRAITS 0 +#endif + +// +// Assume all other compilers do +// +#else + +// Macros to deal with deficiencies in compilers +# define STANDARD_LIBRARY_HAS_ITERATOR_TRAITS 1 +#endif + +#if STANDARD_LIBRARY_HAS_ITERATOR_TRAITS +# define random_access_iterator_parent(itemtype) std::iterator<std::random_access_iterator_tag,itemtype,int> +#else +# define random_access_iterator_parent(itemtype) std::random_access_iterator<itemtype, int> +#endif + +// +// Which C++ standard is in use? +// +#if defined( _MSC_VER ) +# if _MSC_VER <= 1200 +// MSVC++ 6.0 +# define PYCXX_ISO_CPP_LIB 0 +# define STR_STREAM <strstream> +# define TEMPLATE_TYPENAME class +# else +# define PYCXX_ISO_CPP_LIB 1 +# define STR_STREAM <sstream> +# define TEMPLATE_TYPENAME typename +# endif +#elif defined( __GNUC__ ) +# if __GNUC__ >= 3 +# define PYCXX_ISO_CPP_LIB 1 +# define STR_STREAM <sstream> +# define TEMPLATE_TYPENAME typename +# else +# define PYCXX_ISO_CPP_LIB 0 +# define STR_STREAM <strstream> +# define TEMPLATE_TYPENAME class +# endif +#endif + +#if PYCXX_ISO_CPP_LIB +# define STR_STREAM <sstream> +# define OSTRSTREAM ostringstream +# define EXPLICIT_TYPENAME typename +# define EXPLICIT_CLASS class +# define TEMPLATE_TYPENAME typename +#else +# define STR_STREAM <strstream> +# define OSTRSTREAM ostrstream +# define EXPLICIT_TYPENAME +# define EXPLICIT_CLASS +# define TEMPLATE_TYPENAME class +#endif + +// before 2.5 Py_ssize_t was missing +#ifndef PY_MAJOR_VERSION +#error not defined PY_MAJOR_VERSION +#endif +#if PY_MAJOR_VERSION < 2 || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 5) +typedef int Py_ssize_t; +#endif + +// hash_map container usage selection +// 1) if PYCXX_USING_STD_MAP is defined PyCXX will be using std::map<> container +// implementation only. +// 2) if compilers are used other than MS Visual Studio (7.1+) or GCC 3.x +// STANDARD_LIBRARY_HAS_HASH_MAP must be defined before compilation to +// make PyCXX using hash_map container. +#if !defined( PYCXX_USING_STD_MAP ) + #if defined( _MSC_VER ) || defined( __INTEL_COMPILER ) || defined ( __ICC ) || (defined( __GNUC__ ) && ( __GNUC__ > 3 )) + # define PYCXX_USING_HASH_MAP + #else + # if defined( STANDARD_LIBRARY_HAS_HASH_MAP ) && !defined( PYCXX_USING_HASH_MAP ) + # define PYCXX_USING_HASH_MAP + # endif + #endif +#endif + +#endif // __PyCXX_config_hh__ Added: trunk/matplotlib/CXX/Exception.hxx =================================================================== --- trunk/matplotlib/CXX/Exception.hxx (rev 0) +++ trunk/matplotlib/CXX/Exception.hxx 2010-01-16 23:01:21 UTC (rev 8087) @@ -0,0 +1,249 @@ +//----------------------------------------------------------------------------- +// +// Copyright (c) 1998 - 2007, The Regents of the University of California +// Produced at the Lawrence Livermore National Laboratory +// All rights reserved. +// +// This file is part of PyCXX. For details,see http://cxx.sourceforge.net/. The +// full copyright notice is contained in the file COPYRIGHT located at the root +// of the PyCXX distribution. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the disclaimer below. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the disclaimer (as noted below) in the +// documentation and/or materials provided with the distribution. +// - Neither the name of the UC/LLNL nor the names of its contributors may be +// used to endorse or promote products derived from this software without +// specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OF THE UNIVERSITY OF +// CALIFORNIA, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +// DAMAGE. +// +//----------------------------------------------------------------------------- + +#ifndef __CXX_Exception_h +#define __CXX_Exception_h + +#include "CXX/WrapPython.h" +#include "CXX/Version.hxx" +#include "CXX/Config.hxx" +#include "CXX/IndirectPythonInterface.hxx" + +#include <string> +#include <iostream> + +// This mimics the Python structure, in order to minimize confusion +namespace Py +{ + class ExtensionExceptionType; + + class Object; + + class Exception + { + public: + Exception( ExtensionExceptionType &exception, const std::string& reason ); + Exception( ExtensionExceptionType &exception, Object &reason ); + + explicit Exception () + {} + + Exception (const std::string& reason) + { + PyErr_SetString (Py::_Exc_RuntimeError(), reason.c_str()); + } + + Exception (PyObject* exception, const std::string& reason) + { + PyErr_SetString (exception, reason.c_str()); + } + + Exception (PyObject* exception, Object &reason); + + void clear() // clear the error + // technically but not philosophically const + { + PyErr_Clear(); + } + }; + + + // Abstract + class StandardError: public Exception + { + protected: + explicit StandardError() + {} + }; + + class LookupError: public StandardError + { + protected: + explicit LookupError() + {} + }; + + class ArithmeticError: public StandardError + { + protected: + explicit ArithmeticError() + {} + }; + + class EnvironmentError: public StandardError + { + protected: + explicit EnvironmentError() + {} + }; + + // Concrete + + class TypeError: public StandardError + { + public: + TypeError (const std::string& reason) + : StandardError() + { + PyErr_SetString (Py::_Exc_TypeError(),reason.c_str()); + } + }; + + class IndexError: public LookupError + { + public: + IndexError (const std::string& reason) + : LookupError() + { + PyErr_SetString (Py::_Exc_IndexError(), reason.c_str()); + } + }; + + class AttributeError: public StandardError + { + public: + AttributeError (const std::string& reason) + : StandardError() + { + PyErr_SetString (Py::_Exc_AttributeError(), reason.c_str()); + } + }; + + class NameError: public StandardError + { + public: + NameError (const std::string& reason) + : StandardError() + { + PyErr_SetString (Py::_Exc_NameError(), reason.c_str()); + } + }; + + class RuntimeError: public StandardError + { + public: + RuntimeError (const std::string& reason) + : StandardError() + { + PyErr_SetString (Py::_Exc_RuntimeError(), reason.c_str()); + } + }; + + class SystemError: public StandardError + { + public: + SystemError (const std::string& reason) + : StandardError() + { + PyErr_SetString (Py::_Exc_SystemError(),reason.c_str()); + } + }; + + class KeyError: public LookupError + { + public: + KeyError (const std::string& reason) + : LookupError() + { + PyErr_SetString (Py::_Exc_KeyError(),reason.c_str()); + } + }; + + + class ValueError: public StandardError + { + public: + ValueError (const std::string& reason) + : StandardError() + { + PyErr_SetString (Py::_Exc_ValueError(), reason.c_str()); + } + }; + + class OverflowError: public ArithmeticError + { + public: + OverflowError (const std::string& reason) + : ArithmeticError() + { + PyErr_SetString (Py::_Exc_OverflowError(), reason.c_str()); + } + }; + + class ZeroDivisionError: public ArithmeticError + { + public: + ZeroDivisionError (const std::string& reason) + : ArithmeticError() + { + PyErr_SetString (Py::_Exc_ZeroDivisionError(), reason.c_str()); + } + }; + + class FloatingPointError: public ArithmeticError + { + public: + FloatingPointError (const std::string& reason) + : ArithmeticError() + { + PyErr_SetString (Py::_Exc_FloatingPointError(), reason.c_str()); + } + }; + + class MemoryError: public StandardError + { + public: + MemoryError (const std::string& reason) + : StandardError() + { + PyErr_SetString (Py::_Exc_MemoryError(), reason.c_str()); + } + }; + + class SystemExit: public StandardError + { + public: + SystemExit (const std::string& reason) + : StandardError() + { + PyErr_SetString (Py::_Exc_SystemExit(),reason.c_str()); + } + }; + +}// Py + +#endif Added: trunk/matplotlib/CXX/Extensions.hxx =================================================================== --- trunk/matplotlib/CXX/Extensions.hxx (rev 0) +++ trunk/matplotlib/CXX/Extensions.hxx 2010-01-16 23:01:21 UTC (rev 8087) @@ -0,0 +1,928 @@ +//----------------------------------------------------------------------------- +// +// Copyright (c) 1998 - 2007, The Regents of the University of California +// Produced at the Lawrence Livermore National Laboratory +// All rights reserved. +// +// This file is part of PyCXX. For details,see http://cxx.sourceforge.net/. The +// full copyright notice is contained in the file COPYRIGHT located at the root +// of the PyCXX distribution. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the disclaimer below. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the disclaimer (as noted below) in the +// documentation and/or materials provided with the distribution. +// - Neither the name of the UC/LLNL nor the names of its contributors may be +// used to endorse or promote products derived from this software without +// specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OF THE UNIVERSITY OF +// CALIFORNIA, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +// DAMAGE. +// +//----------------------------------------------------------------------------- + +#ifndef __CXX_Extensions__h +#define __CXX_Extensions__h + + +#ifdef _MSC_VER +// disable warning C4786: symbol greater than 255 character, +// okay to ignore +#pragma warning(disable: 4786) +#endif + +#include "CXX/WrapPython.h" +#include "CXX/Version.hxx" +#include "CXX/Config.hxx" +#include "CXX/Objects.hxx" + +extern "C" +{ + extern PyObject py_object_initializer; +} + +#include <vector> + +// std::map / hash_map selection and declarations ---------------------------- +#if !defined( PYCXX_USING_HASH_MAP ) + +#include <map> + +#else + +#if defined( __GNUC__) && !defined( _STLPORT_VERSION ) + #include <ext/hash_map> +#else + #include <hash_map> +#endif +#if defined( _STLPORT_VERSION ) + #define __PYCXX_HASHMAP_NAMESPACE std + using namespace std; +#elif defined ( _MSC_VER ) && !defined( __INTEL_COMPILER ) && !defined( __ICC ) && !defined( __ICL ) && !defined( __ECC ) + #define __PYCXX_HASHMAP_NAMESPACE stdext + using namespace stdext; +#elif defined( __INTEL_COMPILER ) || defined( __ICC ) || defined( __ICL ) || defined( __ECC ) + #define __PYCXX_HASHMAP_NAMESPACE stdext + using namespace stdext; +#elif defined( __GNUC__ ) + #define __PYCXX_HASHMAP_NAMESPACE __gnu_cxx + using namespace __gnu_cxx; +#else + #define __PYCXX_HASHMAP_NAMESPACE std + using namespace std; +#endif + +class __pycxx_str_hash_func +{ +public: + enum + { + // parameters for hash table + bucket_size = 4, // 0 < bucket_size + min_buckets = 8 // min_buckets = 2 ^^ N, 0 < N + }; + + // http://www.azillionmonkeys.com/qed/hash.html + size_t operator()( const std::string &str ) const + { + const unsigned char * data = reinterpret_cast<const unsigned char *>( str.c_str() ); + int len = (int)str.length(); + unsigned int hash = len; + unsigned int tmp; + int rem; + + if (len <= 0 || data == NULL) + return 0; + + rem = len & 3; + len >>= 2; + + /* Main loop */ + for (;len > 0; len--) + { + hash += (data[1] << 8) | data[0]; + tmp = (((data[3] << 8) | data[2]) << 11) ^ hash; + hash = (hash << 16) ^ tmp; + data += 2*sizeof (unsigned short); + hash += hash >> 11; + } + + /* Handle end cases */ + switch (rem) + { + case 3: hash += (data[1] << 8) | data[0]; + hash ^= hash << 16; + hash ^= data[sizeof (unsigned short)] << 18; + hash += hash >> 11; + break; + case 2: hash += (data[1] << 8) | data[0]; + hash ^= hash << 11; + hash += hash >> 17; + break; + case 1: hash += *data; + hash ^= hash << 10; + hash += hash >> 1; + } + + /* Force "avalanching" of final 127 bits */ + hash ^= hash << 3; + hash += hash >> 5; + hash ^= hash << 4; + hash += hash >> 17; + hash ^= hash << 25; + hash += hash >> 6; + + return hash; + } + + bool operator()(const std::string &str_1, const std::string &str_2) const + { + // test if str_1 ordered before str_2 + return str_1 < str_2; + } +}; +#endif // PYCXX_USING_HASH_MAP +// ---------------------------------------------------------------------- + +namespace Py +{ + class ExtensionModuleBase; + + // Make an Exception Type for use in raising custom exceptions + class ExtensionExceptionType : public Object + { + public: + ExtensionExceptionType(); + virtual ~ExtensionExceptionType(); + + // call init to create the type + void init( ExtensionModuleBase &module, const std::string& name, ExtensionExceptionType &parent ); + void init( ExtensionModuleBase &module, const std::string& name ); + }; + + + class MethodTable + { + public: + MethodTable(); + virtual ~MethodTable(); + + void add(const char* method_name, PyCFunction f, const char* doc="", int flag=1); + PyMethodDef* table(); + + protected: + std::vector<PyMethodDef> t; // accumulator of PyMethodDef's + PyMethodDef *mt; // Actual method table produced when full + + static PyMethodDef method (const char* method_name, PyCFunction f, int flags = 1, const char* doc=""); + + private: + // + // prevent the compiler generating these unwanted functions + // + MethodTable(const MethodTable& m); //unimplemented + void operator=(const MethodTable& m); //unimplemented + + }; // end class MethodTable + + extern "C" + { + typedef PyObject *(*method_varargs_call_handler_t)( PyObject *_self, PyObject *_args ); + typedef PyObject *(*method_keyword_call_handler_t)( PyObject *_self, PyObject *_args, PyObject *_dict ); + } + + template<class T> + class MethodDefExt : public PyMethodDef + { + public: + typedef Object (T::*method_varargs_function_t)( const Tuple &args ); + typedef Object (T::*method_keyword_function_t)( const Tuple &args, const Dict &kws ); + + MethodDefExt + ( + const char *_name, + method_varargs_function_t _function, + method_varargs_call_handler_t _handler, + const char *_doc + ) + { + ext_meth_def.ml_name = const_cast<char *>(_name); + ext_meth_def.ml_meth = _handler; + ext_meth_def.ml_flags = METH_VARARGS; + ext_meth_def.ml_doc = const_cast<char *>(_doc); + + ext_varargs_function = _function; + ext_keyword_function = NULL; + } + + MethodDefExt + ( + const char *_name, + method_keyword_function_t _function, + method_keyword_call_handler_t _handler, + const char *_doc + ) + { + ext_meth_def.ml_name = const_cast<char *>(_name); + ext_meth_def.ml_meth = method_varargs_call_handler_t( _handler ); + ext_meth_def.ml_flags = METH_VARARGS|METH_KEYWORDS; + ext_meth_def.ml_doc = const_cast<char *>(_doc); + + ext_varargs_function = NULL; + ext_keyword_function = _function; + } + + ~MethodDefExt() + {} + + PyMethodDef ext_meth_def; + method_varargs_function_t ext_varargs_function; + method_keyword_function_t ext_keyword_function; + }; + + class ExtensionModuleBase + { + public: + ExtensionModuleBase( const char *name ); + virtual ~ExtensionModuleBase(); + + Module module(void) const; // only valid after initialize() has been called + Dict moduleDictionary(void) const; // only valid after initialize() has been called + + virtual Object invoke_method_keyword( const std::string &_name, const Tuple &_args, const Dict &_keywords ) = 0; + virtual Object invoke_method_varargs( const std::string &_name, const Tuple &_args ) = 0; + + const std::string &name() const; + const std::string &fullName() const; + + protected: + // Initialize the module + void initialize( const char *module_doc ); + + const std::string module_name; + const std::string full_module_name; + MethodTable method_table; + + private: + + // + // prevent the compiler generating these unwanted functions + // + ExtensionModuleBase( const ExtensionModuleBase & ); //unimplemented + void operator=( const ExtensionModuleBase & ); //unimplemented + + }; + + extern "C" PyObject *method_keyword_call_handler( PyObject *_self_and_name_tuple, PyObject *_args, PyObject *_keywords ); + extern "C" PyObject *method_varargs_call_handler( PyObject *_self_and_name_tuple, PyObject *_args ); + extern "C" void do_not_dealloc( void * ); + + + template<TEMPLATE_TYPENAME T> + class ExtensionModule : public ExtensionModuleBase + { + public: + ExtensionModule( const char *name ) + : ExtensionModuleBase( name ) + {} + virtual ~ExtensionModule() + {} + + protected: + typedef Object (T::*method_varargs_function_t)( const Tuple &args ); + typedef Object (T::*method_keyword_function_t)( const Tuple &args, const Dict &kws ); + +#if defined( PYCXX_USING_HASH_MAP ) + typedef __PYCXX_HASHMAP_NAMESPACE::hash_map<std::string, MethodDefExt<T> *, __pycxx_str_hash_func> method_map_t; +#else + typedef std::map<std::string,MethodDefExt<T> *> method_map_t; +#endif + + static void add_varargs_method( const char *name, method_varargs_function_t function, const char *doc="" ) + { + method_map_t &mm = methods(); + + MethodDefExt<T> *method_definition = new MethodDefExt<T> + ( + name, + function, + method_varargs_call_handler, + doc + ); + + mm[std::string( name )] = method_definition; + } + + static void add_keyword_method( const char *name, method_keyword_function_t function, const char *doc="" ) + { + method_map_t &mm = methods(); + + MethodDefExt<T> *method_definition = new MethodDefExt<T> + ( + name, + function, + method_keyword_call_handler, + doc + ); + + mm[std::string( name )] = method_definition; + } + + void initialize( const char *module_doc="" ) + { + ExtensionModuleBase::initialize( module_doc ); + Dict dict( moduleDictionary() ); + + // + // put each of the methods into the modules dictionary + // so that we get called back at the function in T. + // + method_map_t &mm = methods(); + EXPLICIT_TYPENAME method_map_t::const_iterator i; + + for( i=mm.begin(); i != mm.end(); ++i ) + { + MethodDefExt<T> *method_definition = (*i).second; + + static PyObject *self = PyCObject_FromVoidPtr( this, do_not_dealloc ); + + Tuple args( 2 ); + args[0] = Object( self ); + args[1] = String( (*i).first ); + + PyObject *func = PyCFunction_New + ( + &method_definition->ext_meth_def, + new_reference_to( args ) + ); + + dict[ (*i).first ] = Object( func ); + } + } + + protected: // Tom Malcolmson reports that derived classes need access to these + + static method_map_t &methods(void) + { + static method_map_t *map_of_methods = NULL; + if( map_of_methods == NULL ) + map_of_methods = new method_map_t; + + return *map_of_methods; + } + + + // this invoke function must be called from within a try catch block + virtual Object invoke_method_keyword( const std::string &name, const Tuple &args, const Dict &keywords ) + { + method_map_t &mm = methods(); + MethodDefExt<T> *meth_def = mm[ name ]; + if( meth_def == NULL ) + { + std::string error_msg( "CXX - cannot invoke keyword method named " ); + error_msg += name; + throw RuntimeError( error_msg ); + } + + // cast up to the derived class + T *self = static_cast<T *>(this); + + return (self->*meth_def->ext_keyword_function)( args, keywords ); + } + + // this invoke function must be called from within a try catch block + virtual Object invoke_method_varargs( const std::string &name, const Tuple &args ) + { + method_map_t &mm = methods(); + MethodDefExt<T> *meth_def = mm[ name ]; + if( meth_def == NULL ) + { + std::string error_msg( "CXX - cannot invoke varargs method named " ); + error_msg += name; + throw RuntimeError( error_msg ); + } + + // cast up to the derived class + T *self = static_cast<T *>(this); + + return (self->*meth_def->ext_varargs_function)( args ); + } + + private: + // + // prevent the compiler generating these unwanted functions + // + ExtensionModule( const ExtensionModule<T> & ); //unimplemented + void operator=( const ExtensionModule<T> & ); //unimplemented + }; + + + class PythonType + { + public: + // if you define one sequence method you must define + // all of them except the assigns + + PythonType (size_t base_size, int itemsize, const char *default_name ); + virtual ~PythonType (); + + const char *getName () const; + const char *getDoc () const; + + PyTypeObject* type_object () const; + PythonType & name (const char* nam); + PythonType & doc (const char* d); + PythonType & dealloc(void (*f)(PyObject*)); + + PythonType & supportPrint(void); + PythonType & supportGetattr(void); + PythonType & supportSetattr(void); + PythonType & supportGetattro(void); + PythonType & supportSetattro(void); + PythonType & supportCompare(void); +#if PY_MAJOR_VERSION > 2 || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 1) + PythonType & supportRichCompare(void); +#endif + PythonType & supportRepr(void); + PythonType & supportStr(void); + PythonType & supportHash(void); + PythonType & supportCall(void); + PythonType & supportIter(void); + + PythonType & supportSequenceType(void); + PythonType & supportMappingType(void); + PythonType & supportNumberType(void); + PythonType & supportBufferType(void); + + protected: + PyTypeObject *table; + PySequenceMethods *sequence_table; + PyMappingMethods *mapping_table; + PyNumberMethods *number_table; + PyBufferProcs *buffer_table; + + void init_sequence(); + void init_mapping(); + void init_number(); + void init_buffer(); + + private: + // + // prevent the compiler generating these unwanted functions + // + PythonType (const PythonType& tb); // unimplemented + void operator=(const PythonType& t); // unimplemented + + }; // end of PythonType + + + + // Class PythonExtension is what you inherit from to create + // a new Python extension type. You give your class itself + // as the template paramter. + + // There are two ways that extension objects can get destroyed. + // 1. Their reference count goes to zero + // 2. Someone does an explicit delete on a pointer. + // In (1) the problem is to get the destructor called + // We register a special deallocator in the Python type object + // (see behaviors()) to do this. + // In (2) there is no problem, the dtor gets called. + + // PythonExtension does not use the usual Python heap allocator, + // instead using new/delete. We do the setting of the type object + // and reference count, usually done by PyObject_New, in the + // base class ctor. + + // This special deallocator does a delete on the pointer. + + + class PythonExtensionBase : public PyObject + { + public: + PythonExtensionBase(); + virtual ~PythonExtensionBase(); + + public: + virtual int print( FILE *, int ); + virtual Object getattr( const char * ) = 0; + virtual int setattr( const char *, const Object & ); + virtual Object getattro( const Object & ); + virtual int setattro( const Object &, const Object & ); + virtual int compare( const Object & ); + virtual Object rich_compare( const Object &, int op ); + virtual Object repr(); + virtual Object str(); + virtual long hash(); + virtual Object call( const Object &, const Object & ); + virtual Object iter(); + virtual PyObject* iternext(); + + // Sequence methods + virtual int sequence_length(); + virtual Object sequence_concat( const Object & ); + virtual Object sequence_repeat( Py_ssize_t ); + virtual Object sequence_item( Py_ssize_t ); + virtual Object sequence_slice( Py_ssize_t, Py_ssize_t ); + virtual int sequence_ass_item( Py_ssize_t, const Object & ); + virtual int sequence_ass_slice( Py_ssize_t, Py_ssize_t, const Object & ); + + // Mapping + virtual int mapping_length(); + virtual Object mapping_subscript( const Object & ); + virtual int mapping_ass_subscript( const Object &, const Object & ); + + // Number + virtual int number_nonzero(); + virtual Object number_negative(); + virtual Object number_positive(); + virtual Object number_absolute(); + virtual Object number_invert(); + virtual Object number_int(); + virtual Object number_float(); + virtual Object number_long(); + virtual Object number_oct(); + virtual Object number_hex(); + virtual Object number_add( const Object & ); + virtual Object number_subtract( const Object & ); + virtual Object number_multiply( const Object & ); + virtual Object number_divide( const Object & ); + virtual Object number_remainder( const Object & ); + virtual Object number_divmod( const Object & ); + virtual Object number_lshift( const Object & ); + virtual Object number_rshift( const Object & ); + virtual Object number_and( const Object & ); + virtual Object number_xor( const Object & ); + virtual Object number_or( const Object & ); + virtual Object number_power( const Object &, const Object & ); + + // Buffer + virtual Py_ssize_t buffer_getreadbuffer( Py_ssize_t, void** ); + virtual Py_ssize_t buffer_getwritebuffer( Py_ssize_t, void** ); + virtual Py_ssize_t buffer_getsegcount( Py_ssize_t* ); + + private: + void missing_method( void ); + static PyObject *method_call_handler( PyObject *self, PyObject *args ); + }; + + template<TEMPLATE_TYPENAME T> + class PythonExtension: public PythonExtensionBase + { + public: + static PyTypeObject* type_object() + { + return behaviors().type_object(); + } + + static int check( PyObject *p ) + { + // is p like me? + return p->ob_type == type_object(); + } + + static int check( const Object& ob ) + { + return check( ob.ptr()); + } + + + // + // every object needs getattr implemented + // to support methods + // + virtual Object getattr( const char *name ) + { + return getattr_methods( name ); + } + + protected: + explicit PythonExtension() + : PythonExtensionBase() + { + #ifdef PyObject_INIT + (void)PyObject_INIT( this, type_object() ); + #else + ob_refcnt = 1; + ob_type = type_object(); + #endif + + // every object must support getattr + behaviors().supportGetattr(); + } + + virtual ~PythonExtension() + {} + + static PythonType &behaviors() + { + static PythonType* p; + if( p == NULL ) + { +#if defined( _CPPRTTI ) || defined(__GNUG__) + const char *default_name = (typeid ( T )).name(); +#else + const char *default_name = "unknown"; +#endif + p = new PythonType( sizeof( T ), 0, default_name ); + p->dealloc( extension_object_deallocator ); + } + + return *p; + } + + + typedef Object (T::*method_varargs_function_t)( const Tuple &args ); + typedef Object (T::*method_keyword_function_t)( const Tuple &args, const Dict &kws ); + +#if defined( PYCXX_USING_HASH_MAP ) + typedef __PYCXX_HASHMAP_NAMESPACE::hash_map<std::string, MethodDefExt<T> *, __pycxx_str_hash_func> method_map_t; +#else + typedef std::map<std::string,MethodDefExt<T> *> method_map_t; +#endif + + // support the default attributes, __name__, __doc__ and methods + virtual Object getattr_default( const char *_name ) + { + std::string name( _name ); + + if( name == "__name__" && type_object()->tp_name != NULL ) + { + return Py::String( type_object()->tp_name ); + } + if( name == "__doc__" && type_object()->tp_doc != NULL ) + { + return Py::String( type_object()->tp_doc ); + } + +// trying to fake out being a class for help() +// else if( name == "__bases__" ) +// { +// return Py::Tuple(0); +// } +// else if( name == "__module__" ) +// { +// return Py::Nothing(); +// } +// else if( name == "__dict__" ) +// { +// return Py::Dict(); +// } + + return getattr_methods( _name ); + } + + // turn a name into function object + virtual Object getattr_methods( const char *_name ) + { + std::string name( _name ); + + method_map_t &mm = methods(); + + EXPLICIT_TYPENAME method_map_t::const_iterator i; + + if( name == "__methods__" ) + { + List methods; + + for( i = mm.begin(); i != mm.end(); ++i ) + methods.append( String( (*i).first ) ); + + return methods; + } + + // see if name exists and get entry with method + i = mm.find( name ); + if( i == mm.end() ) + throw AttributeError( name ); + + Tuple self( 2 ); + + self[0] = Object( this ); + self[1] = String( name ); + + MethodDefExt<T> *method_definition = i->second; + + PyObject *func = PyCFunction_New( &method_definition->ext_meth_def, self.ptr() ); + + return Object(func, true); + } + + static void add_varargs_method( const char *name, method_varargs_function_t function, const char *doc="" ) + { + method_map_t &mm = methods(); + + // check that all methods added are unique + EXPLICIT_TYPENAME method_map_t::const_iterator i; + i = mm.find( name ); + if( i != mm.end() ) + throw AttributeError( name ); + + MethodDefExt<T> *method_definition = new MethodDefExt<T> + ( + name, + function, + method_varargs_call_handler, + doc + ); + + mm[std::string( name )] = method_definition; + } + + static void add_keyword_method( const char *name, method_keyword_function_t function, const char *doc="" ) + { + method_map_t &mm = methods(); + + // check that all methods added are unique + EXPLICIT_TYPENAME method_map_t::const_iterator i; + i = mm.find( name ); + if( i != mm.end() ) + throw AttributeError( name ); + + MethodDefExt<T> *method_definition = new MethodDefExt<T> + ( + name, + function, + method_keyword_call_handler, + doc + ); + + mm[std::string( name )] = method_definition; + } + + private: + static method_map_t &methods(void) + { + static method_map_t *map_of_methods = NULL; + if( map_of_methods == NULL ) + map_of_methods = new method_map_t; + + return *map_of_methods; + } + + static PyObject *method_keyword_call_handler( PyObject *_self_and_name_tuple, PyObject *_args, PyObject *_keywords ) + { + try + { + Tuple self_and_name_tuple( _self_and_name_tuple ); + + PyObject *self_in_cobject = self_and_name_tuple[0].ptr(); + T *self = static_cast<T *>( self_in_cobject ); + + String name( self_and_name_tuple[1] ); + + method_map_t &mm = methods(); + + EXPLICIT_TYPENAME method_map_t::const_iterator i; + i = mm.find( name ); + if( i == mm.end() ) + return 0; + + MethodDefExt<T> *meth_def = i->second; + + Tuple args( _args ); + + // _keywords may be NULL so be careful about the way the dict is created + Dict keywords; + if( _keywords != NULL ) + keywords = Dict( _keywords ); + + Object result( (self->*meth_def->ext_keyword_function)( args, keywords ) ); + + return new_reference_to( result.ptr() ); + } + catch( Exception & ) + { + return 0; + } + } + + static PyObject *method_varargs_call_handler( PyObject *_self_and_name_tuple, PyObject *_args ) + { + try + { + Tuple self_and_name_tuple( _self_and_name_tuple ); + + PyObject *self_in_cobject = self_and_name_tuple[0].ptr(); + T *self = static_cast<T *>( self_in_cobject ); + + String name( self_and_name_tuple[1] ); + + method_map_t &mm = methods(); + + EXPLICIT_TYPENAME method_map_t::const_iterator i; + i = mm.find( name ); + if( i == mm.end() ) + return 0; + + MethodDefExt<T> *meth_def = i->second; + + Tuple args( _args ); + + Object result; + + // TMM: 7Jun'01 - Adding try & catch in case of STL debug-mode exceptions. + #ifdef _STLP_DEBUG + try + { + result = (self->*meth_def->ext_varargs_function)( args ); + } + catch (std::__stl_debug_exception) + { + // throw cxx::RuntimeError( sErrMsg ); + throw cxx::RuntimeError( "Error message not set yet." ); + } + #else + result = (self->*meth_def->ext_varargs_function)( args ); + #endif // _STLP_DEBUG + + return new_reference_to( result.ptr() ); + } + catch( Exception & ) + { + return 0; + } + } + + static void extension_object_deallocator ( PyObject* t ) + { + delete (T *)( t ); + } + + // + // prevent the compiler generating these unwanted functions + // + explicit PythonExtension( const PythonExtension<T>& other ); + void operator=( const PythonExtension<T>& rhs ); + }; + + // + // ExtensionObject<T> is an Object that will accept only T's. + // + template<TEMPLATE_TYPENAME T> + class ExtensionObject: public Object + { + public: + + explicit ExtensionObject ( PyObject *pyob ) + : Object( pyob ) + { + validate(); + } + + ExtensionObject( const ExtensionObject<T>& other ) + : Object( *other ) + { + validate(); + } + + ExtensionObject( const Object& other ) + : Object( *other ) + { + validate(); + } + + ExtensionObject& operator= ( const Object& rhs ) + { + return (*this = *rhs ); + } + + ExtensionObject& operator= ( PyObject* rhsp ) + { + if( ptr() == rhsp ) + return *this; + set( rhsp ); + return *this; + } + + virtual bool accepts ( PyObject *pyob ) const + { + return ( pyob && T::check( pyob )); + } + + // + // Obtain a pointer to the PythonExtension object + // + T *extensionObject(void) + { + return static_cast<T *>( ptr() ); + } + }; + +} // Namespace Py +// End of CXX_Extensions.h +#endif Added: trunk/matplotlib/CXX/IndirectPythonInterface.cxx =================================================================== --- trunk/matplotlib/CXX/IndirectPythonInterface.cxx (rev 0) +++ trunk/matplotlib/CXX/IndirectPythonInterface.cxx 2010-01-16 23:01:21 UTC (rev 8087) @@ -0,0 +1,597 @@ +//----------------------------------------------------------------------------- +// +// Copyright (c) 1998 - 2007, The Regents of the University of California +// Produced at the Lawrence Livermore National Laboratory +// All rights reserved. +// +// This file is part of PyCXX. For details,see http://cxx.sourceforge.net/. The +// full copyright notice is contained in the file COPYRIGHT located at the root +// of the PyCXX distribution. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, +// this list of conditions and the disclaimer below. +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the disclaimer (as noted below) in the +// documentation and/or materials provided with the distribution. +// - Neither the name of the UC/LLNL nor the names of its contributors may be +// used to endorse or promote products derived from this software without +// specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OF THE UNIVERSITY OF +// CALIFORNIA, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +// DAMAGE. +// +//----------------------------------------------------------------------------- + +#include "CXX/IndirectPythonInterface.hxx" + +namespace Py +{ +bool _Buffer_Check( PyObject *op ) { return (op)->ob_type == _Buffer_Type(); } +bool _CFunction_Check( PyObject *op ) { return (op)->ob_type == _CFunction_Type(); } +bool _Class_Check( PyObject *op ) { return (op)->ob_type == _Class_Type(); } +bool _CObject_Check( PyObject *op ) { return (op)->ob_type == _CObject_Type(); } +bool _Complex_Check( PyObject *op ) { return (op)->ob_type == _Complex_Type(); } +bool _Dict_Check( PyObject *op ) { return (op)->ob_type == _Dict_Type(); } +bool _File_Check( PyObject *op ) { return (op)->ob_type == _File_Type(); } +bool _Float_Check( PyObject *op ) { return (op)->ob_type == _Float_Type(); } +bool _Function_Check( PyObject *op ) { return (op)->ob_type == _Function_Type(); } +bool _Instance_Check( PyObject *op ) { return (op)->ob_type == _Instance_Type(); } +bool _Boolean_Check( PyObject *op ) { return (op)->ob_type == _Bool_Type(); } +bool _Int_Check( PyObject *op ) { return (op)->ob_type == _Int_Type(); } +bool _List_Check( PyObject *o ) { return o->ob_type == _List_Type(); } +bool _Long_Check( PyObject *op ) { return (op)->ob_type == _Long_Type(); } +bool _Method_Check( PyObject *op ) { return (op)->ob_type == _Method_Type(); } +bool _Module_Check( PyObject *op ) { return (op)->ob_type == _Module_Type(); } +bool _Range_Check( PyObject *op ) { return (op)->ob_type == _Range_Type(); } +bool _Slice_Check( PyObject *op ) { return (op)->ob_type == _Slice_Type(); } +bool _String_Check( PyObject *o ) { return o->ob_type == _String_Type(); } +bool _TraceBack_Check( PyObject *v ) { return (v)->ob_type == _TraceBack_Type(); } +bool _Tuple_Check( PyObject *op ) { return (op)->ob_type == _Tuple_Type(); } +bool _Type_Check( PyObject *op ) { return (op)->ob_type == _Type_Type(); } + +#if PY_MAJOR_VERSION >= 2 +bool _Unicode_Check( PyObject *op ) { return (op)->ob_type == _Unicode_Type(); } +#endif + + + +#if defined(PY_WIN32_DELAYLOAD_PYTHON_DLL) + +#if defined(MS_WINDOWS) +#include <windows.h> + + +static HMODULE python_dll; + +static PyObject *ptr__Exc_ArithmeticError = NULL; +static PyObject *ptr__Exc_AssertionError = NULL; +static PyObject *ptr__Exc_AttributeError = NULL; +static PyObject *ptr__Exc_EnvironmentError = NULL; +static PyObject *ptr__Exc_EOFError = NULL; +static PyObject *ptr__Exc_Exception = NULL; +static PyObject *ptr__Exc_FloatingPointError = NULL; +static PyObject *ptr__Exc_ImportError = NULL; +static PyObject *ptr__Exc_IndexError = NULL; +static PyObject *ptr__Exc_IOError = NULL; +static PyObject *ptr__Exc_KeyboardInterrupt = NULL; +static PyObject *ptr__Exc_KeyError = NULL; +static PyObject *ptr__Exc_LookupError = NULL; +static PyObject *ptr__Exc_MemoryError = NULL; +static PyObject *ptr__Exc_MemoryErrorInst = NULL; +static PyObject *ptr__Exc_NameError = NULL; +static PyObject *ptr__Exc_NotImplementedError = NULL; +static PyObject *ptr__Exc_OSError = NULL; +static PyObject *ptr__Exc_OverflowError = NULL; +static PyObject *ptr__Exc_RuntimeError = NULL; +static PyObject *ptr__Exc_StandardError = NULL; +static PyObject *ptr__Exc_SyntaxError = NULL; +static PyObject *ptr__Exc_SystemError = NULL; +static PyObject *ptr__Exc_SystemExit = NULL; +static PyObject *ptr__Exc_TypeError = NULL; +static PyObject *ptr__Exc_ValueError = NULL; +static PyObject *ptr__Exc_ZeroDivisionError = NULL; + +#ifdef MS_WINDOWS +static PyObject *ptr__Exc_WindowsError = NULL; +#endif + +#if PY_MAJOR_VERSION >= 2 +static PyObject *ptr__Exc_IndentationError = NULL; +static PyObject *ptr__Exc_TabError = NULL; +static PyObject *ptr__Exc_UnboundLocalError = NULL; +static PyObject *ptr__Exc_UnicodeError = NULL; +#endif + +static PyObject *ptr__PyNone = NULL; + +static PyObject *ptr__PyFalse = NULL; +static PyObject *ptr__PyTrue = NULL; + +static PyTypeObject *ptr__Buffer_Type = NULL; +static PyTypeObject *ptr__CFunction_Type = NULL; +static PyTypeObject *ptr__Class_Type = NULL; +static PyTypeObject *ptr__CObject_Type = NULL; +static PyTypeObject *ptr__Complex_Type = NULL; +static PyTypeObject *ptr__Dict_Type = NULL; +static PyTypeObject *ptr__File_Type = NULL; +static PyTypeObject *ptr__Float_Type = NULL; +static PyTypeObject *ptr__Function_Type = NULL; +static PyTypeObject *ptr__Instance_Type = NULL; +static PyTypeObject *ptr__Int_Type = NULL; +static PyTypeObject *ptr__List_Type = NULL; +static PyTypeObject *ptr__Long_Type = NULL; +static PyTypeObject *ptr__Method_Type = NULL; +static PyTypeObject *ptr__Module_Type = NULL; +static PyTypeObject *ptr__Range_Type = NULL; +static PyTypeObject *ptr__Slice_Type = NULL; +static PyTypeObject *ptr__String_Type = NULL; +static PyTypeObject *ptr__TraceBack_Type = NULL; +static PyTypeObject *ptr__Tuple_Type = NULL; +static PyTypeObject *ptr__Type_Type = NULL; + +#if PY_MAJOR_VERSION >= 2 +static PyTypeObject *ptr__Unicode_Type = NULL; +#endif + +static int *ptr_Py_DebugFlag = NULL; +static int *ptr_Py_InteractiveFlag = NULL; +static int *ptr_Py_OptimizeFlag = NULL; +static int *ptr_Py_NoSiteFlag = NULL; +static int *ptr_Py_TabcheckFlag = NULL; +static int *ptr_Py_VerboseFlag = NULL; + +#if PY_MAJOR_VERSION >= 2 +static int *ptr_Py_UnicodeFlag = NULL; +#endif + +static char **ptr__Py_PackageContext = NULL; + +#ifdef Py_REF_DEBUG +int *ptr_Py_RefTotal; +#endif + + +//-------------------------------------------------------------------------------- +class GetAddressException +{ +public: + GetAddressException( const char *_name ) + : name( _name ) + {} + virtual ~GetAddressException() {} + const char *name; +}; + + +//-------------------------------------------------------------------------------- +static PyObject *GetPyObjectPointer_As_PyObjectPointer( const char *name ) +{ + FARPROC addr = GetProcAddress( python_dll, name ); + if( addr == NULL ) + throw GetAddressException( name ); + + return *(PyObject **)addr; +} + +static PyObject *GetPyObject_As_PyObjectPointer( const char *name ) +{ + FARPROC addr = GetProcAddress( python_dll, name ); + if( addr == NULL ) + throw GetAddressException( name ); + + return (PyObject *)addr; +} + +static PyTypeObject *GetPyTypeObjectPointer_As_PyTypeObjectPointer( const char *name ) +{ + FARPROC addr = GetProcAddress( python_dll, name ); + if( addr == NULL ) + throw GetAddressException( name ); + + return *(PyTypeObject **)addr; +} + +static PyTypeObject *GetPyTypeObject_As_PyTypeObjectPointer( const char *name ) +{ + FARPROC addr = GetProcAddress( python_dll, name ); + if( addr == NULL ) + throw GetAddressException( name ); + + return (PyTypeObject *)addr; +} + +static int *GetInt_as_IntPointer( const char *name ) +{ + FARPROC addr = GetProcAddress( python_dll, name ); + if( addr == NULL ) + throw GetAddressException( name ); + + return (int *)addr; +} + +static char **GetCharPointer_as_CharPointerPointer( const char *name ) +{ + FARPROC addr = GetProcAddress( python_dll, name ); + if( addr == NULL ) + throw GetAddressException( name ); + + return (char **)addr; +} + + +#ifdef _DEBUG +static const char python_dll_name_format[] = "PYTHON%1.1d%1.1d_D.DLL"; +#else +static const char python_dll_name_format[] = "PYTHON%1.1d%1.1d.DLL"; +#endif + +//-------------------------------------------------------------------------------- +bool InitialisePythonIndirectInterface() +{ + char python_dll_name[sizeof(python_dll_name_format)]; + + sprintf( python_dll_name, python_dll_name_format, PY_MAJOR_VERSION, PY_MINOR_VERSION ); + + python_dll = LoadLibrary( python_dll_name ); + if( python_dll == NULL ) + return false; + + try +{ +#ifdef Py_REF_DEBUG + ptr_Py_RefTotal = GetInt_as_IntPointer( "_Py_RefTotal" ); +#endif + ptr_Py_DebugFlag = GetInt_as_IntPointer( "Py_DebugFlag" ); + ptr_Py_InteractiveFlag = GetInt_as_IntPointer( "Py_InteractiveFlag" ); + ptr_Py_OptimizeFlag = GetInt_as_IntPointer( "Py_OptimizeFlag" ); + ptr_Py_NoSiteFlag = GetInt_as_IntPointer( "Py_NoSiteFlag" ); + ptr_Py_TabcheckFlag = GetInt_as_IntPointer( "Py_TabcheckFlag" ); + ptr_Py_VerboseFlag = GetInt_as_IntPointer( "Py_VerboseFlag" ); +#if PY_MAJOR_VERSION >= 2 + ptr_Py_UnicodeFlag = GetInt_as_IntPointer( "Py_UnicodeFlag" ); +#endif + ptr__Py_PackageContext = GetCharPointer_as_CharPointerPointer( "_Py_PackageContext" ); + + ptr__Exc_ArithmeticError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_ArithmeticError" ); + ptr__Exc_AssertionError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_AssertionError" ); + ptr__Exc_AttributeError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_AttributeError" ); + ptr__Exc_EnvironmentError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_EnvironmentError" ); + ptr__Exc_EOFError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_EOFError" ); + ptr__Exc_Exception = GetPyObjectPointer_As_PyObjectPointer( "PyExc_Exception" ); + ptr__Exc_FloatingPointError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_FloatingPointError" ); + ptr__Exc_ImportError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_ImportError" ); + ptr__Exc_IndexError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_IndexError" ); + ptr__Exc_IOError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_IOError" ); + ptr__Exc_KeyboardInterrupt = GetPyObjectPointer_As_PyObjectPointer( "PyExc_KeyboardInterrupt" ); + ptr__Exc_KeyError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_KeyError" ); + ptr__Exc_LookupError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_LookupError" ); + ptr__Exc_MemoryError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_MemoryError" ); + ptr__Exc_MemoryErrorInst = GetPyObjectPointer_As_PyObjectPointer( "PyExc_MemoryErrorInst" ); + ptr__Exc_NameError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_NameError" ); + ptr__Exc_NotImplementedError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_NotImplementedError" ); + ptr__Exc_OSError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_OSError" ); + ptr__Exc_OverflowError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_OverflowError" ); + ptr__Exc_RuntimeError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_RuntimeError" ); + ptr__Exc_StandardError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_StandardError" ); + ptr__Exc_SyntaxError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_SyntaxError" ); + ptr__Exc_SystemError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_SystemError" ); + ptr__Exc_SystemExit = GetPyObjectPointer_As_PyObjectPointer( "PyExc_SystemExit" ); + ptr__Exc_TypeError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_TypeError" ); + ptr__Exc_ValueError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_ValueError" ); +#ifdef MS_WINDOWS + ptr__Exc_WindowsError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_WindowsError" ); +#endif + ptr__Exc_ZeroDivisionError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_ZeroDivisionError" ); + +#if PY_MAJOR_VERSION >= 2 + ptr__Exc_IndentationError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_IndentationError" ); + ptr__Exc_TabError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_TabError" ); + ptr__Exc_UnboundLocalError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_UnboundLocalError" ); + ptr__Exc_UnicodeError = GetPyObjectPointer_As_PyObjectPointer( "PyExc_UnicodeError" ); +#endif + ptr__PyNone = GetPyObject_As_PyObjectPointer( "_Py_NoneStruct" ); + + ptr__PyFalse = GetPyObject_As_PyObjectPointer( "_Py_ZeroStruct" ); + ptr__PyTrue = GetPyObject_As_PyObjectPointer( "_Py_TrueStruct" ); + + ptr__Buffer_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyBuffer_Type" ); + ptr__CFunction_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyCFunction_Type" ); + ptr__Class_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyClass_Type" ); + ptr__CObject_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyCObject_Type" ); + ptr__Complex_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyComplex_Type" ); + ptr__Dict_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyDict_Type" ); + ptr__File_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyFile_Type" ); + ptr__Float_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyFloat_Type" ); + ptr__Function_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyFunction_Type" ); + ptr__Instance_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyInstance_Type" ); + ptr__Int_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyInt_Type" ); + ptr__List_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyList_Type" ); + ptr__Long_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyLong_Type" ); + ptr__Method_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyMethod_Type" ); + ptr__Module_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyModule_Type" ); + ptr__Range_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyRange_Type" ); + ptr__Slice_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PySlice_Type" ); + ptr__String_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyString_Type" ); + ptr__TraceBack_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyTraceBack_Type" ); + ptr__Tuple_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyTuple_Type" ); + ... [truncated message content] |
From: <jd...@us...> - 2010-01-16 23:07:49
|
Revision: 8088 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8088&view=rev Author: jdh2358 Date: 2010-01-16 23:07:42 +0000 (Sat, 16 Jan 2010) Log Message: ----------- rename CXX64 to CXX6 Added Paths: ----------- trunk/matplotlib/CXX6/ Removed Paths: ------------- trunk/matplotlib/CXX64/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2010-01-16 23:14:17
|
Revision: 8089 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8089&view=rev Author: jdh2358 Date: 2010-01-16 23:14:11 +0000 (Sat, 16 Jan 2010) Log Message: ----------- move CXX to CXX5 Added Paths: ----------- trunk/matplotlib/CXX5/ Removed Paths: ------------- trunk/matplotlib/CXX/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2010-01-16 23:14:56
|
Revision: 8090 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8090&view=rev Author: jdh2358 Date: 2010-01-16 23:14:50 +0000 (Sat, 16 Jan 2010) Log Message: ----------- make CXX6 the default again Added Paths: ----------- trunk/matplotlib/CXX/ Removed Paths: ------------- trunk/matplotlib/CXX6/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mme...@us...> - 2010-01-25 20:32:08
|
Revision: 8097 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8097&view=rev Author: mmetz_bn Date: 2010-01-25 20:31:41 +0000 (Mon, 25 Jan 2010) Log Message: ----------- Fixed a bug in hist with stepfilled and log=True Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2010-01-25 13:04:22 UTC (rev 8096) +++ trunk/matplotlib/CHANGELOG 2010-01-25 20:31:41 UTC (rev 8097) @@ -1,3 +1,5 @@ +2010-01-25 Fixed a bug reported by Olle Engdegard, when using + histograms with stepfilled and log=True - MM 2010-01-16 Upgraded CXX to 6.1.1 - JDH Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2010-01-25 13:04:22 UTC (rev 8096) +++ trunk/matplotlib/lib/matplotlib/axes.py 2010-01-25 20:31:41 UTC (rev 8097) @@ -7216,6 +7216,8 @@ for m in n: y[1:-1:2], y[2::2] = m, m + if log: + y[y<1e-100]=1e-100 if orientation == 'horizontal': x,y = y,x elif orientation != 'vertical': This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lee...@us...> - 2010-01-28 20:37:55
|
Revision: 8099 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8099&view=rev Author: leejjoon Date: 2010-01-28 20:37:46 +0000 (Thu, 28 Jan 2010) Log Message: ----------- experimental support of Image._image_skew_coordinate Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/image.py Added Paths: ----------- trunk/matplotlib/examples/api/demo_affine_image.py Added: trunk/matplotlib/examples/api/demo_affine_image.py =================================================================== --- trunk/matplotlib/examples/api/demo_affine_image.py (rev 0) +++ trunk/matplotlib/examples/api/demo_affine_image.py 2010-01-28 20:37:46 UTC (rev 8099) @@ -0,0 +1,51 @@ +#!/usr/bin/env python + + +""" +For the backends that supports draw_image with optional affine +transform (e.g., ps backend), the image of the output should +have its boundary matches the red rectangles. +""" + +import numpy as np +import matplotlib.cm as cm +import matplotlib.mlab as mlab +import matplotlib.pyplot as plt +import matplotlib.transforms as mtransforms + +def get_image(): + delta = 0.25 + x = y = np.arange(-3.0, 3.0, delta) + X, Y = np.meshgrid(x, y) + Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) + Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) + Z = Z2-Z1 # difference of Gaussians + return Z + +def imshow_affine(ax, z, *kl, **kwargs): + im = ax.imshow(z, *kl, **kwargs) + x1, x2, y1, y2 = im.get_extent() + im._image_skew_coordinate = (x2, y1) + return im + + +if 1: + ax = plt.subplot(111) + Z = get_image() + im = imshow_affine(ax, Z, interpolation='nearest', cmap=cm.jet, + origin='lower', extent=[-2, 4, -3, 2]) + + trans_data2 = mtransforms.Affine2D().rotate_deg(30) + ax.transData + im.set_transform(trans_data2) + + # display intended extent of the image + x1, x2, y1, y2 = im.get_extent() + x3, y3 = x2, y1 + + ax.plot([x1, x2, x2, x1, x1], [y1, y1, y2, y2, y1], "r--", lw=3, + transform=trans_data2) + + ax.set_xlim(-3, 5) + ax.set_ylim(-4, 4) + + plt.savefig("demo_affine_image") Modified: trunk/matplotlib/lib/matplotlib/image.py =================================================================== --- trunk/matplotlib/lib/matplotlib/image.py 2010-01-28 19:09:20 UTC (rev 8098) +++ trunk/matplotlib/lib/matplotlib/image.py 2010-01-28 20:37:46 UTC (rev 8099) @@ -25,6 +25,7 @@ from matplotlib._image import * from matplotlib.transforms import BboxBase +import matplotlib.transforms as mtransforms class _AxesImageBase(martist.Artist, cm.ScalarMappable): zorder = 0 @@ -96,6 +97,12 @@ self._imcache = None + # this is an expetimental attribute, if True, unsampled image + # will be drawn using the affine transform that are + # appropriately skewed so that the given postition + # corresponds to the actual position in the coordinate. -JJL + self._image_skew_coordinate = None + self.update(kwargs) def get_size(self): @@ -204,6 +211,36 @@ return im, xmin, ymin, dxintv, dyintv, sx, sy + @staticmethod + def _get_rotate_and_skew_transform(x1, y1, x2, y2, x3, y3): + """ + Retuen a transform that does + (x1, y1) -> (x1, y1) + (x2, y2) -> (x2, y2) + (x2, y1) -> (x3, y3) + + It was intended to derive a skew transform that preserve the + lower-left corner (x1, y1) and top-right corner(x2,y2), but + change the the lower-right-corner(x2, y1) to a new position + (x3, y3). + """ + tr1 = mtransforms.Affine2D() + tr1.translate(-x1, -y1) + x2a, y2a = tr1.transform_point((x2, y2)) + x3a, y3a = tr1.transform_point((x3, y3)) + + inv_mat = 1./(x2a*y3a-y2a*x3a) * np.mat([[y3a, -y2a],[-x3a, x2a]]) + + a, b = (inv_mat * np.mat([[x2a], [x2a]])).flat + c, d = (inv_mat * np.mat([[y2a], [0]])).flat + + tr2 = mtransforms.Affine2D.from_values(a, c, b, d, 0, 0) + + tr = (tr1 + tr2 + mtransforms.Affine2D().translate(x1, y1)).inverted().get_affine() + + return tr + + def _draw_unsampled_image(self, renderer, gc): """ draw unsampled image. The renderer should support a draw_image method @@ -227,13 +264,25 @@ im._url = self.get_url() trans = self.get_transform() #axes.transData - xx1, yy1 = trans.transform_non_affine((xmin, ymin)) - xx2, yy2 = trans.transform_non_affine((xmin+dxintv, ymin+dyintv)) + xy = trans.transform_non_affine([(xmin, ymin), + (xmin+dxintv, ymin+dyintv)]) + xx1, yy1 = xy[0] + xx2, yy2 = xy[1] - renderer.draw_image(gc, xx1, yy1, im, xx2-xx1, yy2-yy1, - trans.get_affine()) + if self._image_skew_coordinate: + # skew the image when required. + x_lrc, y_lrc = self._image_skew_coordinate + xy = trans.transform_non_affine([(x_lrc, y_lrc)]) + xx3, yy3 = xy[0] + tr_rotate_skew = self._get_rotate_and_skew_transform(xx1, yy1, xx2, yy2, xx3, yy3) + tr = tr_rotate_skew+trans.get_affine() + else: + tr = trans.get_affine() + renderer.draw_image(gc, xx1, yy1, im, xx2-xx1, yy2-yy1, tr) + + def _check_unsampled_image(self, renderer): """ return True if the image is better to be drawn unsampled. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2010-01-29 15:28:03
|
Revision: 8101 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8101&view=rev Author: jdh2358 Date: 2010-01-29 15:27:54 +0000 (Fri, 29 Jan 2010) Log Message: ----------- added state to legend toggle Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/legend.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2010-01-28 21:46:12 UTC (rev 8100) +++ trunk/matplotlib/CHANGELOG 2010-01-29 15:27:54 UTC (rev 8101) @@ -1,3 +1,6 @@ +2010-01-29 Added draggable method to Legend to allow mouse drag +placement. Thanks Adam Fraser. JDH + 2010-01-25 Fixed a bug reported by Olle Engdegard, when using histograms with stepfilled and log=True - MM Modified: trunk/matplotlib/lib/matplotlib/legend.py =================================================================== --- trunk/matplotlib/lib/matplotlib/legend.py 2010-01-28 21:46:12 UTC (rev 8100) +++ trunk/matplotlib/lib/matplotlib/legend.py 2010-01-29 15:27:54 UTC (rev 8101) @@ -935,16 +935,32 @@ return ox, oy - def draggable(self): + def draggable(self, state=None): """ - toggle the draggable state; if on, you can drag the legend on - the canvas. The DraggableLegend helper class is returned + Set the draggable state -- if state is + + * None : toggle the current state + + * True : turn draggable on + + * False : turn draggable off + + If draggable is on, you can drag the legend on the canvas with + the mouse. The DraggableLegend helper instance is returned if + draggable is on. """ - if self._draggable is not None: - self._draggable.disconnect() + is_draggable = self._draggable is not None + + # if state is None we'll toggle + if state is None: + state = not is_draggable + + if state: + if self._draggable is None: + self._draggable = DraggableLegend(self) + else: + if self._draggable is not None: + self._draggable.disconnect() self._draggable = None - else: - self._draggable = DraggableLegend(self) - return self._draggable This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lee...@us...> - 2010-01-29 17:33:31
|
Revision: 8103 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8103&view=rev Author: leejjoon Date: 2010-01-29 17:33:21 +0000 (Fri, 29 Jan 2010) Log Message: ----------- refactor draggable legend to support annotation Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/legend.py trunk/matplotlib/lib/matplotlib/offsetbox.py trunk/matplotlib/lib/matplotlib/text.py Added Paths: ----------- trunk/matplotlib/examples/animation/draggable_legend.py Added: trunk/matplotlib/examples/animation/draggable_legend.py =================================================================== --- trunk/matplotlib/examples/animation/draggable_legend.py (rev 0) +++ trunk/matplotlib/examples/animation/draggable_legend.py 2010-01-29 17:33:21 UTC (rev 8103) @@ -0,0 +1,43 @@ +import matplotlib.pyplot as plt + + +ax = plt.subplot(111) +ax.plot([1,2,3], label="test") + +l = ax.legend() +d1 = l.draggable() + +xy = 1, 2 +txt = ax.annotate("Test", xy, xytext=(-30, 30), + textcoords="offset points", + bbox=dict(boxstyle="round",fc=(0.2, 1, 1)), + arrowprops=dict(arrowstyle="->")) +d2 = txt.draggable() + + +from matplotlib._png import read_png +from matplotlib.cbook import get_sample_data + +from matplotlib.offsetbox import OffsetImage, AnnotationBbox + +fn = get_sample_data("lena.png", asfileobj=False) +arr_lena = read_png(fn) + +imagebox = OffsetImage(arr_lena, zoom=0.2) + +ab = AnnotationBbox(imagebox, xy, + xybox=(120., -80.), + xycoords='data', + boxcoords="offset points", + pad=0.5, + arrowprops=dict(arrowstyle="->", + connectionstyle="angle,angleA=0,angleB=90,rad=3") + ) + + +ax.add_artist(ab) + +d3 = ab.draggable() + + +plt.show() Modified: trunk/matplotlib/lib/matplotlib/legend.py =================================================================== --- trunk/matplotlib/lib/matplotlib/legend.py 2010-01-29 16:22:51 UTC (rev 8102) +++ trunk/matplotlib/lib/matplotlib/legend.py 2010-01-29 17:33:21 UTC (rev 8103) @@ -33,56 +33,28 @@ from matplotlib.patches import Patch, Rectangle, Shadow, FancyBboxPatch from matplotlib.collections import LineCollection, RegularPolyCollection, \ CircleCollection -from matplotlib.transforms import Bbox, BboxBase, TransformedBbox, BboxTransformTo +from matplotlib.transforms import Bbox, BboxBase, TransformedBbox, BboxTransformTo, BboxTransformFrom -from matplotlib.offsetbox import HPacker, VPacker, TextArea, DrawingArea +from matplotlib.offsetbox import HPacker, VPacker, TextArea, DrawingArea, DraggableOffsetBox -class DraggableLegend: - """helper code for a draggable legend -- see Legend.draggable""" - +class DraggableLegend(DraggableOffsetBox): def __init__(self, legend): - self.legend = legend - self.gotLegend = False + self.legend=legend + DraggableOffsetBox.__init__(self, legend, legend._legend_box) - c1 = legend.figure.canvas.mpl_connect('motion_notify_event', self.on_motion) - c2 = legend.figure.canvas.mpl_connect('pick_event', self.on_pick) - c3 = legend.figure.canvas.mpl_connect('button_release_event', self.on_release) - legend.set_picker(self.my_legend_picker) - self.cids = [c1, c2, c3] - - def on_motion(self, evt): - if self.gotLegend: - dx = evt.x - self.mouse_x - dy = evt.y - self.mouse_y - loc_in_canvas = self.legend_x + dx, self.legend_y + dy - loc_in_norm_axes = self.legend.parent.transAxes.inverted().transform_point(loc_in_canvas) - self.legend._loc = tuple(loc_in_norm_axes) - self.legend.figure.canvas.draw() - - def my_legend_picker(self, legend, evt): + def artist_picker(self, legend, evt): return self.legend.legendPatch.contains(evt) - def on_pick(self, evt): - legend = self.legend - if evt.artist == legend: - bbox = self.legend.get_window_extent() - self.mouse_x = evt.mouseevent.x - self.mouse_y = evt.mouseevent.y - self.legend_x = bbox.xmin - self.legend_y = bbox.ymin - self.gotLegend = 1 + def finalize_offset(self): + loc_in_canvas = self.get_loc_in_canvas() - def on_release(self, event): - if self.gotLegend: - self.gotLegend = False + bbox = self.legend.get_bbox_to_anchor() + _bbox_transform = BboxTransformFrom(bbox) + self.legend._loc = tuple(_bbox_transform.transform_point(loc_in_canvas)) + - def disconnect(self): - 'disconnect the callbacks' - for cid in self.cids: - self.legend.figure.canvas.mpl_disconnect(cid) - class Legend(Artist): """ Place a legend on the axes at location loc. Labels are a @@ -323,7 +295,6 @@ 'Falling back on "upper right".') loc = 1 - self._loc = loc self._mode = mode self.set_bbox_to_anchor(bbox_to_anchor, bbox_transform) @@ -357,6 +328,8 @@ # init with null renderer self._init_legend_box(handles, labels) + self._loc = loc + self.set_title(title) self._last_fontsize_points = self._fontsize @@ -373,6 +346,28 @@ a.set_transform(self.get_transform()) + def _set_loc(self, loc): + # find_offset function will be provided to _legend_box and + # _legend_box will draw itself at the location of the return + # value of the find_offset. + self._loc_real = loc + if loc == 0: + _findoffset = self._findoffset_best + else: + _findoffset = self._findoffset_loc + + #def findoffset(width, height, xdescent, ydescent): + # return _findoffset(width, height, xdescent, ydescent, renderer) + + self._legend_box.set_offset(_findoffset) + + self._loc_real = loc + + def _get_loc(self): + return self._loc_real + + _loc = property(_get_loc, _set_loc) + def _findoffset_best(self, width, height, xdescent, ydescent, renderer): "Helper function to locate the legend at its best position" ox, oy = self._find_best_position(width, height, renderer) @@ -401,19 +396,6 @@ renderer.open_group('legend') - # find_offset function will be provided to _legend_box and - # _legend_box will draw itself at the location of the return - # value of the find_offset. - if self._loc == 0: - _findoffset = self._findoffset_best - else: - _findoffset = self._findoffset_loc - - def findoffset(width, height, xdescent, ydescent): - return _findoffset(width, height, xdescent, ydescent, renderer) - - self._legend_box.set_offset(findoffset) - fontsize = renderer.points_to_pixels(self._fontsize) # if mode == fill, set the width of the legend_box to the Modified: trunk/matplotlib/lib/matplotlib/offsetbox.py =================================================================== --- trunk/matplotlib/lib/matplotlib/offsetbox.py 2010-01-29 16:22:51 UTC (rev 8102) +++ trunk/matplotlib/lib/matplotlib/offsetbox.py 2010-01-29 17:33:21 UTC (rev 8103) @@ -20,7 +20,7 @@ import matplotlib.text as mtext import numpy as np from matplotlib.transforms import Bbox, BboxBase, TransformedBbox, \ - IdentityTransform + IdentityTransform, BboxTransformFrom from matplotlib.font_manager import FontProperties from matplotlib.patches import FancyBboxPatch, FancyArrowPatch @@ -168,14 +168,14 @@ """ self._offset = xy - def get_offset(self, width, height, xdescent, ydescent): + def get_offset(self, width, height, xdescent, ydescent, renderer): """ Get the offset accepts extent of the box """ if callable(self._offset): - return self._offset(width, height, xdescent, ydescent) + return self._offset(width, height, xdescent, ydescent, renderer) else: return self._offset @@ -222,7 +222,7 @@ get the bounding box in display space. ''' w, h, xd, yd, offsets = self.get_extent_offsets(renderer) - px, py = self.get_offset(w, h, xd, yd) + px, py = self.get_offset(w, h, xd, yd, renderer) return mtransforms.Bbox.from_bounds(px-xd, py-yd, w, h) def draw(self, renderer): @@ -233,7 +233,7 @@ width, height, xdescent, ydescent, offsets = self.get_extent_offsets(renderer) - px, py = self.get_offset(width, height, xdescent, ydescent) + px, py = self.get_offset(width, height, xdescent, ydescent, renderer) for c, (ox, oy) in zip(self.get_visible_children(), offsets): c.set_offset((px+ox, py+oy)) @@ -946,7 +946,7 @@ ''' self._update_offset_func(renderer) w, h, xd, yd = self.get_extent(renderer) - ox, oy = self.get_offset(w, h, xd, yd) + ox, oy = self.get_offset(w, h, xd, yd, renderer) return Bbox.from_bounds(ox-xd, oy-yd, w, h) @@ -996,7 +996,7 @@ width, height, xdescent, ydescent = self.get_extent(renderer) - px, py = self.get_offset(width, height, xdescent, ydescent) + px, py = self.get_offset(width, height, xdescent, ydescent, renderer) self.get_child().set_offset((px, py)) self.get_child().draw(renderer) @@ -1121,12 +1121,15 @@ # self.offset_transform.translate(xy[0], xy[1]) + def get_offset(self): """ return offset of the container. """ return self._offset + def get_children(self): + return [self.image] def get_window_extent(self, renderer): ''' @@ -1243,9 +1246,9 @@ def contains(self,event): t,tinfo = self.offsetbox.contains(event) - if self.arrow is not None: - a,ainfo=self.arrow.contains(event) - t = t or a + #if self.arrow_patch is not None: + # a,ainfo=self.arrow_patch.contains(event) + # t = t or a # self.arrow_patch is currently not checked as this can be a line - JJ @@ -1380,7 +1383,151 @@ +class DraggableBase(object): + """ + helper code for a draggable artist (legend, offsetbox) + The derived class must override following two method. + def saveoffset(self): + pass + + def update_offset(self, dx, dy): + pass + + *saveoffset* is called when the object is picked for dragging and it is + meant to save reference position of the artist. + + *update_offset* is called during the dragging. dx and dy is the pixel + offset from the point where the mouse drag started. + + Optionally you may override following two methods. + + def artist_picker(self, artist, evt): + return self.ref_artist.contains(evt) + + def finalize_offset(self): + pass + + *artist_picker* is a picker method that will be + used. *finalize_offset* is called when the mouse is released. In + current implementaion of DraggableLegend and DraggableAnnotation, + *update_offset* places the artists simply in display + coordinates. And *finalize_offset* recalculate their position in + the normalized axes coordinate and set a relavant attribute. + + """ + def __init__(self, ref_artist): + self.ref_artist = ref_artist + self.got_artist = False + + self.canvas = self.ref_artist.figure.canvas + c2 = self.canvas.mpl_connect('pick_event', self.on_pick) + c3 = self.canvas.mpl_connect('button_release_event', self.on_release) + + ref_artist.set_picker(self.artist_picker) + self.cids = [c2, c3] + + def on_motion(self, evt): + if self.got_artist: + dx = evt.x - self.mouse_x + dy = evt.y - self.mouse_y + self.update_offset(dx, dy) + + def on_pick(self, evt): + if evt.artist == self.ref_artist: + + self.save_offset() + self.mouse_x = evt.mouseevent.x + self.mouse_y = evt.mouseevent.y + self.got_artist = True + + self._c1 = self.canvas.mpl_connect('motion_notify_event', self.on_motion) + + def on_release(self, event): + if self.got_artist: + self.finalize_offset() + self.got_artist = False + self.canvas.mpl_disconnect(self._c1) + + def disconnect(self): + 'disconnect the callbacks' + for cid in self.cids: + self.canvas.mpl_disconnect(cid) + + def artist_picker(self, artist, evt): + return self.ref_artist.contains(evt) + + def save_offset(self): + pass + + def update_offset(self, dx, dy): + pass + + def finalize_offset(self): + pass + + +class DraggableOffsetBox(DraggableBase): + def __init__(self, ref_artist, offsetbox): + DraggableBase.__init__(self, ref_artist) + self.offsetbox = offsetbox + + def save_offset(self): + offsetbox = self.offsetbox + renderer = offsetbox.figure._cachedRenderer + w, h, xd, yd = offsetbox.get_extent(renderer) + offset = offsetbox.get_offset(w, h, xd, yd, renderer) + self.offsetbox_x, self.offsetbox_y = offset + + def update_offset(self, dx, dy): + loc_in_canvas = self.offsetbox_x + dx, self.offsetbox_y + dy + self.offsetbox.set_offset(loc_in_canvas) + self.offsetbox.figure.canvas.draw() + + def get_loc_in_canvas(self): + + offsetbox=self.offsetbox + renderer = offsetbox.figure._cachedRenderer + w, h, xd, yd = offsetbox.get_extent(renderer) + ox, oy = offsetbox._offset + loc_in_canvas = (ox-xd, oy-yd) + + return loc_in_canvas + + +class DraggableAnnotation(DraggableBase): + def __init__(self, annotation): + DraggableBase.__init__(self, annotation) + self.annotation = annotation + + def save_offset(self): + ann = self.annotation + x, y = ann.xytext + if isinstance(ann.textcoords, tuple): + xcoord, ycoord = ann.textcoords + x1, y1 = ann._get_xy(x, y, xcoord) + x2, y2 = ann._get_xy(x, y, ycoord) + ox0, oy0 = x1, y2 + else: + ox0, oy0 = ann._get_xy(x, y, ann.textcoords) + + self.ox, self.oy = ox0, oy0 + self.annotation.textcoords = "figure pixels" + + def update_offset(self, dx, dy): + ann = self.annotation + ann.xytext = self.ox + dx, self.oy + dy + x, y = ann.xytext + xy = ann._get_xy(x, y, ann.textcoords) + self.canvas.draw() + + def finalize_offset(self): + loc_in_canvas = self.annotation.xytext + self.annotation.textcoords = "axes fraction" + pos_axes_fraction = self.annotation.axes.transAxes.inverted().transform_point(loc_in_canvas) + self.annotation.xytext = tuple(pos_axes_fraction) + + if __name__ == "__main__": fig = plt.figure(1) Modified: trunk/matplotlib/lib/matplotlib/text.py =================================================================== --- trunk/matplotlib/lib/matplotlib/text.py 2010-01-29 16:22:51 UTC (rev 8102) +++ trunk/matplotlib/lib/matplotlib/text.py 2010-01-29 17:33:21 UTC (rev 8103) @@ -1402,6 +1402,9 @@ self.textcoords = textcoords self.set_annotation_clip(annotation_clip) + self._draggable = None + + def _get_xy(self, x, y, s): if s=='data': trans = self.axes.transData @@ -1534,8 +1537,38 @@ return True + def draggable(self, state=None): + """ + Set the draggable state -- if state is + * None : toggle the current state + * True : turn draggable on + + * False : turn draggable off + + If draggable is on, you can drag the annotation on the canvas with + the mouse. The DraggableAnnotation helper instance is returned if + draggable is on. + """ + from matplotlib.offsetbox import DraggableAnnotation + is_draggable = self._draggable is not None + + # if state is None we'll toggle + if state is None: + state = not is_draggable + + if state: + if self._draggable is None: + self._draggable = DraggableAnnotation(self) + else: + if self._draggable is not None: + self._draggable.disconnect() + self._draggable = None + + return self._draggable + + class Annotation(Text, _AnnotationBase): """ A :class:`~matplotlib.text.Text` class to make annotating things @@ -1661,6 +1694,7 @@ else: self.arrow_patch = None + def contains(self,event): t,tinfo = Text.contains(self,event) if self.arrow is not None: @@ -1803,6 +1837,9 @@ Text.draw(self, renderer) + + + docstring.interpd.update(Annotation=Annotation.__init__.__doc__) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lee...@us...> - 2010-01-29 18:03:33
|
Revision: 8105 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8105&view=rev Author: leejjoon Date: 2010-01-29 18:03:13 +0000 (Fri, 29 Jan 2010) Log Message: ----------- draggable legend now optionally blitted Modified Paths: -------------- trunk/matplotlib/examples/animation/draggable_legend.py trunk/matplotlib/lib/matplotlib/legend.py trunk/matplotlib/lib/matplotlib/offsetbox.py trunk/matplotlib/lib/matplotlib/text.py Modified: trunk/matplotlib/examples/animation/draggable_legend.py =================================================================== --- trunk/matplotlib/examples/animation/draggable_legend.py 2010-01-29 17:33:34 UTC (rev 8104) +++ trunk/matplotlib/examples/animation/draggable_legend.py 2010-01-29 18:03:13 UTC (rev 8105) @@ -37,7 +37,7 @@ ax.add_artist(ab) -d3 = ab.draggable() +d3 = ab.draggable(use_blit=True) plt.show() Modified: trunk/matplotlib/lib/matplotlib/legend.py =================================================================== --- trunk/matplotlib/lib/matplotlib/legend.py 2010-01-29 17:33:34 UTC (rev 8104) +++ trunk/matplotlib/lib/matplotlib/legend.py 2010-01-29 18:03:13 UTC (rev 8105) @@ -39,9 +39,10 @@ class DraggableLegend(DraggableOffsetBox): - def __init__(self, legend): + def __init__(self, legend, use_blit=False): self.legend=legend - DraggableOffsetBox.__init__(self, legend, legend._legend_box) + DraggableOffsetBox.__init__(self, legend, legend._legend_box, + use_blit=use_blit) def artist_picker(self, legend, evt): return self.legend.legendPatch.contains(evt) @@ -917,7 +918,7 @@ return ox, oy - def draggable(self, state=None): + def draggable(self, state=None, use_blit=False): """ Set the draggable state -- if state is @@ -939,7 +940,7 @@ if state: if self._draggable is None: - self._draggable = DraggableLegend(self) + self._draggable = DraggableLegend(self, use_blit) else: if self._draggable is not None: self._draggable.disconnect() Modified: trunk/matplotlib/lib/matplotlib/offsetbox.py =================================================================== --- trunk/matplotlib/lib/matplotlib/offsetbox.py 2010-01-29 17:33:34 UTC (rev 8104) +++ trunk/matplotlib/lib/matplotlib/offsetbox.py 2010-01-29 18:03:13 UTC (rev 8105) @@ -1416,10 +1416,11 @@ the normalized axes coordinate and set a relavant attribute. """ - def __init__(self, ref_artist): + def __init__(self, ref_artist, use_blit=False): self.ref_artist = ref_artist self.got_artist = False - + self._use_blit = use_blit + self.canvas = self.ref_artist.figure.canvas c2 = self.canvas.mpl_connect('pick_event', self.on_pick) c3 = self.canvas.mpl_connect('button_release_event', self.on_release) @@ -1432,16 +1433,34 @@ dx = evt.x - self.mouse_x dy = evt.y - self.mouse_y self.update_offset(dx, dy) + self.canvas.draw() + def on_motion_blit(self, evt): + if self.got_artist: + dx = evt.x - self.mouse_x + dy = evt.y - self.mouse_y + self.update_offset(dx, dy) + self.canvas.restore_region(self.background) + self.ref_artist.draw(self.ref_artist.figure._cachedRenderer) + self.canvas.blit(self.ref_artist.figure.bbox) + def on_pick(self, evt): if evt.artist == self.ref_artist: - self.save_offset() self.mouse_x = evt.mouseevent.x self.mouse_y = evt.mouseevent.y self.got_artist = True - self._c1 = self.canvas.mpl_connect('motion_notify_event', self.on_motion) + if self._use_blit: + self.ref_artist.set_animated(True) + self.canvas.draw() + self.background = self.canvas.copy_from_bbox(self.ref_artist.figure.bbox) + self.ref_artist.draw(self.ref_artist.figure._cachedRenderer) + self.canvas.blit(self.ref_artist.figure.bbox) + self._c1 = self.canvas.mpl_connect('motion_notify_event', self.on_motion_blit) + else: + self._c1 = self.canvas.mpl_connect('motion_notify_event', self.on_motion) + self.save_offset() def on_release(self, event): if self.got_artist: @@ -1449,6 +1468,9 @@ self.got_artist = False self.canvas.mpl_disconnect(self._c1) + if self._use_blit: + self.ref_artist.set_animated(False) + def disconnect(self): 'disconnect the callbacks' for cid in self.cids: @@ -1468,8 +1490,8 @@ class DraggableOffsetBox(DraggableBase): - def __init__(self, ref_artist, offsetbox): - DraggableBase.__init__(self, ref_artist) + def __init__(self, ref_artist, offsetbox, use_blit=False): + DraggableBase.__init__(self, ref_artist, use_blit=use_blit) self.offsetbox = offsetbox def save_offset(self): @@ -1482,7 +1504,6 @@ def update_offset(self, dx, dy): loc_in_canvas = self.offsetbox_x + dx, self.offsetbox_y + dy self.offsetbox.set_offset(loc_in_canvas) - self.offsetbox.figure.canvas.draw() def get_loc_in_canvas(self): @@ -1496,8 +1517,8 @@ class DraggableAnnotation(DraggableBase): - def __init__(self, annotation): - DraggableBase.__init__(self, annotation) + def __init__(self, annotation, use_blit=False): + DraggableBase.__init__(self, annotation, use_blit=use_blit) self.annotation = annotation def save_offset(self): @@ -1519,7 +1540,6 @@ ann.xytext = self.ox + dx, self.oy + dy x, y = ann.xytext xy = ann._get_xy(x, y, ann.textcoords) - self.canvas.draw() def finalize_offset(self): loc_in_canvas = self.annotation.xytext Modified: trunk/matplotlib/lib/matplotlib/text.py =================================================================== --- trunk/matplotlib/lib/matplotlib/text.py 2010-01-29 17:33:34 UTC (rev 8104) +++ trunk/matplotlib/lib/matplotlib/text.py 2010-01-29 18:03:13 UTC (rev 8105) @@ -1537,7 +1537,7 @@ return True - def draggable(self, state=None): + def draggable(self, state=None, use_blit=False): """ Set the draggable state -- if state is @@ -1560,7 +1560,7 @@ if state: if self._draggable is None: - self._draggable = DraggableAnnotation(self) + self._draggable = DraggableAnnotation(self, use_blit) else: if self._draggable is not None: self._draggable.disconnect() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fer...@us...> - 2010-02-04 04:58:58
|
Revision: 8110 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8110&view=rev Author: fer_perez Date: 2010-02-04 04:58:51 +0000 (Thu, 04 Feb 2010) Log Message: ----------- Make plot_directive use a custom PlotWarning category. Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2010-02-03 19:42:00 UTC (rev 8109) +++ trunk/matplotlib/CHANGELOG 2010-02-04 04:58:51 UTC (rev 8110) @@ -1,3 +1,6 @@ +2010-02-03 Made plot_directive use a custom PlotWarning category, so that + warnings can be turned into fatal errors easily if desired. - FP + 2010-01-29 Added draggable method to Legend to allow mouse drag placement. Thanks Adam Fraser. JDH Modified: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py =================================================================== --- trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py 2010-02-03 19:42:00 UTC (rev 8109) +++ trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py 2010-02-04 04:58:51 UTC (rev 8110) @@ -44,6 +44,18 @@ The set of file formats to generate can be specified with the `plot_formats` configuration variable. + + +Error handling: + +Any errors generated during the running of the code are emitted as warnings +using the Python `warnings` module, using a custom category called +`PlotWarning`. To turn the warnings into fatal errors that stop the +documentation build, after adjusting your `sys.path` in your `conf.py` Sphinx +configuration file, use:: + + import plot_directive + warnings.simplefilter('error', plot_directive.PlotWarning) """ import sys, os, shutil, imp, warnings, cStringIO, re @@ -76,6 +88,21 @@ from matplotlib import _pylab_helpers from matplotlib.sphinxext import only_directives + +class PlotWarning(Warning): + """Warning category for all warnings generated by this directive. + + By printing our warnings with this category, it becomes possible to turn + them into errors by using in your conf.py:: + + warnings.simplefilter('error', plot_directive.PlotWarning) + + This way, you can ensure that your docs only build if all your examples + actually run successfully. + """ + pass + + # os.path.relpath is new in Python 2.6 if hasattr(os.path, 'relpath'): relpath = os.path.relpath @@ -208,7 +235,7 @@ figman.canvas.figure.savefig(outpath, dpi=dpi) except: s = cbook.exception_to_str("Exception saving plot %s" % plot_path) - warnings.warn(s) + warnings.warn(s, PlotWarning) return 0 if j > 0: shutil.copyfile(outpath, os.path.join(destdir, outname)) @@ -270,7 +297,7 @@ run_code(plot_path, function_name, plot_code) except: s = cbook.exception_to_str("Exception running plot %s" % plot_path) - warnings.warn(s) + warnings.warn(s, PlotWarning) return 0 num_figs = run_savefig(plot_path, basename, tmpdir, destdir, formats) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2010-02-06 21:24:33
|
Revision: 8111 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8111&view=rev Author: efiring Date: 2010-02-06 21:24:21 +0000 (Sat, 06 Feb 2010) Log Message: ----------- Modified EllipseCollection for closer compatibility with Ellipse patch. Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/doc/api/api_changes.rst trunk/matplotlib/lib/matplotlib/collections.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2010-02-04 04:58:51 UTC (rev 8110) +++ trunk/matplotlib/CHANGELOG 2010-02-06 21:24:21 UTC (rev 8111) @@ -1,3 +1,5 @@ +2010-02-06 Added 'xy' scaling option to EllipseCollection. - EF + 2010-02-03 Made plot_directive use a custom PlotWarning category, so that warnings can be turned into fatal errors easily if desired. - FP Modified: trunk/matplotlib/doc/api/api_changes.rst =================================================================== --- trunk/matplotlib/doc/api/api_changes.rst 2010-02-04 04:58:51 UTC (rev 8110) +++ trunk/matplotlib/doc/api/api_changes.rst 2010-02-06 21:24:21 UTC (rev 8111) @@ -10,6 +10,19 @@ Changes beyond 0.99.x ===================== +* The :class:'~matplotlib.collections.EllipseCollection' has been + changed in two ways: + + + There is a new *units* option, 'xy', that scales the ellipse with + the data units. This matches the :class:'~matplotlib.patches.Ellipse` + scaling. + + + The *height* and *width* kwargs have been changed to specify + the height and width, again for consistency with + :class:'~matplotlib.patches.Ellipse`, and to better match + their names; previously they specified the half-height and + half-width. + * There is a new rc parameter ``axes.color_cycle``, and the color cycle is now independent of the rc parameter ``lines.color``. :func:`matplotlib.Axes.set_default_color_cycle` is deprecated. Modified: trunk/matplotlib/lib/matplotlib/collections.py =================================================================== --- trunk/matplotlib/lib/matplotlib/collections.py 2010-02-04 04:58:51 UTC (rev 8110) +++ trunk/matplotlib/lib/matplotlib/collections.py 2010-02-06 21:24:21 UTC (rev 8111) @@ -918,77 +918,79 @@ def __init__(self, widths, heights, angles, units='points', **kwargs): """ *widths*: sequence - half-lengths of first axes (e.g., semi-major axis lengths) + lengths of first axes (e.g., major axis lengths) *heights*: sequence - half-lengths of second axes + lengths of second axes *angles*: sequence angles of first axes, degrees CCW from the X-axis - *units*: ['points' | 'inches' | 'dots' | 'width' | 'height' | 'x' | 'y'] + *units*: ['points' | 'inches' | 'dots' | 'width' | 'height' + | 'x' | 'y' | 'xy'] units in which majors and minors are given; 'width' and 'height' refer to the dimensions of the axes, while 'x' and 'y' - refer to the *offsets* data units. + refer to the *offsets* data units. 'xy' differs from all + others in that the angle as plotted varies with the + aspect ratio, and equals the specified angle only when + the aspect ratio is unity. Hence it behaves the same + as the :class:`~matplotlib.patches.Ellipse` with + axes.transData as its transform. Additional kwargs inherited from the base :class:`Collection`: %(Collection)s """ Collection.__init__(self,**kwargs) - self._widths = np.asarray(widths).ravel() - self._heights = np.asarray(heights).ravel() + self._widths = 0.5 * np.asarray(widths).ravel() + self._heights = 0.5 * np.asarray(heights).ravel() self._angles = np.asarray(angles).ravel() *(np.pi/180.0) self._units = units self.set_transform(transforms.IdentityTransform()) self._transforms = [] self._paths = [mpath.Path.unit_circle()] - self._initialized = False - - def _init(self): - def on_dpi_change(fig): - self._transforms = [] - self.figure.callbacks.connect('dpi_changed', on_dpi_change) - self._initialized = True - - def set_transforms(self): - if not self._initialized: - self._init() + def _set_transforms(self): + """ + Calculate transforms immediately before drawing. + """ self._transforms = [] ax = self.axes fig = self.figure - if self._units in ('x', 'y'): - if self._units == 'x': - dx0 = ax.viewLim.width - dx1 = ax.bbox.width - else: - dx0 = ax.viewLim.height - dx1 = ax.bbox.height - sc = dx1/dx0 + + if self._units == 'xy': + sc = 1 + elif self._units == 'x': + sc = ax.bbox.width / ax.viewLim.width + elif self._units == 'y': + sc = ax.bbox.height / ax.viewLim.height + elif self._units == 'inches': + sc = fig.dpi + elif self._units == 'points': + sc = fig.dpi / 72.0 + elif self._units == 'width': + sc = ax.bbox.width + elif self._units == 'height': + sc = ax.bbox.height + elif self._units == 'dots': + sc = 1.0 else: - if self._units == 'inches': - sc = fig.dpi - elif self._units == 'points': - sc = fig.dpi / 72.0 - elif self._units == 'width': - sc = ax.bbox.width - elif self._units == 'height': - sc = ax.bbox.height - elif self._units == 'dots': - sc = 1.0 - else: - raise ValueError('unrecognized units: %s' % self._units) + raise ValueError('unrecognized units: %s' % self._units) _affine = transforms.Affine2D for x, y, a in zip(self._widths, self._heights, self._angles): trans = _affine().scale(x * sc, y * sc).rotate(a) self._transforms.append(trans) + if self._units == 'xy': + m = ax.transData.get_affine().get_matrix().copy() + m[:2, 2:] = 0 + self.set_transform(_affine(m)) + + def draw(self, renderer): - if True: ###not self._transforms: - self.set_transforms() - return Collection.draw(self, renderer) + self._set_transforms() + Collection.draw(self, renderer) class PatchCollection(Collection): """ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2010-02-06 23:44:34
|
Revision: 8113 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8113&view=rev Author: efiring Date: 2010-02-06 23:44:28 +0000 (Sat, 06 Feb 2010) Log Message: ----------- Let setup.cfg customize the base directory for libs and includes Modified Paths: -------------- trunk/matplotlib/setup.cfg.template trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setup.cfg.template =================================================================== --- trunk/matplotlib/setup.cfg.template 2010-02-06 22:30:12 UTC (rev 8112) +++ trunk/matplotlib/setup.cfg.template 2010-02-06 23:44:28 UTC (rev 8113) @@ -4,6 +4,11 @@ [egg_info] tag_svn_revision = 1 +[directories] +# Uncomment to override the default basedir in setupext.py. +# This can be a single directory or a space-delimited list of directories. +#basedirlist = /usr + [status] # To suppress display of the dependencies and their versions # at the top of the build log, uncomment the following line: Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2010-02-06 22:30:12 UTC (rev 8112) +++ trunk/matplotlib/setupext.py 2010-02-06 23:44:28 UTC (rev 8113) @@ -119,7 +119,8 @@ 'build_macosx': 'auto', 'build_image': True, 'build_windowing': True, - 'backend': None} + 'backend': None, + 'basedirlist': None} defines = [ ('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API'), @@ -161,7 +162,16 @@ try: options['backend'] = config.get("rc_options", "backend") except: pass + try: options['basedirlist'] = config.get("directories", "basedirlist") + except: pass +# For get_base_flags: +if options['basedirlist']: + basedirlist = options['basedirlist'].split() +else: + basedirlist = basedir[sys.platform] +print "basedirlist is:", basedirlist + if options['display_status']: def print_line(char='='): print char * 76 @@ -331,10 +341,10 @@ def add_base_flags(module): incdirs = filter(os.path.exists, - [os.path.join(p, 'include') for p in basedir[sys.platform] ]) + [os.path.join(p, 'include') for p in basedirlist ]) libdirs = filter(os.path.exists, - [os.path.join(p, 'lib') for p in basedir[sys.platform] ]+ - [os.path.join(p, 'lib64') for p in basedir[sys.platform] ] ) + [os.path.join(p, 'lib') for p in basedirlist ]+ + [os.path.join(p, 'lib64') for p in basedirlist ] ) module.include_dirs.extend(incdirs) module.include_dirs.append('.') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2010-02-06 23:54:21
|
Revision: 8115 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8115&view=rev Author: efiring Date: 2010-02-06 23:54:14 +0000 (Sat, 06 Feb 2010) Log Message: ----------- Added gnu0 platform to setupext.py (Benjamin Drung) Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/setupext.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2010-02-06 23:52:34 UTC (rev 8114) +++ trunk/matplotlib/CHANGELOG 2010-02-06 23:54:14 UTC (rev 8115) @@ -1,3 +1,7 @@ +2010-02-06 Added setup.cfg "basedirlist" option to override setting + in setupext.py "basedir" dictionary; added "gnu0" + platform requested by Benjamin Drung. - EF + 2010-02-06 Added 'xy' scaling option to EllipseCollection. - EF 2010-02-03 Made plot_directive use a custom PlotWarning category, so that Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2010-02-06 23:52:34 UTC (rev 8114) +++ trunk/matplotlib/setupext.py 2010-02-06 23:54:14 UTC (rev 8115) @@ -1,8 +1,10 @@ """ Some helper functions for building the C extensions -you may need to edit basedir to point to the default location of your -required libs, eg, png, z, freetype +You may need to use the "basedirlist" option in setup.cfg to point +to the location of your required libs, eg, png, z, freetype, +overriding the settings hard-coded in the "basedir" directory +below. DARWIN @@ -71,6 +73,7 @@ 'gnukfreebsd6' : ['/usr/local', '/usr'], 'gnukfreebsd7' : ['/usr/local', '/usr'], 'gnukfreebsd8' : ['/usr/local', '/usr'], + 'gnu0' : ['/usr'], 'aix5' : ['/usr/local'], } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2010-02-08 16:00:31
|
Revision: 8117 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8117&view=rev Author: mdboom Date: 2010-02-08 16:00:23 +0000 (Mon, 08 Feb 2010) Log Message: ----------- Merged revisions 8092,8116 via svnmerge from https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_99_maint ........ r8092 | leejjoon | 2010-01-18 19:26:16 -0500 (Mon, 18 Jan 2010) | 1 line update annotate documentation to explain *annotation_clip* parameter ........ r8116 | mdboom | 2010-02-08 10:57:45 -0500 (Mon, 08 Feb 2010) | 1 line Fix for libpng-1.4 compatibility ........ Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/text.py trunk/matplotlib/src/_png.cpp Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README trunk/matplotlib/doc/sphinxext/gen_gallery.py trunk/matplotlib/doc/sphinxext/gen_rst.py trunk/matplotlib/examples/misc/multiprocess.py trunk/matplotlib/examples/mplot3d/contour3d_demo.py trunk/matplotlib/examples/mplot3d/contourf3d_demo.py trunk/matplotlib/examples/mplot3d/polys3d_demo.py trunk/matplotlib/examples/mplot3d/scatter3d_demo.py trunk/matplotlib/examples/mplot3d/surface3d_demo.py trunk/matplotlib/examples/mplot3d/wire3d_demo.py trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_spines/spines_axes_positions.png Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/mathtex:1-7263 /branches/v0_99_maint:1-8070 + /branches/mathtex:1-7263 /branches/v0_99_maint:1-8116 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/pyplots/README:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/pyplots/README:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_gallery.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070 + /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_gallery.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_rst.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070 + /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_rst.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 Property changes on: trunk/matplotlib/examples/misc/multiprocess.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/misc/log.py:5753-5771 /branches/v0_98_5_maint/examples/misc/log.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/misc/multiprocess.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070 + /branches/v0_91_maint/examples/misc/log.py:5753-5771 /branches/v0_98_5_maint/examples/misc/log.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/misc/multiprocess.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 Property changes on: trunk/matplotlib/examples/mplot3d/contour3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/contour.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contour.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contour3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070 + /branches/v0_91_maint/examples/mplot3d/contour.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contour.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contour3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 Property changes on: trunk/matplotlib/examples/mplot3d/contourf3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/contourf.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contourf.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contourf3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070 + /branches/v0_91_maint/examples/mplot3d/contourf.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contourf.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contourf3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 Property changes on: trunk/matplotlib/examples/mplot3d/polys3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/polys.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/polys.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/polys3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070 + /branches/v0_91_maint/examples/mplot3d/polys.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/polys.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/polys3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 Property changes on: trunk/matplotlib/examples/mplot3d/scatter3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/scatter.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/scatter.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/scatter3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070 + /branches/v0_91_maint/examples/mplot3d/scatter.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/scatter.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/scatter3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 Property changes on: trunk/matplotlib/examples/mplot3d/surface3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/surface.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/surface.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/surface3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070 + /branches/v0_91_maint/examples/mplot3d/surface.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/surface.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/surface3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 Property changes on: trunk/matplotlib/examples/mplot3d/wire3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/wire.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/wire.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/wire3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070 + /branches/v0_91_maint/examples/mplot3d/wire.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/wire.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/wire3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/mathmpl.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070 + /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/mathmpl.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/only_directives.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070 + /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/only_directives.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/plot_directive.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070 + /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/plot_directive.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_spines/spines_axes_positions.png ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_99_maint/lib/matplotlib/tests/baseline_images/test_spines/spines_axes_positions.png:7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070 + /branches/v0_99_maint/lib/matplotlib/tests/baseline_images/test_spines/spines_axes_positions.png:7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 Modified: trunk/matplotlib/lib/matplotlib/text.py =================================================================== --- trunk/matplotlib/lib/matplotlib/text.py 2010-02-08 15:57:45 UTC (rev 8116) +++ trunk/matplotlib/lib/matplotlib/text.py 2010-02-08 16:00:23 UTC (rev 8117) @@ -1668,6 +1668,14 @@ # 5 points below the top border xy=(10,-5), xycoords='axes points' + + The *annotation_clip* attribute contols the visibility of the + annotation when it goes outside the axes area. If True, the + annotation will only be drawn when the *xy* is inside the + axes. If False, the annotation will always be drawn regardless + of its position. The default is *None*, which behave as True + only if *xycoords* is"data". + Additional kwargs are Text properties: %(Text)s Modified: trunk/matplotlib/src/_png.cpp =================================================================== --- trunk/matplotlib/src/_png.cpp 2010-02-08 15:57:45 UTC (rev 8116) +++ trunk/matplotlib/src/_png.cpp 2010-02-08 16:00:23 UTC (rev 8117) @@ -336,7 +336,11 @@ //free the png memory png_read_end(png_ptr, info_ptr); +#ifndef png_infopp_NULL + png_destroy_read_struct(&png_ptr, &info_ptr, NULL); +#else png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL); +#endif if (close_file) { fclose(fp); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lee...@us...> - 2010-02-08 16:54:32
|
Revision: 8118 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8118&view=rev Author: leejjoon Date: 2010-02-08 16:54:26 +0000 (Mon, 08 Feb 2010) Log Message: ----------- RendererAgg.draw_image supports affine transform Modified Paths: -------------- trunk/matplotlib/examples/api/demo_affine_image.py trunk/matplotlib/lib/matplotlib/backends/backend_agg.py trunk/matplotlib/src/_backend_agg.cpp Modified: trunk/matplotlib/examples/api/demo_affine_image.py =================================================================== --- trunk/matplotlib/examples/api/demo_affine_image.py 2010-02-08 16:00:23 UTC (rev 8117) +++ trunk/matplotlib/examples/api/demo_affine_image.py 2010-02-08 16:54:26 UTC (rev 8118) @@ -3,7 +3,7 @@ """ For the backends that supports draw_image with optional affine -transform (e.g., ps backend), the image of the output should +transform (e.g., agg, ps backend), the image of the output should have its boundary matches the red rectangles. """ @@ -33,7 +33,8 @@ ax = plt.subplot(111) Z = get_image() im = imshow_affine(ax, Z, interpolation='nearest', cmap=cm.jet, - origin='lower', extent=[-2, 4, -3, 2]) + origin='lower', + extent=[-2, 4, -3, 2], clip_on=True) trans_data2 = mtransforms.Affine2D().rotate_deg(30) + ax.transData im.set_transform(trans_data2) @@ -48,4 +49,5 @@ ax.set_xlim(-3, 5) ax.set_ylim(-4, 4) - plt.savefig("demo_affine_image") + plt.show() + #plt.savefig("demo_affine_image") Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2010-02-08 16:00:23 UTC (rev 8117) +++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2010-02-08 16:54:26 UTC (rev 8118) @@ -261,6 +261,12 @@ # with the Agg backend return True + def option_scale_image(self): + """ + agg backend support arbitrary scaling of image. + """ + return True + def restore_region(self, region, bbox=None, xy=None): """ restore the saved region. if bbox (instance of BboxBase, or Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2010-02-08 16:00:23 UTC (rev 8117) +++ trunk/matplotlib/src/_backend_agg.cpp 2010-02-08 16:54:26 UTC (rev 8118) @@ -814,55 +814,99 @@ RendererAgg::draw_image(const Py::Tuple& args) { _VERBOSE("RendererAgg::draw_image"); - args.verify_length(4); + args.verify_length(4, 7); // 7 if affine matrix if given GCAgg gc(args[0], dpi); - double x = mpl_round(Py::Float(args[1])); - double y = mpl_round(Py::Float(args[2])); Image *image = static_cast<Image*>(args[3].ptr()); bool has_clippath = false; + agg::trans_affine affine_trans; + bool has_affine = false; + double x, y, w, h; + + if (args.size() == 7) { + has_affine = true; + x = Py::Float(args[1]); + y = Py::Float(args[2]); + w = Py::Float(args[4]); + h = Py::Float(args[5]); + affine_trans = py_to_agg_transformation_matrix(args[6].ptr()); + } else { + x = mpl_round(Py::Float(args[1])); + y = mpl_round(Py::Float(args[2])); + } + + theRasterizer.reset_clipping(); rendererBase.reset_clipping(true); + set_clipbox(gc.cliprect, theRasterizer); has_clippath = render_clippath(gc.clippath, gc.clippath_trans); Py::Tuple empty; image->flipud_out(empty); pixfmt pixf(*(image->rbufOut)); - if (has_clippath) { + if (has_affine | has_clippath) { agg::trans_affine mtx; - mtx *= agg::trans_affine_translation((int)x, (int)(height-(y+image->rowsOut))); + agg::path_storage rect; - agg::path_storage rect; + if (has_affine) { + mtx *= agg::trans_affine_scaling(1, -1); + mtx *= agg::trans_affine_translation(0, image->rowsOut); + mtx *= agg::trans_affine_scaling(w/(image->colsOut), h/(image->rowsOut)); + mtx *= agg::trans_affine_translation(x, y); + mtx *= affine_trans; + mtx *= agg::trans_affine_scaling(1.0, -1.0); + mtx *= agg::trans_affine_translation(0.0, (double) height); + } else { + mtx *= agg::trans_affine_translation((int)x, (int)(height-(y+image->rowsOut))); + } + rect.move_to(0, 0); rect.line_to(image->colsOut, 0); rect.line_to(image->colsOut, image->rowsOut); rect.line_to(0, image->rowsOut); rect.line_to(0, 0); + agg::conv_transform<agg::path_storage> rect2(rect, mtx); agg::trans_affine inv_mtx(mtx); inv_mtx.invert(); + typedef agg::span_allocator<agg::rgba8> color_span_alloc_type; - typedef agg::pixfmt_amask_adaptor<pixfmt, alpha_mask_type> pixfmt_amask_type; - typedef agg::renderer_base<pixfmt_amask_type> amask_ren_type; typedef agg::image_accessor_clip<agg::pixfmt_rgba32> image_accessor_type; typedef agg::span_interpolator_linear<> interpolator_type; typedef agg::span_image_filter_rgba_nn<image_accessor_type, interpolator_type> image_span_gen_type; - typedef agg::renderer_scanline_aa<amask_ren_type, color_span_alloc_type, image_span_gen_type> renderer_type; + color_span_alloc_type sa; image_accessor_type ia(pixf, agg::rgba8(0, 0, 0, 0)); interpolator_type interpolator(inv_mtx); image_span_gen_type image_span_generator(ia, interpolator); - pixfmt_amask_type pfa(pixFmt, alphaMask); - amask_ren_type r(pfa); - renderer_type ri(r, sa, image_span_generator); - theRasterizer.add_path(rect2); - agg::render_scanlines(theRasterizer, slineP8, ri); + + if (has_clippath) { + typedef agg::pixfmt_amask_adaptor<pixfmt, alpha_mask_type> pixfmt_amask_type; + typedef agg::renderer_base<pixfmt_amask_type> amask_ren_type; + typedef agg::renderer_scanline_aa<amask_ren_type, color_span_alloc_type, image_span_gen_type> renderer_type_alpha; + + pixfmt_amask_type pfa(pixFmt, alphaMask); + amask_ren_type r(pfa); + renderer_type_alpha ri(r, sa, image_span_generator); + + theRasterizer.add_path(rect2); + agg::render_scanlines(theRasterizer, slineP8, ri); + } else { + typedef agg::renderer_base<pixfmt> ren_type; + typedef agg::renderer_scanline_aa<ren_type, color_span_alloc_type, image_span_gen_type> renderer_type; + ren_type r(pixFmt); + renderer_type ri(r, sa, image_span_generator); + + theRasterizer.add_path(rect2); + agg::render_scanlines(theRasterizer, slineP8, ri); + } + } else { set_clipbox(gc.cliprect, rendererBase); rendererBase.blend_from(pixf, 0, (int)x, (int)(height-(y+image->rowsOut))); @@ -873,6 +917,9 @@ return Py::Object(); } + + + template<class path_t> void RendererAgg::_draw_path(path_t& path, bool has_clippath, const facepair_t& face, const GCAgg& gc) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2010-02-09 13:04:51
|
Revision: 8122 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8122&view=rev Author: mdboom Date: 2010-02-09 13:04:44 +0000 (Tue, 09 Feb 2010) Log Message: ----------- Use a custom encoding containing all of the used glyphs when writing out a Postscript Type 3 font. This resolves a bug when converting Ps output containing non-standard characters (such as the minus sign) to Pdf using ps2pdf/gs 8.7 or later. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py trunk/matplotlib/ttconv/pprdrv_tt.cpp Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2010-02-08 17:50:27 UTC (rev 8121) +++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2010-02-09 13:04:44 UTC (rev 8122) @@ -396,7 +396,7 @@ imagecmd = "false 3 colorimage" return h, w, bits, imagecmd - + def draw_image(self, gc, x, y, im, dx=None, dy=None, transform=None): """ Draw the Image instance into the current axes; x is the @@ -1110,6 +1110,14 @@ for c in chars: gind = cmap.get(c) or 0 glyph_ids.append(gind) + + fonttype = rcParams['ps.fonttype'] + + # Can not use more than 255 characters from a + # single font for Type 3 + if len(glyph_ids) > 255: + fonttype = 42 + # The ttf to ps (subsetting) support doesn't work for # OpenType fonts that are Postscript inside (like the # STIX fonts). This will simply turn that off to avoid @@ -1118,7 +1126,7 @@ raise RuntimeError("OpenType CFF fonts can not be saved using the internal Postscript backend at this time.\nConsider using the Cairo backend.") else: fonttype = rcParams['ps.fonttype'] - convert_ttf_to_ps(font_filename, fh, rcParams['ps.fonttype'], glyph_ids) + convert_ttf_to_ps(font_filename, fh, fonttype, glyph_ids) print >>fh, "end" print >>fh, "%%EndProlog" @@ -1394,7 +1402,7 @@ """ paper_option = "-sPAPERSIZE=%s" % ptype - + psfile = tmpfile + '.ps' outfile = tmpfile + '.output' dpi = rcParams['ps.distiller.res'] @@ -1436,7 +1444,7 @@ if eps: paper_option = "-dEPSCrop" else: paper_option = "-sPAPERSIZE=%s" % ptype - + command = 'ps2pdf -dAutoFilterColorImages=false \ -sColorImageFilter=FlateEncode %s "%s" "%s" > "%s"'% \ (paper_option, tmpfile, pdffile, outfile) Modified: trunk/matplotlib/ttconv/pprdrv_tt.cpp =================================================================== --- trunk/matplotlib/ttconv/pprdrv_tt.cpp 2010-02-08 17:50:27 UTC (rev 8121) +++ trunk/matplotlib/ttconv/pprdrv_tt.cpp 2010-02-09 13:04:44 UTC (rev 8122) @@ -58,10 +58,10 @@ ULONG val=0; for(x=0; x<4; x++) - { - val *= 0x100; - val += p[x]; - } + { + val *= 0x100; + val += p[x]; + } return val; } /* end of ftohULONG() */ @@ -75,10 +75,10 @@ USHORT val=0; for(x=0; x<2; x++) - { - val *= 0x100; - val += p[x]; - } + { + val *= 0x100; + val += p[x]; + } return val; } /* end of getUSHORT() */ @@ -120,38 +120,38 @@ ptr = font->offset_table + 12; x=0; while(TRUE) - { - if( strncmp((const char*)ptr,name,4) == 0 ) - { - ULONG offset,length; - BYTE *table; + { + if( strncmp((const char*)ptr,name,4) == 0 ) + { + ULONG offset,length; + BYTE *table; - offset = getULONG( ptr + 8 ); - length = getULONG( ptr + 12 ); - table = (BYTE*)calloc( sizeof(BYTE), length ); + offset = getULONG( ptr + 8 ); + length = getULONG( ptr + 12 ); + table = (BYTE*)calloc( sizeof(BYTE), length ); - try { + try { #ifdef DEBUG_TRUETYPE - debug("Loading table \"%s\" from offset %d, %d bytes",name,offset,length); + 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( 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& ) { - free(table); - throw; - } - return table; - } + if( fread(table,sizeof(BYTE),length,font->file) != (sizeof(BYTE) * length)) + throw TTException("TrueType font may be corrupt (reason 4)"); + } catch (TTException& ) { + free(table); + throw; + } + return table; + } - x++; - ptr += 16; - if(x == font->numTables) - throw TTException("TrueType font is missing table"); - } + x++; + ptr += 16; + if(x == font->numTables) + throw TTException("TrueType font is missing table"); + } } /* end of GetTable() */ @@ -165,12 +165,12 @@ void Read_name(struct TTFONT *font) { BYTE *table_ptr,*ptr2; - int numrecords; /* Number of strings in this table */ - BYTE *strings; /* pointer to start of string storage */ + int numrecords; /* Number of strings in this table */ + BYTE *strings; /* pointer to start of string storage */ int x; - int platform,encoding; /* Current platform id, encoding id, */ - int language,nameid; /* language id, name id, */ - int offset,length; /* offset and length of string. */ + 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()"); @@ -192,136 +192,136 @@ } font->Copyright = font->Trademark = (char*)NULL; - table_ptr = GetTable(font, "name"); /* pointer to table */ + table_ptr = GetTable(font, "name"); /* pointer to table */ try { - numrecords = getUSHORT( table_ptr + 2 ); /* number of names */ - strings = table_ptr + getUSHORT( table_ptr + 4 ); /* start of string storage */ + 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) - { - platform = getUSHORT(ptr2); - encoding = getUSHORT(ptr2+2); - language = getUSHORT(ptr2+4); - nameid = getUSHORT(ptr2+6); - length = getUSHORT(ptr2+8); - offset = getUSHORT(ptr2+10); + { + platform = getUSHORT(ptr2); + encoding = getUSHORT(ptr2+2); + language = getUSHORT(ptr2+4); + nameid = getUSHORT(ptr2+6); + length = getUSHORT(ptr2+8); + offset = getUSHORT(ptr2+10); #ifdef DEBUG_TRUETYPE - debug("platform %d, encoding %d, language 0x%x, name %d, offset %d, length %d", - platform,encoding,language,nameid,offset,length); + debug("platform %d, encoding %d, language 0x%x, name %d, offset %d, length %d", + platform,encoding,language,nameid,offset,length); #endif - /* Copyright notice */ - if( platform == 1 && nameid == 0 ) - { - font->Copyright = (char*)calloc(sizeof(char),length+1); - strncpy(font->Copyright,(const char*)strings+offset,length); - font->Copyright[length]=(char)NULL; - replace_newlines_with_spaces(font->Copyright); + /* Copyright notice */ + if( platform == 1 && nameid == 0 ) + { + font->Copyright = (char*)calloc(sizeof(char),length+1); + 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); + debug("font->Copyright=\"%s\"",font->Copyright); #endif - continue; - } + continue; + } - /* Font Family name */ - if( platform == 1 && nameid == 1 ) - { - free(font->FamilyName); - font->FamilyName = (char*)calloc(sizeof(char),length+1); - strncpy(font->FamilyName,(const char*)strings+offset,length); - font->FamilyName[length]=(char)NULL; - replace_newlines_with_spaces(font->FamilyName); + /* Font Family name */ + if( platform == 1 && nameid == 1 ) + { + free(font->FamilyName); + font->FamilyName = (char*)calloc(sizeof(char),length+1); + 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); + debug("font->FamilyName=\"%s\"",font->FamilyName); #endif - continue; - } + continue; + } - /* Font Family name */ - if( platform == 1 && nameid == 2 ) - { - free(font->Style); - font->Style = (char*)calloc(sizeof(char),length+1); - strncpy(font->Style,(const char*)strings+offset,length); - font->Style[length]=(char)NULL; - replace_newlines_with_spaces(font->Style); + /* Font Family name */ + if( platform == 1 && nameid == 2 ) + { + free(font->Style); + font->Style = (char*)calloc(sizeof(char),length+1); + 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); + debug("font->Style=\"%s\"",font->Style); #endif - continue; - } + continue; + } - /* Full Font name */ - if( platform == 1 && nameid == 4 ) - { - free(font->FullName); - font->FullName = (char*)calloc(sizeof(char),length+1); - strncpy(font->FullName,(const char*)strings+offset,length); - font->FullName[length]=(char)NULL; - replace_newlines_with_spaces(font->FullName); + /* Full Font name */ + if( platform == 1 && nameid == 4 ) + { + free(font->FullName); + font->FullName = (char*)calloc(sizeof(char),length+1); + 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); + debug("font->FullName=\"%s\"",font->FullName); #endif - continue; - } + continue; + } - /* Version string */ - if( platform == 1 && nameid == 5 ) - { - free(font->Version); - font->Version = (char*)calloc(sizeof(char),length+1); - strncpy(font->Version,(const char*)strings+offset,length); - font->Version[length]=(char)NULL; - replace_newlines_with_spaces(font->Version); + /* Version string */ + if( platform == 1 && nameid == 5 ) + { + free(font->Version); + font->Version = (char*)calloc(sizeof(char),length+1); + strncpy(font->Version,(const char*)strings+offset,length); + font->Version[length]=(char)NULL; + replace_newlines_with_spaces(font->Version); #ifdef DEBUG_TRUETYPE - debug("font->Version=\"%s\"",font->Version); + debug("font->Version=\"%s\"",font->Version); #endif - continue; - } + continue; + } - /* PostScript name */ - if( platform == 1 && nameid == 6 ) - { - free(font->PostName); - font->PostName = (char*)calloc(sizeof(char),length+1); - strncpy(font->PostName,(const char*)strings+offset,length); - font->PostName[length]=(char)NULL; - replace_newlines_with_spaces(font->PostName); + /* PostScript name */ + if( platform == 1 && nameid == 6 ) + { + free(font->PostName); + font->PostName = (char*)calloc(sizeof(char),length+1); + strncpy(font->PostName,(const char*)strings+offset,length); + font->PostName[length]=(char)NULL; + replace_newlines_with_spaces(font->PostName); #ifdef DEBUG_TRUETYPE - debug("font->PostName=\"%s\"",font->PostName); + debug("font->PostName=\"%s\"",font->PostName); #endif - continue; - } + continue; + } - /* Trademark string */ - if( platform == 1 && nameid == 7 ) - { - font->Trademark = (char*)calloc(sizeof(char),length+1); - strncpy(font->Trademark,(const char*)strings+offset,length); - font->Trademark[length]=(char)NULL; - replace_newlines_with_spaces(font->Trademark); + /* Trademark string */ + if( platform == 1 && nameid == 7 ) + { + font->Trademark = (char*)calloc(sizeof(char),length+1); + 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); + debug("font->Trademark=\"%s\"",font->Trademark); #endif - continue; - } + continue; + } - } + } } catch (TTException& ) { free(table_ptr); throw; @@ -346,17 +346,17 @@ ** font manufacturer's revision number for the font. */ if( font->target_type == PS_TYPE_42 ) - { - stream.printf("%%!PS-TrueTypeFont-%d.%d-%d.%d\n", - font->TTVersion.whole, font->TTVersion.fraction, - font->MfrRevision.whole, font->MfrRevision.fraction); - } + { + stream.printf("%%!PS-TrueTypeFont-%d.%d-%d.%d\n", + font->TTVersion.whole, font->TTVersion.fraction, + font->MfrRevision.whole, font->MfrRevision.fraction); + } /* If it is not a Type 42 font, we will use a different format. */ else - { - stream.putline("%!PS-Adobe-3.0 Resource-Font"); - } /* See RBIIp 641 */ + { + stream.putline("%!PS-Adobe-3.0 Resource-Font"); + } /* See RBIIp 641 */ /* We will make the title the name of the font. */ stream.printf("%%%%Title: %s\n",font->FullName); @@ -367,46 +367,46 @@ /* We created this file. */ if( font->target_type == PS_TYPE_42 ) - stream.putline("%%Creator: Converted from TrueType to type 42 by PPR"); + stream.putline("%%Creator: Converted from TrueType to type 42 by PPR"); else - stream.putline("%%Creator: Converted from TrueType by PPR"); + stream.putline("%%Creator: Converted from TrueType by PPR"); /* If VM usage information is available, print it. */ if( font->target_type == PS_TYPE_42 ) - { - VMMin = (int)getULONG( font->post_table + 16 ); - VMMax = (int)getULONG( font->post_table + 20 ); - if( VMMin > 0 && VMMax > 0 ) - stream.printf("%%%%VMUsage: %d %d\n",VMMin,VMMax); - } + { + VMMin = (int)getULONG( font->post_table + 16 ); + VMMax = (int)getULONG( font->post_table + 20 ); + if( VMMin > 0 && VMMax > 0 ) + stream.printf("%%%%VMUsage: %d %d\n",VMMin,VMMax); + } /* Start the dictionary which will eventually */ /* become the font. */ if( font->target_type != PS_TYPE_3 ) - { - stream.putline("15 dict begin"); - } + { + stream.putline("15 dict begin"); + } else - { - stream.putline("25 dict begin"); + { + stream.putline("25 dict begin"); - /* Type 3 fonts will need some subroutines here. */ - stream.putline("/_d{bind def}bind def"); - stream.putline("/_m{moveto}_d"); - stream.putline("/_l{lineto}_d"); - stream.putline("/_cl{closepath eofill}_d"); - stream.putline("/_c{curveto}_d"); - stream.putline("/_sc{7 -1 roll{setcachedevice}{pop pop pop pop pop pop}ifelse}_d"); - stream.putline("/_e{exec}_d"); - } + /* Type 3 fonts will need some subroutines here. */ + stream.putline("/_d{bind def}bind def"); + stream.putline("/_m{moveto}_d"); + stream.putline("/_l{lineto}_d"); + stream.putline("/_cl{closepath eofill}_d"); + stream.putline("/_c{curveto}_d"); + stream.putline("/_sc{7 -1 roll{setcachedevice}{pop pop pop pop pop pop}ifelse}_d"); + stream.putline("/_e{exec}_d"); + } stream.printf("/FontName /%s def\n",font->PostName); stream.putline("/PaintType 0 def"); if(font->target_type == PS_TYPE_42) - stream.putline("/FontMatrix[1 0 0 1 0 0]def"); + stream.putline("/FontMatrix[1 0 0 1 0 0]def"); else - stream.putline("/FontMatrix[.001 0 0 .001 0 0]def"); + stream.putline("/FontMatrix[.001 0 0 .001 0 0]def"); stream.printf("/FontBBox[%d %d %d %d]def\n",font->llx,font->lly,font->urx,font->ury); stream.printf("/FontType %d def\n", font->target_type ); @@ -414,11 +414,25 @@ /*------------------------------------------------------------- ** Define the encoding array for this font. -** It seems best to just use "Standard". +** Since we don't really want to deal with converting all of +** the possible font encodings in the wild to a standard PS +** one, we just explicitly create one for each font. -------------------------------------------------------------*/ -void ttfont_encoding(TTStreamWriter& stream) +void ttfont_encoding(TTStreamWriter& stream, struct TTFONT *font, std::vector<int>& glyph_ids, font_type_enum target_type) { - stream.putline("/Encoding StandardEncoding def"); + if (target_type == PS_TYPE_3) { + stream.printf("/Encoding [ "); + + for (std::vector<int>::const_iterator i = glyph_ids.begin(); + i != glyph_ids.end(); ++i) { + const char* name = ttfont_CharStrings_getname(font, *i); + stream.printf("/%s ", name); + } + + stream.printf("] def\n"); + } else { + stream.putline("/Encoding StandardEncoding def"); + } } /* end of ttfont_encoding() */ /*----------------------------------------------------------- @@ -439,13 +453,13 @@ stream.printf("/FullName (%s) def\n",font->FullName); if( font->Copyright != (char*)NULL || font->Trademark != (char*)NULL ) - { - stream.printf("/Notice (%s", - font->Copyright != (char*)NULL ? font->Copyright : ""); - stream.printf("%s%s) def\n", - font->Trademark != (char*)NULL ? " " : "", - font->Trademark != (char*)NULL ? font->Trademark : ""); - } + { + stream.printf("/Notice (%s", + font->Copyright != (char*)NULL ? font->Copyright : ""); + stream.printf("%s%s) def\n", + font->Trademark != (char*)NULL ? " " : "", + font->Trademark != (char*)NULL ? font->Trademark : ""); + } /* This information is not quite correct. */ stream.printf("/Weight (%s) def\n",font->Style); @@ -494,12 +508,12 @@ static const char hexdigits[]="0123456789ABCDEF"; if(!in_string) - { - stream.put_char('<'); - string_len=0; - line_len++; - in_string=TRUE; - } + { + stream.put_char('<'); + string_len=0; + line_len++; + in_string=TRUE; + } stream.put_char( hexdigits[ n / 16 ] ); stream.put_char( hexdigits[ n % 16 ] ); @@ -507,10 +521,10 @@ line_len+=2; if(line_len > 70) - { - stream.put_char('\n'); - line_len=0; - } + { + stream.put_char('\n'); + line_len=0; + } } /* end of sfnts_pputBYTE() */ @@ -553,17 +567,17 @@ void sfnts_end_string(TTStreamWriter& stream) { if(in_string) - { - string_len=0; /* fool sfnts_pputBYTE() */ + { + string_len=0; /* fool sfnts_pputBYTE() */ - #ifdef DEBUG_TRUETYPE_INLINE - puts("\n% dummy byte:\n"); - #endif + #ifdef DEBUG_TRUETYPE_INLINE + puts("\n% dummy byte:\n"); + #endif - sfnts_pputBYTE(stream, 0); /* extra byte for pre-2013 compatibility */ - stream.put_char('>'); - line_len++; - } + sfnts_pputBYTE(stream, 0); /* extra byte for pre-2013 compatibility */ + stream.put_char('>'); + line_len++; + } in_string=FALSE; } /* end of sfnts_end_string() */ @@ -589,7 +603,7 @@ ULONG off; ULONG length; int c; - ULONG total=0; /* running total of bytes written to table */ + ULONG total=0; /* running total of bytes written to table */ int x; #ifdef DEBUG_TRUETYPE @@ -604,58 +618,58 @@ /* Copy the glyphs one by one */ for(x=0; x < font->numGlyphs; x++) - { - /* Read the glyph offset from the index-to-location table. */ - if(font->indexToLocFormat == 0) - { - off = getUSHORT( font->loca_table + (x * 2) ); - off *= 2; - length = getUSHORT( font->loca_table + ((x+1) * 2) ); - length *= 2; - length -= off; - } - else - { - off = getULONG( font->loca_table + (x * 4) ); - length = getULONG( font->loca_table + ((x+1) * 4) ); - length -= off; - } + { + /* Read the glyph offset from the index-to-location table. */ + if(font->indexToLocFormat == 0) + { + off = getUSHORT( font->loca_table + (x * 2) ); + off *= 2; + length = getUSHORT( font->loca_table + ((x+1) * 2) ); + length *= 2; + length -= off; + } + else + { + off = getULONG( font->loca_table + (x * 4) ); + length = getULONG( font->loca_table + ((x+1) * 4) ); + length -= off; + } - #ifdef DEBUG_TRUETYPE - debug("glyph length=%d",(int)length); - #endif + #ifdef DEBUG_TRUETYPE + debug("glyph length=%d",(int)length); + #endif - /* Start new string if necessary. */ - sfnts_new_table( stream, (int)length ); + /* Start new string if necessary. */ + sfnts_new_table( stream, (int)length ); - /* - ** Make sure the glyph is padded out to a - ** two byte boundary. - */ - if( length % 2 ) - throw TTException("TrueType font contains a 'glyf' table without 2 byte padding"); + /* + ** Make sure the glyph is padded out to a + ** two byte boundary. + */ + if( length % 2 ) + throw TTException("TrueType font contains a 'glyf' table without 2 byte padding"); - /* Copy the bytes of the glyph. */ - while( length-- ) - { - if( (c = fgetc(font->file)) == EOF ) - throw TTException("TrueType font may be corrupt (reason 6)"); + /* Copy the bytes of the glyph. */ + while( length-- ) + { + if( (c = fgetc(font->file)) == EOF ) + throw TTException("TrueType font may be corrupt (reason 6)"); - sfnts_pputBYTE(stream, c); - total++; /* add to running total */ - } + 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 ) - { - sfnts_pputBYTE(stream, 0); - total++; - } + { + sfnts_pputBYTE(stream, 0); + total++; + } } /* end of sfnts_glyf_table() */ @@ -667,32 +681,32 @@ */ void ttfont_sfnts(TTStreamWriter& stream, struct TTFONT *font) { - static const char *table_names[] = /* The names of all tables */ - { /* which it is worth while */ - "cvt ", /* to include in a Type 42 */ - "fpgm", /* PostScript font. */ - "glyf", - "head", - "hhea", - "hmtx", - "loca", - "maxp", - "prep" - } ; + static const char *table_names[] = /* The names of all tables */ + { /* which it is worth while */ + "cvt ", /* to include in a Type 42 */ + "fpgm", /* PostScript font. */ + "glyf", + "head", + "hhea", + "hmtx", + "loca", + "maxp", + "prep" + } ; - struct { /* The location of each of */ - ULONG oldoffset; /* the above tables. */ - ULONG newoffset; - ULONG length; - ULONG checksum; - } tables[9]; + struct { /* The location of each of */ + ULONG oldoffset; /* the above tables. */ + ULONG newoffset; + 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. */ + BYTE *ptr; /* A pointer into the origional table directory. */ + ULONG x,y; /* General use loop countes. */ + int c; /* Input character. */ int diff; ULONG nextoffset; - int count; /* How many `important' tables did we find? */ + int count; /* How many `important' tables did we find? */ ptr = font->offset_table + 12; nextoffset=0; @@ -703,32 +717,32 @@ ** statistics in tables[]. */ for(x=0; x < 9; x++ ) - { - do { - diff = strncmp( (char*)ptr, table_names[x], 4 ); + { + do { + diff = strncmp( (char*)ptr, table_names[x], 4 ); - if( diff > 0 ) /* If we are past it. */ - { - tables[x].length = 0; - diff = 0; - } - else if( diff < 0 ) /* If we haven't hit it yet. */ - { - ptr += 16; - } - else if( diff == 0 ) /* Here it is! */ - { - tables[x].newoffset = nextoffset; - tables[x].checksum = getULONG( ptr + 4 ); - tables[x].oldoffset = getULONG( ptr + 8 ); - tables[x].length = getULONG( ptr + 12 ); - nextoffset += ( ((tables[x].length + 3) / 4) * 4 ); - count++; - ptr += 16; - } - } while(diff != 0); + if( diff > 0 ) /* If we are past it. */ + { + tables[x].length = 0; + diff = 0; + } + else if( diff < 0 ) /* If we haven't hit it yet. */ + { + ptr += 16; + } + else if( diff == 0 ) /* Here it is! */ + { + tables[x].newoffset = nextoffset; + tables[x].checksum = getULONG( ptr + 4 ); + tables[x].oldoffset = getULONG( ptr + 8 ); + tables[x].length = getULONG( ptr + 12 ); + nextoffset += ( ((tables[x].length + 3) / 4) * 4 ); + count++; + ptr += 16; + } + } while(diff != 0); - } /* end of for loop which passes over the table directory */ + } /* end of for loop which passes over the table directory */ /* Begin the sfnts array. */ sfnts_start(stream); @@ -737,95 +751,95 @@ /* Start by copying the TrueType version number. */ ptr = font->offset_table; for(x=0; x < 4; x++) - { - sfnts_pputBYTE( stream, *(ptr++) ); - } + { + sfnts_pputBYTE( stream, *(ptr++) ); + } /* Now, generate those silly numTables numbers. */ - sfnts_pputUSHORT(stream, count); /* number of tables */ + sfnts_pputUSHORT(stream, count); /* number of tables */ if( count == 9 ) - { - sfnts_pputUSHORT(stream, 7); /* searchRange */ - sfnts_pputUSHORT(stream, 3); /* entrySelector */ - sfnts_pputUSHORT(stream, 81); /* rangeShift */ - } + { + 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 /* Now, emmit the table directory. */ for(x=0; x < 9; x++) - { - if( tables[x].length == 0 ) /* Skip missing tables */ - continue; + { + if( tables[x].length == 0 ) /* Skip missing tables */ + continue; - /* Name */ - sfnts_pputBYTE( stream, table_names[x][0] ); - sfnts_pputBYTE( stream, table_names[x][1] ); - sfnts_pputBYTE( stream, table_names[x][2] ); - sfnts_pputBYTE( stream, table_names[x][3] ); + /* Name */ + sfnts_pputBYTE( stream, table_names[x][0] ); + 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 ); + /* Checksum */ + sfnts_pputULONG( stream, tables[x].checksum ); - /* Offset */ - sfnts_pputULONG( stream, tables[x].newoffset + 12 + (count * 16) ); + /* Offset */ + sfnts_pputULONG( stream, tables[x].newoffset + 12 + (count * 16) ); - /* Length */ - sfnts_pputULONG( stream, tables[x].length ); - } + /* Length */ + sfnts_pputULONG( stream, tables[x].length ); + } /* Now, send the tables */ for(x=0; x < 9; x++) - { - if( tables[x].length == 0 ) /* skip tables that aren't there */ - continue; + { + if( tables[x].length == 0 ) /* skip tables that aren't there */ + continue; - #ifdef DEBUG_TRUETYPE - debug("emmiting table '%s'",table_names[x]); - #endif + #ifdef DEBUG_TRUETYPE + debug("emmiting table '%s'",table_names[x]); + #endif - /* 'glyf' table gets special treatment */ - if( strcmp(table_names[x],"glyf")==0 ) - { - sfnts_glyf_table(stream,font,tables[x].oldoffset,tables[x].length); - } - 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"); + /* 'glyf' table gets special treatment */ + if( strcmp(table_names[x],"glyf")==0 ) + { + sfnts_glyf_table(stream,font,tables[x].oldoffset,tables[x].length); + } + 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"); - /* Start new string if necessary. */ - sfnts_new_table(stream, tables[x].length); + /* 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 ); + /* 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)"); + /* 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); - } - } + sfnts_pputBYTE(stream, c); + } + } - /* Padd it out to a four byte boundary. */ - y=tables[x].length; - while( (y % 4) != 0 ) - { - sfnts_pputBYTE(stream, 0); - y++; - #ifdef DEBUG_TRUETYPE_INLINE - puts("\n% pad byte:\n"); - #endif - } + /* Padd it out to a four byte boundary. */ + y=tables[x].length; + while( (y % 4) != 0 ) + { + sfnts_pputBYTE(stream, 0); + y++; + #ifdef DEBUG_TRUETYPE_INLINE + puts("\n% pad byte:\n"); + #endif + } - } /* End of loop for all tables */ + } /* End of loop for all tables */ /* Close the array. */ sfnts_end_string(stream); @@ -893,32 +907,32 @@ GlyphIndex = (int)getUSHORT( font->post_table + 34 + (charindex * 2) ); - if( GlyphIndex <= 257 ) /* If a standard Apple name, */ - { - return Apple_CharStrings[GlyphIndex]; - } - else /* Otherwise, use one */ - { /* of the pascal strings. */ - GlyphIndex -= 258; + if( GlyphIndex <= 257 ) /* If a standard Apple name, */ + { + return Apple_CharStrings[GlyphIndex]; + } + 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)); + /* Set pointer to start of Pascal strings. */ + ptr = (char*)(font->post_table + 34 + (font->numGlyphs * 2)); - len = (ULONG)*(ptr++); /* Step thru the strings */ - while(GlyphIndex--) /* until we get to the one */ - { /* that we want. */ - ptr += len; - len = (ULONG)*(ptr++); - } + len = (ULONG)*(ptr++); /* Step thru the strings */ + while(GlyphIndex--) /* until we get to the one */ + { /* that we want. */ + ptr += len; + len = (ULONG)*(ptr++); + } - if( len >= sizeof(temp) ) - throw TTException("TrueType font file contains a very long PostScript name"); + if( len >= sizeof(temp) ) + throw TTException("TrueType font file contains a very long PostScript name"); - strncpy(temp,ptr,len); /* Copy the pascal string into */ - temp[len]=(char)NULL; /* a buffer and make it ASCIIz. */ + strncpy(temp,ptr,len); /* Copy the pascal string into */ + temp[len]=(char)NULL; /* a buffer and make it ASCIIz. */ - return temp; - } + return temp; + } } /* end of ttfont_CharStrings_getname() */ /* @@ -932,28 +946,28 @@ 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"); + 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) - { - if(font->target_type == PS_TYPE_42) /* type 42 */ - { - stream.printf("/%s %d def\n",ttfont_CharStrings_getname(font, *i), *i); - } - else /* type 3 */ - { - stream.printf("/%s{",ttfont_CharStrings_getname(font, *i)); + i != glyph_ids.end(); ++i) + { + if(font->target_type == PS_TYPE_42) /* type 42 */ + { + stream.printf("/%s %d def\n",ttfont_CharStrings_getname(font, *i), *i); + } + else /* type 3 */ + { + stream.printf("/%s{",ttfont_CharStrings_getname(font, *i)); - tt_type3_charproc(stream, font, *i); + tt_type3_charproc(stream, font, *i); - stream.putline("}_d"); /* "} bind def" */ - } - } + stream.putline("}_d"); /* "} bind def" */ + } + } stream.putline("end readonly def"); } /* end of ttfont_CharStrings() */ @@ -967,27 +981,27 @@ /* If we are generating a type 3 font, we need to provide */ /* a BuildGlyph and BuildChar proceedures. */ if( font->target_type == PS_TYPE_3 ) - { - stream.put_char('\n'); + { + stream.put_char('\n'); - stream.putline("/BuildGlyph"); - stream.putline(" {exch begin"); /* start font dictionary */ - stream.putline(" CharStrings exch"); - stream.putline(" 2 copy known not{pop /.notdef}if"); - stream.putline(" true 3 1 roll get exec"); - stream.putline(" end}_d"); + stream.putline("/BuildGlyph"); + stream.putline(" {exch begin"); /* start font dictionary */ + stream.putline(" CharStrings exch"); + stream.putline(" 2 copy known not{pop /.notdef}if"); + stream.putline(" true 3 1 roll get exec"); + stream.putline(" end}_d"); - stream.put_char('\n'); + stream.put_char('\n'); - /* This proceedure is for compatiblity with */ - /* level 1 interpreters. */ - stream.putline("/BuildChar {"); - stream.putline(" 1 index /Encoding get exch get"); - stream.putline(" 1 index /BuildGlyph get exec"); - stream.putline("}_d"); + /* This proceedure is for compatiblity with */ + /* level 1 interpreters. */ + stream.putline("/BuildChar {"); + stream.putline(" 1 index /Encoding get exch get"); + stream.putline(" 1 index /BuildGlyph get exec"); + stream.putline("}_d"); - stream.put_char('\n'); - } + stream.put_char('\n'); + } /* If we are generating a type 42 font, we need to check to see */ /* if this PostScript interpreter understands type 42 fonts. If */ @@ -997,90 +1011,90 @@ /* generated by a Macintosh. That is where the TrueType interpreter */ /* setup instructions and part of BuildGlyph came from. */ else if( font->target_type == PS_TYPE_42 ) - { - stream.put_char('\n'); + { + stream.put_char('\n'); - /* If we have no "resourcestatus" command, or FontType 42 */ - /* is unknown, leave "true" on the stack. */ - stream.putline("systemdict/resourcestatus known"); - stream.putline(" {42 /FontType resourcestatus"); - stream.putline(" {pop pop false}{true}ifelse}"); - stream.putline(" {true}ifelse"); + /* If we have no "resourcestatus" command, or FontType 42 */ + /* is unknown, leave "true" on the stack. */ + stream.putline("systemdict/resourcestatus known"); + stream.putline(" {42 /FontType resourcestatus"); + stream.putline(" {pop pop false}{true}ifelse}"); + stream.putline(" {true}ifelse"); - /* If true, execute code to produce an error message if */ - /* we can't find Apple's TrueDict in VM. */ - stream.putline("{/TrueDict where{pop}{(%%[ Error: no TrueType rasterizer ]%%)= flush}ifelse"); + /* If true, execute code to produce an error message if */ + /* we can't find Apple's TrueDict in VM. */ + 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. */ - stream.putline("/FontType 3 def"); + /* Since we are expected to use Apple's TrueDict TrueType */ + /* reasterizer, change the font type to 3. */ + stream.putline("/FontType 3 def"); - /* Define a string to hold the state of the Apple */ - /* TrueType interpreter. */ - stream.putline(" /TrueState 271 string def"); + /* Define a string to hold the state of the Apple */ + /* TrueType interpreter. */ + stream.putline(" /TrueState 271 string def"); - /* It looks like we get information about the resolution */ - /* of the printer and store it in the TrueState string. */ - stream.putline(" TrueDict begin sfnts save"); - stream.putline(" 72 0 matrix defaultmatrix dtransform dup"); - stream.putline(" mul exch dup mul add sqrt cvi 0 72 matrix"); - stream.putline(" defaultmatrix dtransform dup mul exch dup"); - stream.putline(" mul add sqrt cvi 3 -1 roll restore"); - stream.putline(" TrueState initer end"); + /* It looks like we get information about the resolution */ + /* of the printer and store it in the TrueState string. */ + stream.putline(" TrueDict begin sfnts save"); + stream.putline(" 72 0 matrix defaultmatrix dtransform dup"); + stream.putline(" mul exch dup mul add sqrt cvi 0 72 matrix"); + stream.putline(" defaultmatrix dtransform dup mul exch dup"); + stream.putline(" mul add sqrt cvi 3 -1 roll restore"); + stream.putline(" TrueState initer end"); - /* This BuildGlyph procedure will look the name up in the */ - /* CharStrings array, and then check to see if what it gets */ - /* is a procedure. If it is, it executes it, otherwise, it */ - /* lets the TrueType rasterizer loose on it. */ + /* This BuildGlyph procedure will look the name up in the */ + /* CharStrings array, and then check to see if what it gets */ + /* is a procedure. If it is, it executes it, otherwise, it */ + /* lets the TrueType rasterizer loose on it. */ - /* When this proceedure is executed the stack contains */ - /* the font dictionary and the character name. We */ - /* exchange arguments and move the dictionary to the */ - /* dictionary stack. */ - stream.putline(" /BuildGlyph{exch begin"); - /* stack: charname */ + /* When this proceedure is executed the stack contains */ + /* the font dictionary and the character name. We */ + /* exchange arguments and move the dictionary to the */ + /* dictionary stack. */ + stream.putline(" /BuildGlyph{exch begin"); + /* stack: charname */ - /* Put two copies of CharStrings on the stack and consume */ - /* one testing to see if the charname is defined in it, */ - /* leave the answer on the stack. */ - stream.putline(" CharStrings dup 2 index known"); - /* stack: charname CharStrings bool */ + /* Put two copies of CharStrings on the stack and consume */ + /* one testing to see if the charname is defined in it, */ + /* leave the answer on the stack. */ + stream.putline(" CharStrings dup 2 index known"); + /* stack: charname CharStrings bool */ - /* Exchange the CharStrings dictionary and the charname, */ - /* but if the answer was false, replace the character name */ - /* with ".notdef". */ - stream.putline(" {exch}{exch pop /.notdef}ifelse"); - /* stack: CharStrings charname */ + /* Exchange the CharStrings dictionary and the charname, */ + /* but if the answer was false, replace the character name */ + /* with ".notdef". */ + stream.putline(" {exch}{exch pop /.notdef}ifelse"); + /* stack: CharStrings charname */ - /* Get the value from the CharStrings dictionary and see */ - /* if it is executable. */ - stream.putline(" get dup xcheck"); - /* stack: CharStrings_entry */ + /* Get the value from the CharStrings dictionary and see */ + /* if it is executable. */ + stream.putline(" get dup xcheck"); + /* stack: CharStrings_entry */ - /* If is a proceedure. Execute according to RBIIp 277-278. */ - stream.putline(" {currentdict systemdict begin begin exec end end}"); + /* If is a proceedure. Execute according to RBIIp 277-278. */ + stream.putline(" {currentdict systemdict begin begin exec end end}"); - /* Is a TrueType character index, let the rasterizer at it. */ - stream.putline(" {TrueDict begin /bander load cvlit exch TrueState render end}"); + /* Is a TrueType character index, let the rasterizer at it. */ + stream.putline(" {TrueDict begin /bander load cvlit exch TrueState render end}"); - stream.putline(" ifelse"); + stream.putline(" ifelse"); - /* Pop the font's dictionary off the stack. */ - stream.putline(" end}bind def"); + /* Pop the font's dictionary off the stack. */ + stream.putline(" end}bind def"); - /* This is the level 1 compatibility BuildChar procedure. */ - /* See RBIIp 281. */ - stream.putline(" /BuildChar{"); - stream.putline(" 1 index /Encoding get exch get"); - stream.putline(" 1 index /BuildGlyph get exec"); - stream.putline(" }bind def"); + /* This is the level 1 compatibility BuildChar procedure. */ + /* See RBIIp 281. */ + stream.putline(" /BuildChar{"); + stream.putline(" 1 index /Encoding get exch get"); + stream.putline(" 1 index /BuildGlyph get exec"); + stream.putline(" }bind def"); - /* Here we close the condition which is true */ - /* if the printer has no built-in TrueType */ - /* rasterizer. */ - stream.putline("}if"); - stream.put_char('\n'); - } /* end of if Type 42 not understood. */ + /* Here we close the condition which is true */ + /* if the printer has no built-in TrueType */ + /* rasterizer. */ + stream.putline("}if"); + stream.put_char('\n'); + } /* end of if Type 42 not understood. */ stream.putline("FontName currentdict end definefont pop"); /* stream.putline("%%EOF"); */ @@ -1102,7 +1116,7 @@ /* Open the font file */ if( (font.file = fopen(filename,"rb")) == (FILE*)NULL ) - throw TTException("Failed to open TrueType font"); + throw TTException("Failed to open TrueType font"); /* Allocate space for the unvarying part of the offset table. */ assert(font.offset_table == NULL); @@ -1110,7 +1124,7 @@ /* 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)"); + throw TTException("TrueType font may be corrupt (reason 1)"); /* Determine how many directory entries there are. */ font.numTables = getUSHORT( font.offset_table + 4 ); @@ -1123,7 +1137,7 @@ /* 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)"); + throw TTException("TrueType font may be corrupt (reason 2)"); /* Extract information from the "Offset" table. */ font.TTVersion = getFixed( font.offset_table ); @@ -1131,21 +1145,21 @@ /* Load the "head" table and extract information from it. */ ptr = GetTable(&font, "head"); try { - font.MfrRevision = getFixed( ptr + 4 ); /* font revision number */ + font.MfrRevision = getFixed( ptr + 4 ); /* font revision number */ font.unitsPerEm = getUSHORT( ptr + 18 ); font.HUPM = font.unitsPerEm / 2; #ifdef DEBUG_TRUETYPE debug("unitsPerEm=%d",(int)font.unitsPerEm); #endif - font.llx = topost2( getFWord( ptr + 36 ) ); /* bounding box info */ + font.llx = topost2( getFWord( ptr + 36 ) ); /* bounding box info */ font.lly = topost2( getFWord( ptr + 38 ) ); font.urx = topost2( getFWord( ptr + 40 ) ); font.ury = topost2( getFWord( ptr + 42 ) ); - font.indexToLocFormat = getSHORT( ptr + 50 ); /* size of 'loca' data */ + font.indexToLocFormat = getSHORT( ptr + 50 ); /* size of 'loca' data */ if(font.indexToLocFormat != 0 && font.indexToLocFormat != 1) - throw TTException("TrueType font is unusable because indexToLocFormat != 0"); + throw TTException("TrueType font is unusable because indexToLocFormat != 0"); if( getSHORT(ptr+52) != 0 ) - throw TTException("TrueType font is unusable because glyphDataFormat != 0"); + throw TTException("TrueType font is unusable because glyphDataFormat != 0"); } catch (TTException& ) { free(ptr); throw; @@ -1164,34 +1178,34 @@ /* have the 'loca' and 'glyf' tables arround while */ /* we are generating the CharStrings. */ if(font.target_type == PS_TYPE_3 || font.target_type == PDF_TYPE_3) - { - BYTE *ptr; /* We need only one value */ - ptr = GetTable(&font, "hhea"); - font.numberOfHMetrics = getUSHORT(ptr + 34); - free(ptr); + { + BYTE *ptr; /* We need only one value */ + ptr = GetTable(&font, "hhea"); + font.numberOfHMetrics = getUSHORT(ptr + 34); + free(ptr); - assert(font.loca_table == NULL); - font.loca_table = GetTable(&font,"loca"); - assert(font.glyf_table == NULL); - font.glyf_table = GetTable(&font,"glyf"); - assert(font.hmtx_table == NULL); - font.hmtx_table = GetTable(&font,"hmtx"); + assert(font.loca_table == NULL); + font.loca_table = GetTable(&font,"loca"); + assert(font.glyf_table == NULL); + font.glyf_table = GetTable(&font,"glyf"); + assert(font.hmtx_table == NULL); + font.hmtx_table = GetTable(&font,"hmtx"); } if (glyph_ids.size() == 0) { - glyph_ids.clear(); - glyph_ids.reserve(font.numGlyphs); - for (int x = 0; x < font.numGlyphs; ++x) { - glyph_ids.push_back(x); - } + glyph_ids.clear(); + glyph_ids.reserve(font.numGlyphs); + for (int x = 0; x < font.numGlyphs; ++x) { + glyph_ids.push_back(x); + } } else if (font.target_type == PS_TYPE_3) { - ttfont_add_glyph_dependencies(&font, glyph_ids); + ttfont_add_glyph_dependencies(&font, glyph_ids); } } /* end of insert_ttfont() */ void insert_ttfont(const char *filename, TTStreamWriter& stream, - font_type_enum target_type, std::vector<int>& glyph_ids) + font_type_enum target_type, std::vector<int>& glyph_ids) { struct TTFONT font; @@ -1201,7 +1215,7 @@ ttfont_header(stream, &font); /* Define the encoding. */ - ttfont_encoding(stream); + ttfont_encoding(stream, &font, glyph_ids, target_type); /* Insert FontInfo dictionary. */ ttfont_FontInfo(stream, &font); @@ -1224,10 +1238,10 @@ public: void write(const char* a) { - oss << a; + oss << a; } std::string str() { - return oss.str(); + return oss.str(); } }; @@ -1237,11 +1251,11 @@ read_font(filename, PDF_TYPE_3, glyph_ids, font); for (std::vector<int>::const_iterator i = glyph_ids.begin(); - i != glyph_ids.end(); ++i) { - StringStreamWriter writer; - tt_type3_charproc(writer, &font, *i); - const char* name = ttfont_CharStrings_getname(&font, *i); - dict.add_pair(name, writer.str().c_str()); + i != glyph_ids.end(); ++i) { + StringStreamWriter writer; + tt_type3_charproc(writer, &font, *i); + const char* name = ttfont_CharStrings_getname(&font, *i); + dict.add_pair(name, writer.str().c_str()); } } @@ -1263,7 +1277,7 @@ TTFONT::~TTFONT() { if (file) - fclose(file); + fclose(file); free(PostName); free(FullName); free(FamilyName); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <as...@us...> - 2010-02-12 02:21:15
|
Revision: 8127 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8127&view=rev Author: astraw Date: 2010-02-12 02:21:05 +0000 (Fri, 12 Feb 2010) Log Message: ----------- Add option to bootstrap confidence intervals for boxplot (Paul Hobson) Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/axes.py Added Paths: ----------- trunk/matplotlib/examples/pylab_examples/boxplot_demo3.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2010-02-11 13:15:28 UTC (rev 8126) +++ trunk/matplotlib/CHANGELOG 2010-02-12 02:21:05 UTC (rev 8127) @@ -1,3 +1,7 @@ +2010-02-11 Added 'bootstrap' option to boxplot. This allows bootstrap + estimates of median confidence intervals. Based on an + initial patch by Paul Hobson. - ADS + 2010-02-06 Added setup.cfg "basedirlist" option to override setting in setupext.py "basedir" dictionary; added "gnu0" platform requested by Benjamin Drung. - EF Added: trunk/matplotlib/examples/pylab_examples/boxplot_demo3.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/boxplot_demo3.py (rev 0) +++ trunk/matplotlib/examples/pylab_examples/boxplot_demo3.py 2010-02-12 02:21:05 UTC (rev 8127) @@ -0,0 +1,27 @@ +import matplotlib.pyplot as plt +import matplotlib.transforms as mtransforms +import numpy as np + +np.random.seed(2) +inc = 0.1 +e1 = np.random.uniform(0,1, size=(500,)) +e2 = np.random.uniform(0,1, size=(500,)) +e3 = np.random.uniform(0,1 + inc, size=(500,)) +e4 = np.random.uniform(0,1 + 2*inc, size=(500,)) + +treatments = [e1,e2,e3,e4] + +fig = plt.figure() +ax = fig.add_subplot(111) +pos = np.array(range(len(treatments)))+1 +bp = ax.boxplot( treatments, sym='k+', patch_artist=True, + positions=pos, notch=1, bootstrap=5000 ) +text_transform= mtransforms.blended_transform_factory(ax.transData, + ax.transAxes) +ax.set_xlabel('treatment') +ax.set_ylabel('response') +ax.set_ylim(-0.2, 1.4) +plt.setp(bp['whiskers'], color='k', linestyle='-' ) +plt.setp(bp['fliers'], markersize=3.0) +fig.subplots_adjust(right=0.99,top=0.99) +plt.show() Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2010-02-11 13:15:28 UTC (rev 8126) +++ trunk/matplotlib/lib/matplotlib/axes.py 2010-02-12 02:21:05 UTC (rev 8127) @@ -4881,7 +4881,8 @@ return (l0, caplines, barcols) def boxplot(self, x, notch=0, sym='b+', vert=1, whis=1.5, - positions=None, widths=None, patch_artist=False): + positions=None, widths=None, patch_artist=False, + bootstrap=None): """ call signature:: @@ -4910,6 +4911,16 @@ a function of the inner quartile range. They extend to the most extreme data point within ( ``whis*(75%-25%)`` ) data range. + *bootstrap* (default None) specifies whether to bootstrap the + confidence intervals around the median for notched + boxplots. If bootstrap==None, no bootstrapping is performed, + and notches are calculated using a Gaussian-based asymptotic + approximation (see McGill, R., Tukey, J.W., and Larsen, W.A., + 1978, and Kendall and Stuart, 1967). Otherwise, bootstrap + specifies the number of times to bootstrap the median to + determine it's 95% confidence intervals. Values between 1000 + and 10000 are recommended. + *positions* (default 1,2,...,n) sets the horizontal positions of the boxes. The ticks and limits are automatically set to match the positions. @@ -5021,8 +5032,33 @@ med_x = [box_x_min, box_x_max] # calculate 'notch' plot else: - notch_max = med + 1.57*iq/np.sqrt(row) - notch_min = med - 1.57*iq/np.sqrt(row) + if bootstrap is not None: + # Do a bootstrap estimate of notch locations. + def bootstrapMedian(data, N=5000): + # determine 95% confidence intervals of the median + M = len(data) + percentile = [2.5,97.5] + estimate = np.zeros(N) + for n in range(N): + bsIndex = np.random.random_integers(0,M-1,M) + bsData = data[bsIndex] + estimate[n] = mlab.prctile(bsData, 50) + CI = mlab.prctile(estimate, percentile) + return CI + + # get conf. intervals around median + CI = bootstrapMedian(d, N=bootstrap) + notch_max = CI[1] + notch_min = CI[0] + else: + # Estimate notch locations using Gaussian-based + # asymptotic approximation. + # + # For discussion: McGill, R., Tukey, J.W., + # and Larsen, W.A. (1978) "Variations of + # Boxplots", The American Statistician, 32:12-16. + notch_max = med + 1.57*iq/np.sqrt(row) + notch_min = med - 1.57*iq/np.sqrt(row) # make our notched box vectors box_x = [box_x_min, box_x_max, box_x_max, cap_x_max, box_x_max, box_x_max, box_x_min, box_x_min, cap_x_min, box_x_min, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <as...@us...> - 2010-02-12 17:25:03
|
Revision: 8128 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8128&view=rev Author: astraw Date: 2010-02-12 17:24:56 +0000 (Fri, 12 Feb 2010) Log Message: ----------- allow numpy 2.x to pass check for numpy >= 1.1 (reported by Nadia Dencheva) Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/__init__.py trunk/matplotlib/setupext.py Modified: trunk/matplotlib/lib/matplotlib/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/__init__.py 2010-02-12 02:21:05 UTC (rev 8127) +++ trunk/matplotlib/lib/matplotlib/__init__.py 2010-02-12 17:24:56 UTC (rev 8128) @@ -147,8 +147,10 @@ import numpy nn = numpy.__version__.split('.') if not (int(nn[0]) >= 1 and int(nn[1]) >= 1): - raise ImportError( - 'numpy 1.1 or later is required; you have %s' % numpy.__version__) + if not (int(nn[0]) >= 2): + raise ImportError( + '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/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2010-02-12 02:21:05 UTC (rev 8127) +++ trunk/matplotlib/setupext.py 2010-02-12 17:24:56 UTC (rev 8128) @@ -516,9 +516,11 @@ 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 + if not (int(nn[0]) >= 2): + 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) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lee...@us...> - 2010-02-16 23:09:57
|
Revision: 8136 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8136&view=rev Author: leejjoon Date: 2010-02-16 23:09:50 +0000 (Tue, 16 Feb 2010) Log Message: ----------- Merged revisions 8121,8135 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_99_maint ........ r8121 | jdh2358 | 2010-02-08 12:50:27 -0500 (Mon, 08 Feb 2010) | 1 line added Ariels csd patch for proper scaling at the dc component ........ r8135 | leejjoon | 2010-02-16 17:55:27 -0500 (Tue, 16 Feb 2010) | 1 line fix a bug in Text._get_layout that returns an incorrect information for an empty string ........ Modified Paths: -------------- trunk/matplotlib/doc/faq/installing_faq.rst trunk/matplotlib/doc/glossary/index.rst trunk/matplotlib/doc/users/installing.rst trunk/matplotlib/lib/matplotlib/mlab.py trunk/matplotlib/lib/matplotlib/text.py Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README trunk/matplotlib/doc/sphinxext/gen_gallery.py trunk/matplotlib/doc/sphinxext/gen_rst.py trunk/matplotlib/examples/misc/multiprocess.py trunk/matplotlib/examples/mplot3d/contour3d_demo.py trunk/matplotlib/examples/mplot3d/contourf3d_demo.py trunk/matplotlib/examples/mplot3d/polys3d_demo.py trunk/matplotlib/examples/mplot3d/scatter3d_demo.py trunk/matplotlib/examples/mplot3d/surface3d_demo.py trunk/matplotlib/examples/mplot3d/wire3d_demo.py trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_spines/spines_axes_positions.png Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/mathtex:1-7263 /branches/v0_99_maint:1-8116 + /branches/mathtex:1-7263 /branches/v0_99_maint:1-8135 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Modified: trunk/matplotlib/doc/faq/installing_faq.rst =================================================================== --- trunk/matplotlib/doc/faq/installing_faq.rst 2010-02-16 22:55:27 UTC (rev 8135) +++ trunk/matplotlib/doc/faq/installing_faq.rst 2010-02-16 23:09:50 UTC (rev 8136) @@ -146,11 +146,11 @@ others in web application servers to dynamically serve up graphs. To support all of these use cases, matplotlib can target different -outputs, and each of these capabililities is called a backend (the +outputs, and each of these capabililities is called a backend; the "frontend" is the user facing code, ie the plotting code, whereas the "backend" does all the dirty work behind the scenes to make the figure. There are two types of backends: user interface backends (for -use in pygtk, wxpython, tkinter, qt or fltk) and hardcopy backends to +use in pygtk, wxpython, tkinter, qt, macosx, or fltk) and hardcopy backends to make image files (PNG, SVG, PDF, PS). There are a two primary ways to configure your backend. One is to set @@ -183,10 +183,10 @@ renderer for user interfaces is ``Agg`` which uses the `antigrain <http://antigrain.html>`_ C++ library to make a raster (pixel) image of the figure. All of the user interfaces can be used with agg -rendering, eg ``WXAgg``, ``GTKAgg``, ``QTAgg``, ``TkAgg``. In -addition, some of the user interfaces support other rendering engines. -For example, with GTK, you can also select GDK rendering (backend -``GTK``) or Cairo rendering (backend ``GTKCairo``). +rendering, eg ``WXAgg``, ``GTKAgg``, ``QTAgg``, ``TkAgg``, +``CocoaAgg``. In addition, some of the user interfaces support other +rendering engines. For example, with GTK, you can also select GDK +rendering (backend ``GTK``) or Cairo rendering (backend ``GTKCairo``). For the rendering engines, one can also distinguish between `vector <http://en.wikipedia.org/wiki/Vector_graphics>`_ or `raster @@ -238,6 +238,7 @@ QtAgg Agg rendering to a :term:`Qt` canvas (requires PyQt_) Qt4Agg Agg rendering to a :term:`Qt4` canvas (requires PyQt4_) FLTKAgg Agg rendering to a :term:`FLTK` canvas (requires pyFLTK_) +macosx Cocoa rendering in OSX windows ============ ================================================================ .. _`Anti-Grain Geometry`: http://www.antigrain.com/ Modified: trunk/matplotlib/doc/glossary/index.rst =================================================================== --- trunk/matplotlib/doc/glossary/index.rst 2010-02-16 22:55:27 UTC (rev 8135) +++ trunk/matplotlib/doc/glossary/index.rst 2010-02-16 23:09:50 UTC (rev 8136) @@ -14,6 +14,11 @@ Cairo The `Cairo graphics <http://cairographics.org>`_ engine + + dateutil + The `dateutil <http://labix.org/python-dateutil>`_ library + provides extensions to the standard datetime module + EPS Encapsulated Postscript (`EPS <http://en.wikipedia.org/wiki/Encapsulated_PostScript>`_) @@ -86,6 +91,14 @@ language widely used for scripting, application development, web application servers, scientific computing and more. + + pytz + `pytz <http://pytz.sourceforge.net/>`_ provides the Olson tz + database in Python. it allows accurate and cross platform + timezone calculations and solves the issue of ambiguous times at + the end of daylight savings + + Qt `Qt <http://trolltech.com/products/qt/>`__ is a cross-platform application framework for desktop and embedded development. Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/pyplots/README:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/pyplots/README:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_gallery.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 + /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_gallery.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_rst.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 + /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_rst.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Modified: trunk/matplotlib/doc/users/installing.rst =================================================================== --- trunk/matplotlib/doc/users/installing.rst 2010-02-16 22:55:27 UTC (rev 8135) +++ trunk/matplotlib/doc/users/installing.rst 2010-02-16 23:09:50 UTC (rev 8136) @@ -44,11 +44,30 @@ matplotlib requires numpy version 1.1 or later. Although it is not a requirement to use matplotlib, we strongly encourage you to install `ipython <http://ipython.scipy.org/dist>`_, which is an interactive -shell for python that is matplotlib aware. Once you have ipython, -numpy and matplotlib installed, in ipython's "pylab" mode you have a -matlab-like environment that automatically handles most of the -configuration details for you, so you can get up and running quickly:: +shell for python that is matplotlib aware. +Next we need to get matplotlib installed. We provide prebuilt +binaries for OS X and Windows on the matplotlib `download +<http://sourceforge.net/projects/matplotlib/files/>`_ page. Click on +the latest release of the "matplotlib" package, choose your python +version (2.5 or 2.6) and your platform (macosx or win32) and you +should be good to go. If you have any problems, please check the +:ref:`installing-faq`, google around a little bit, and post a question +the `mailing list +<http://sourceforge.net/project/showfiles.php?group_id=80706>`_. If +you are on debian/unbuntu linux, it suffices to do:: + + > sudo apt-get install python-matplotlib + +Instructions for installing our OSX binaries are found in the FAQ +:ref:`install_osx_binaries`. + + +Once you have ipython, numpy and matplotlib installed, in ipython's +"pylab" mode you have a matlab-like environment that automatically +handles most of the configuration details for you, so you can get up +and running quickly:: + johnh@flag:~> ipython -pylab Python 2.4.5 (#4, Apr 12 2008, 09:09:16) IPython 0.9.0 -- An enhanced Interactive Python. @@ -60,20 +79,6 @@ In [2]: hist(x, 100) -And a *voila*, a figure pops up. But we are putting the cart ahead of -the horse -- first we need to get matplotlib installed. We provide -prebuilt binaries for OS X and Windows on the matplotlib `download -<http://sourceforge.net/projects/matplotlib/files/>`_ page. Click on -the latest release of the "matplotlib" package, choose your python -version (2.4 or 2.5) and your platform (macosx or win32) and you -should be good to go. If you have any problems, please check the -:ref:`installing-faq`, google around a little bit, and post a question -the `mailing list -<http://sourceforge.net/project/showfiles.php?group_id=80706>`_. - -Instructions for installing our OSX binaries are found in the FAQ -ref:`install_osx_binaries`. - Note that when testing matplotlib installations from the interactive python console, there are some issues relating to user interface toolkits and interactive settings that are discussed in @@ -85,9 +90,9 @@ ====================== If you are interested perhaps in contributing to matplotlib -development, or just like to build everything yourself, it is not -difficult to build matplotlib from source. Grab the latest *tar.gz* -release file from `sourceforge +development, running the latest greatest code, or just like to +build everything yourself, it is not difficult to build matplotlib +from source. Grab the latest *tar.gz* release file from `sourceforge <http://sourceforge.net/project/showfiles.php?group_id=80706>`_, or if you want to develop matplotlib or just need the latest bugfixed version, grab the latest svn version :ref:`install-svn`. @@ -173,17 +178,17 @@ agg template source statically, so it will not affect anything on your system outside of matplotlib. -pytz 2007g or later +:term:`pytz` 2007g or later timezone handling for python datetime objects. By default, matplotlib will install pytz if it isn't already installed on your - system. To override the default, use setup.cfg to force or + system. To override the default, use :file:`setup.cfg to force or prevent installation of pytz. -dateutil 1.1 or later - extensions to python datetime handling. By - default, matplotlib will install dateutil if it isn't already - installed on your system. To override the default, use setup.cfg - to force or prevent installation of dateutil. +:term:`dateutil` 1.1 or later + provides extensions to python datetime handling. By default, matplotlib + will install dateutil if it isn't already installed on your + system. To override the default, use :file:`setup.cfg` to force + or prevent installation of dateutil. Property changes on: trunk/matplotlib/examples/misc/multiprocess.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/misc/log.py:5753-5771 /branches/v0_98_5_maint/examples/misc/log.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/misc/multiprocess.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 + /branches/v0_91_maint/examples/misc/log.py:5753-5771 /branches/v0_98_5_maint/examples/misc/log.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/misc/multiprocess.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Property changes on: trunk/matplotlib/examples/mplot3d/contour3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/contour.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contour.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contour3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 + /branches/v0_91_maint/examples/mplot3d/contour.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contour.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contour3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Property changes on: trunk/matplotlib/examples/mplot3d/contourf3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/contourf.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contourf.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contourf3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 + /branches/v0_91_maint/examples/mplot3d/contourf.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contourf.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contourf3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Property changes on: trunk/matplotlib/examples/mplot3d/polys3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/polys.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/polys.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/polys3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 + /branches/v0_91_maint/examples/mplot3d/polys.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/polys.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/polys3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Property changes on: trunk/matplotlib/examples/mplot3d/scatter3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/scatter.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/scatter.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/scatter3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 + /branches/v0_91_maint/examples/mplot3d/scatter.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/scatter.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/scatter3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Property changes on: trunk/matplotlib/examples/mplot3d/surface3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/surface.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/surface.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/surface3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 + /branches/v0_91_maint/examples/mplot3d/surface.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/surface.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/surface3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Property changes on: trunk/matplotlib/examples/mplot3d/wire3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/wire.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/wire.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/wire3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 + /branches/v0_91_maint/examples/mplot3d/wire.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/wire.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/wire3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Modified: trunk/matplotlib/lib/matplotlib/mlab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mlab.py 2010-02-16 22:55:27 UTC (rev 8135) +++ trunk/matplotlib/lib/matplotlib/mlab.py 2010-02-16 23:09:50 UTC (rev 8136) @@ -277,10 +277,18 @@ Pxy[:,i] = np.conjugate(fx[:numFreqs]) * fy[:numFreqs] # Scale the spectrum by the norm of the window to compensate for - # windowing loss; see Bendat & Piersol Sec 11.5.2. Also include - # scaling factors for one-sided densities and dividing by the sampling - # frequency, if desired. - Pxy *= scaling_factor / (np.abs(windowVals)**2).sum() + # windowing loss; see Bendat & Piersol Sec 11.5.2. + Pxy *= 1 / (np.abs(windowVals)**2).sum() + + # Also include scaling factors for one-sided densities and dividing by the + # sampling frequency, if desired. Scale everything, except the DC component + # and the NFFT/2 component: + Pxy[1:-1] *= scaling_factor + + #But do scale those components by Fs, if required + if scale_by_freq: + Pxy[[0,-1]] /= Fs + t = 1./Fs * (ind + NFFT / 2.) freqs = float(Fs) / pad_to * np.arange(numFreqs) Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/mathmpl.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 + /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/mathmpl.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/only_directives.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 + /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/only_directives.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/plot_directive.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 + /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/plot_directive.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_spines/spines_axes_positions.png ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_99_maint/lib/matplotlib/tests/baseline_images/test_spines/spines_axes_positions.png:7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116 + /branches/v0_99_maint/lib/matplotlib/tests/baseline_images/test_spines/spines_axes_positions.png:7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Modified: trunk/matplotlib/lib/matplotlib/text.py =================================================================== --- trunk/matplotlib/lib/matplotlib/text.py 2010-02-16 22:55:27 UTC (rev 8135) +++ trunk/matplotlib/lib/matplotlib/text.py 2010-02-16 23:09:50 UTC (rev 8136) @@ -300,9 +300,13 @@ baseline = None for i, line in enumerate(lines): clean_line, ismath = self.is_math_text(line) - w, h, d = get_text_width_height_descent(clean_line, - self._fontproperties, - ismath=ismath) + if clean_line: + w, h, d = get_text_width_height_descent(clean_line, + self._fontproperties, + ismath=ismath) + else: + w, h, d = 0, 0, 0 + if baseline is None: baseline = h - d whs[i] = w, h This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2010-02-17 02:33:08
|
Revision: 8138 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8138&view=rev Author: jdh2358 Date: 2010-02-17 02:33:01 +0000 (Wed, 17 Feb 2010) Log Message: ----------- added TJ's filled marker patch Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/axes.py trunk/matplotlib/lib/matplotlib/lines.py trunk/matplotlib/lib/matplotlib/path.py Added Paths: ----------- trunk/matplotlib/examples/pylab_examples/filledmarker_demo.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2010-02-17 02:15:13 UTC (rev 8137) +++ trunk/matplotlib/CHANGELOG 2010-02-17 02:33:01 UTC (rev 8138) @@ -1,3 +1,7 @@ +2010-02-16 Committed TJ's filled marker patch for + left|right|bottom|top|full filled markers. See + examples/pylab_examples/filledmarker_demo.py. JDH + 2010-02-11 Added 'bootstrap' option to boxplot. This allows bootstrap estimates of median confidence intervals. Based on an initial patch by Paul Hobson. - ADS Added: trunk/matplotlib/examples/pylab_examples/filledmarker_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/filledmarker_demo.py (rev 0) +++ trunk/matplotlib/examples/pylab_examples/filledmarker_demo.py 2010-02-17 02:33:01 UTC (rev 8138) @@ -0,0 +1,38 @@ +import itertools + +import numpy as np +import matplotlib.lines as mlines +import matplotlib.pyplot as plt + +colors = itertools.cycle(['b', 'g', 'r', 'c', 'm', 'y', 'k']) +altcolor = 'lightgreen' + +plt.rcParams['text.usetex'] = False # otherwise, '^' will cause trouble + +y = np.arange(10) +for marker in mlines.Line2D.filled_markers: + f = plt.figure() + f.text(.5,.95, "marker = %r" % marker, ha='center') + for i,fs in enumerate(mlines.Line2D.fillStyles): + color = colors.next() + + ax = f.add_subplot(121) + ax.plot(2*(4-i)+y, c=color, + marker=marker, + markersize=20, + fillstyle=fs, + label=fs) + ax.legend(loc=2) + ax.set_title('fillstyle') + + ax = f.add_subplot(122) + ax.plot(2*(4-i)+y, c=color, + marker=marker, + markersize=20, + markerfacecoloralt=altcolor, + fillstyle=fs, + label=fs) + ax.legend(loc=2) + ax.set_title('fillstyle') + +plt.show() Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2010-02-17 02:15:13 UTC (rev 8137) +++ trunk/matplotlib/lib/matplotlib/axes.py 2010-02-17 02:33:01 UTC (rev 8138) @@ -62,9 +62,21 @@ # Is fmt just a colorspec? try: color = mcolors.colorConverter.to_rgb(fmt) - return linestyle, marker, color # Yes. + + # We need to differentiate grayscale '1.0' from tri_down marker '1' + try: + fmtint = str(int(fmt)) + except ValueError: + return linestyle, marker, color # Yes + else: + if fmt != fmtint: + # user definitely doesn't want tri_down marker + return linestyle, marker, color # Yes + else: + # ignore converted color + color = None except ValueError: - pass # No, not just a color. + pass # No, not just a color. # handle the multi char special cases and strip them from the # string Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2010-02-17 02:15:13 UTC (rev 8137) +++ trunk/matplotlib/lib/matplotlib/lines.py 2010-02-17 02:33:01 UTC (rev 8138) @@ -142,6 +142,8 @@ filled_markers = ('o', '^', 'v', '<', '>', 's', 'd', 'D', 'h', 'H', 'p', '*') + fillStyles = ('full', 'left' , 'right' , 'bottom' , 'top') + zorder = 2 validCap = ('butt', 'round', 'projecting') validJoin = ('miter', 'round', 'bevel') @@ -167,6 +169,7 @@ markeredgewidth = None, markeredgecolor = None, markerfacecolor = None, + markerfacecoloralt = 'none', fillstyle = 'full', antialiased = None, dash_capstyle = None, @@ -232,6 +235,7 @@ self.set_markerfacecolor(markerfacecolor) + self.set_markerfacecoloralt(markerfacecoloralt) self.set_markeredgecolor(markeredgecolor) self.set_markeredgewidth(markeredgewidth) self.set_fillstyle(fillstyle) @@ -336,7 +340,7 @@ ACCEPTS: ['full' | 'left' | 'right' | 'bottom' | 'top'] """ - assert fs in ['full', 'left' , 'right' , 'bottom' , 'top'] + assert fs in self.fillStyles self._fillstyle = fs def set_markevery(self, every): @@ -586,18 +590,25 @@ return self._markeredgecolor def get_markeredgewidth(self): return self._markeredgewidth - def get_markerfacecolor(self): - if (self._markerfacecolor is None or - (is_string_like(self._markerfacecolor) and - self._markerfacecolor.lower()=='none') ): - return self._markerfacecolor - elif (is_string_like(self._markerfacecolor) and - self._markerfacecolor.lower() == 'auto'): + def _get_markerfacecolor(self, alt=False): + if alt: + fc = self._markerfacecoloralt + else: + fc = self._markerfacecolor + + if (fc is None or (is_string_like(fc) and fc.lower()=='none') ): + return fc + elif (is_string_like(fc) and fc.lower() == 'auto'): return self._color else: - return self._markerfacecolor + return fc + def get_markerfacecolor(self): + return self._get_markerfacecolor(alt=False) + def get_markerfacecoloralt(self): + return self._get_markerfacecolor(alt=True) + def get_markersize(self): return self._markersize def get_data(self, orig=True): @@ -820,14 +831,26 @@ def set_markerfacecolor(self, fc): """ - Set the marker face color + Set the marker face color. ACCEPTS: any matplotlib color """ - if fc is None : + if fc is None: fc = 'auto' + self._markerfacecolor = fc + def set_markerfacecoloralt(self, fc): + """ + Set the alternate marker face color. + + ACCEPTS: any matplotlib color + """ + if fc is None: + fc = 'auto' + + self._markerfacecoloralt = fc + def set_markersize(self, sz): """ Set the marker size in points @@ -872,6 +895,7 @@ def _draw_lines(self, renderer, gc, path, trans): self._lineFunc(renderer, gc, path, trans) + def _draw_mathtext_path(self, renderer, gc, path, trans): """ Draws mathtext markers '$...$' using TextPath object. @@ -904,6 +928,7 @@ rgbFace = self._get_rgb_face() renderer.draw_markers(gc, text, path_trans, path, trans, rgbFace) + def _draw_steps_pre(self, renderer, gc, path, trans): vertices = self._xy steps = ma.zeros((2*len(vertices)-1, 2), np.float_) @@ -915,6 +940,7 @@ path = path.transformed(self.get_transform()) self._lineFunc(renderer, gc, path, IdentityTransform()) + def _draw_steps_post(self, renderer, gc, path, trans): vertices = self._xy steps = ma.zeros((2*len(vertices)-1, 2), np.float_) @@ -926,6 +952,7 @@ path = path.transformed(self.get_transform()) self._lineFunc(renderer, gc, path, IdentityTransform()) + def _draw_steps_mid(self, renderer, gc, path, trans): vertices = self._xy steps = ma.zeros((2*len(vertices), 2), np.float_) @@ -944,10 +971,12 @@ def _draw_nothing(self, *args, **kwargs): pass + def _draw_solid(self, renderer, gc, path, trans): gc.set_linestyle('solid') renderer.draw_path(gc, path, trans) + def _draw_dashed(self, renderer, gc, path, trans): gc.set_linestyle('dashed') if self._dashSeq is not None: @@ -967,100 +996,146 @@ def _draw_point(self, renderer, gc, path, path_trans): - fs = self.get_fillstyle() - if fs!='full': - raise NotImplementedError('non-full markers have not been implemented for this marker style yet; please contribute') - + # just like _draw_circle + gc.set_snap(renderer.points_to_pixels(self._markersize) > 3.0) w = renderer.points_to_pixels(self._markersize) * \ self._point_size_reduction * 0.5 - gc.set_snap(renderer.points_to_pixels(self._markersize) > 3.0) + transform = Affine2D().scale(w) rgbFace = self._get_rgb_face() - transform = Affine2D().scale(w) - renderer.draw_markers( - gc, Path.unit_circle(), transform, path, path_trans, - rgbFace) + fs = self.get_fillstyle() + if fs=='full': + renderer.draw_markers( + gc, Path.unit_circle(), transform, path, path_trans, rgbFace) + else: + rgbFace_alt = self._get_rgb_face(alt=True) + # build a right-half circle + if fs=='bottom': rotate = 270. + elif fs=='top': rotate = 90. + elif fs=='left': rotate = 180. + else: rotate = 0. + righthalf = Path.unit_circle_righthalf() + transform = transform.rotate_deg(rotate) + renderer.draw_markers(gc, righthalf, transform, + path, path_trans, rgbFace) + transform = transform.rotate_deg(180.) + renderer.draw_markers(gc, righthalf, transform, + path, path_trans, rgbFace_alt) + + _draw_pixel_transform = Affine2D().translate(-0.5, -0.5) def _draw_pixel(self, renderer, gc, path, path_trans): + gc.set_snap(False) + rgbFace = self._get_rgb_face() fs = self.get_fillstyle() - if fs!='full': - raise NotImplementedError('non-full markers have not been implemented for this marker style yet; please contribute') - - rgbFace = self._get_rgb_face() - gc.set_snap(False) + # There is no visible difference, so always paint it 'full' renderer.draw_markers(gc, Path.unit_rectangle(), self._draw_pixel_transform, path, path_trans, rgbFace) def _draw_circle(self, renderer, gc, path, path_trans): - fs = self.get_fillstyle() - if fs!='full': - raise NotImplementedError('non-full markers have not been implemented for this marker style yet; please contribute') - + gc.set_snap(renderer.points_to_pixels(self._markersize) > 3.0) w = renderer.points_to_pixels(self._markersize) * 0.5 - gc.set_snap(renderer.points_to_pixels(self._markersize) > 3.0) + transform = Affine2D().scale(w, w) rgbFace = self._get_rgb_face() - transform = Affine2D().scale(w, w) - renderer.draw_markers( - gc, Path.unit_circle(), transform, path, path_trans, - rgbFace) + fs = self.get_fillstyle() + if fs=='full': + renderer.draw_markers(gc, Path.unit_circle(), transform, + path, path_trans, rgbFace) + else: + rgbFace_alt = self._get_rgb_face(alt=True) + # build a right-half circle + if fs=='bottom': rotate = 270. + elif fs=='top': rotate = 90. + elif fs=='left': rotate = 180. + else: rotate = 0. + righthalf = Path.unit_circle_righthalf() + transform = transform.rotate_deg(rotate) + renderer.draw_markers(gc, righthalf, transform, + path, path_trans, rgbFace) + transform = transform.rotate_deg(180.) + renderer.draw_markers(gc, righthalf, transform, + path, path_trans, rgbFace_alt) + _triangle_path = Path([[0.0, 1.0], [-1.0, -1.0], [1.0, -1.0], [0.0, 1.0]]) - def _draw_triangle_up(self, renderer, gc, path, path_trans): - - fs = self.get_fillstyle() - if fs!='full': - raise NotImplementedError('non-full markers have not been implemented for this marker style yet; please contribute') - + # Going down halfway looks to small. Golden ratio is too far. + _triangle_path_u = Path([[0.0, 1.0], [-3/5., -1/5.], [3/5., -1/5.], [0.0, 1.0]]) + _triangle_path_d = Path([[-3/5., -1/5.], [3/5., -1/5.], [1.0, -1.0], [-1.0, -1.0], [-3/5., -1/5.]]) + _triangle_path_l = Path([[0.0, 1.0], [0.0, -1.0], [-1.0, -1.0], [0.0, 1.0]]) + _triangle_path_r = Path([[0.0, 1.0], [0.0, -1.0], [1.0, -1.0], [0.0, 1.0]]) + def _draw_triangle(self, renderer, gc, path, path_trans, direction): gc.set_snap(renderer.points_to_pixels(self._markersize) >= 5.0) offset = 0.5*renderer.points_to_pixels(self._markersize) - transform = Affine2D().scale(offset, offset) + assert direction in ['up', 'down', 'left', 'right'] + if direction == 'up': + x,y = offset, offset + rot = 0.0 + skip = 0 + elif direction == 'down': + x,y = offset, offset + rot = 180.0 + skip = 2 + elif direction == 'left': + x,y = offset, offset + rot = 90.0 + skip = 3 + else: + x,y = offset, offset + rot = 270.0 + skip = 1 + transform = Affine2D().scale(x,y).rotate_deg(rot) rgbFace = self._get_rgb_face() - renderer.draw_markers(gc, self._triangle_path, transform, - path, path_trans, rgbFace) + fs = self.get_fillstyle() + if fs=='full': + renderer.draw_markers(gc, self._triangle_path, transform, + path, path_trans, rgbFace) + else: + rgbFace_alt = self._get_rgb_face(alt=True) + mpaths = [self._triangle_path_u, + self._triangle_path_l, + self._triangle_path_d, + self._triangle_path_r] + + if fs=='top': + mpath = mpaths[(0+skip) % 4] + mpath_alt = mpaths[(2+skip) % 4] + elif fs=='bottom': + mpath = mpaths[(2+skip) % 4] + mpath_alt = mpaths[(0+skip) % 4] + elif fs=='left': + mpath = mpaths[(1+skip) % 4] + mpath_alt = mpaths[(3+skip) % 4] + else: + mpath = mpaths[(3+skip) % 4] + mpath_alt = mpaths[(1+skip) % 4] + + renderer.draw_markers(gc, mpath, transform, + path, path_trans, rgbFace) + renderer.draw_markers(gc, mpath_alt, transform, + path, path_trans, rgbFace_alt) + + + def _draw_triangle_up(self, renderer, gc, path, path_trans): + self._draw_triangle(renderer, gc, path, path_trans, 'up') + + def _draw_triangle_down(self, renderer, gc, path, path_trans): - fs = self.get_fillstyle() - if fs!='full': - raise NotImplementedError('non-full markers have not been implemented for this marker style yet; please contribute') + self._draw_triangle(renderer, gc, path, path_trans, 'down') - gc.set_snap(renderer.points_to_pixels(self._markersize) >= 5.0) - offset = 0.5*renderer.points_to_pixels(self._markersize) - transform = Affine2D().scale(offset, -offset) - rgbFace = self._get_rgb_face() - renderer.draw_markers(gc, self._triangle_path, transform, - path, path_trans, rgbFace) - def _draw_triangle_left(self, renderer, gc, path, path_trans): - fs = self.get_fillstyle() - if fs!='full': - raise NotImplementedError('non-full markers have not been implemented for this marker style yet; please contribute') + self._draw_triangle(renderer, gc, path, path_trans, 'left') - gc.set_snap(renderer.points_to_pixels(self._markersize) >= 5.0) - offset = 0.5*renderer.points_to_pixels(self._markersize) - transform = Affine2D().scale(offset, offset).rotate_deg(90) - rgbFace = self._get_rgb_face() - renderer.draw_markers(gc, self._triangle_path, transform, - path, path_trans, rgbFace) - def _draw_triangle_right(self, renderer, gc, path, path_trans): - fs = self.get_fillstyle() - if fs!='full': - raise NotImplementedError('non-full markers have not been implemented for this marker style yet; please contribute') + self._draw_triangle(renderer, gc, path, path_trans, 'right') - gc.set_snap(renderer.points_to_pixels(self._markersize) >= 5.0) - offset = 0.5*renderer.points_to_pixels(self._markersize) - transform = Affine2D().scale(offset, offset).rotate_deg(-90) - rgbFace = self._get_rgb_face() - renderer.draw_markers(gc, self._triangle_path, transform, - path, path_trans, rgbFace) - def _draw_square(self, renderer, gc, path, path_trans): gc.set_snap(renderer.points_to_pixels(self._markersize) >= 2.0) side = renderer.points_to_pixels(self._markersize) @@ -1071,6 +1146,7 @@ renderer.draw_markers(gc, Path.unit_rectangle(), transform, path, path_trans, rgbFace) else: + rgbFace_alt = self._get_rgb_face(alt=True) # build a bottom filled square out of two rectangles, one # filled. Use the rotation to support left, right, bottom # or top @@ -1080,86 +1156,226 @@ else: rotate = 90. bottom = Path([[0.0, 0.0], [1.0, 0.0], [1.0, 0.5], [0.0, 0.5], [0.0, 0.0]]) - top = Path([[0.0, 0.5], [1.0, 0.5], [1.0, 1.0], [0.0, 1.0], [0.0, 0.05]]) + top = Path([[0.0, 0.5], [1.0, 0.5], [1.0, 1.0], [0.0, 1.0], [0.0, 0.5]]) transform = transform.rotate_deg(rotate) renderer.draw_markers(gc, bottom, transform, path, path_trans, rgbFace) renderer.draw_markers(gc, top, transform, - path, path_trans, None) + path, path_trans, rgbFace_alt) + def _draw_diamond(self, renderer, gc, path, path_trans): - fs = self.get_fillstyle() - if fs!='full': - raise NotImplementedError('non-full markers have not been implemented for this marker style yet; please contribute') gc.set_snap(renderer.points_to_pixels(self._markersize) >= 5.0) side = renderer.points_to_pixels(self._markersize) transform = Affine2D().translate(-0.5, -0.5).rotate_deg(45).scale(side) + rgbFace = self._get_rgb_face() - renderer.draw_markers(gc, Path.unit_rectangle(), transform, - path, path_trans, rgbFace) + fs = self.get_fillstyle() + if fs=='full': + renderer.draw_markers(gc, Path.unit_rectangle(), transform, + path, path_trans, rgbFace) + else: + right = Path([[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 0.0]]) + left = Path([[0.0, 0.0], [0.0, 1.0], [1.0, 1.0], [0.0, 0.0]]) + if fs=='bottom': rotate = 270. + elif fs=='top': rotate = 90. + elif fs=='left': rotate = 180. + else: rotate = 0. + transform = transform.rotate_deg(rotate) + rgbFace_alt = self._get_rgb_face(alt=True) + + renderer.draw_markers(gc, right, transform, + path, path_trans, rgbFace) + renderer.draw_markers(gc, left, transform, + path, path_trans, rgbFace_alt) + + def _draw_thin_diamond(self, renderer, gc, path, path_trans): - fs = self.get_fillstyle() - if fs!='full': - raise NotImplementedError('non-full markers have not been implemented for this marker style yet; please contribute') gc.set_snap(renderer.points_to_pixels(self._markersize) >= 3.0) offset = renderer.points_to_pixels(self._markersize) transform = Affine2D().translate(-0.5, -0.5) \ - .rotate_deg(45).scale(offset * 0.6, offset) + .rotate_deg(45) + rgbFace = self._get_rgb_face() - renderer.draw_markers(gc, Path.unit_rectangle(), transform, - path, path_trans, rgbFace) + fs = self.get_fillstyle() + if fs=='full': + transform = transform.scale(offset * 0.6, offset) + renderer.draw_markers(gc, Path.unit_rectangle(), transform, + path, path_trans, rgbFace) + else: + right = Path([[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 0.0]]) + left = Path([[0.0, 0.0], [0.0, 1.0], [1.0, 1.0], [0.0, 0.0]]) + if fs=='bottom': rotate = 270. + elif fs=='top': rotate = 90. + elif fs=='left': rotate = 180. + else: rotate = 0. + # scale after rotation + transform = transform.rotate_deg(rotate).scale(offset * 0.6, offset) + rgbFace_alt = self._get_rgb_face(alt=True) + + renderer.draw_markers(gc, right, transform, + path, path_trans, rgbFace) + renderer.draw_markers(gc, left, transform, + path, path_trans, rgbFace_alt) + + def _draw_pentagon(self, renderer, gc, path, path_trans): - fs = self.get_fillstyle() - if fs!='full': - raise NotImplementedError('non-full markers have not been implemented for this marker style yet; please contribute') gc.set_snap(renderer.points_to_pixels(self._markersize) >= 5.0) offset = 0.5 * renderer.points_to_pixels(self._markersize) transform = Affine2D().scale(offset) + rgbFace = self._get_rgb_face() - renderer.draw_markers(gc, Path.unit_regular_polygon(5), transform, - path, path_trans, rgbFace) + fs = self.get_fillstyle() + polypath = Path.unit_regular_polygon(5) + + if fs == 'full': + renderer.draw_markers(gc, polypath, transform, + path, path_trans, rgbFace) + else: + verts = polypath.vertices + + y = (1+np.sqrt(5))/4. + top = Path([verts[0], verts[1], verts[4], verts[0]]) + bottom = Path([verts[1], verts[2], verts[3], verts[4], verts[1]]) + left = Path([verts[0], verts[1], verts[2], [0,-y], verts[0]]) + right = Path([verts[0], verts[4], verts[3], [0,-y], verts[0]]) + + if fs == 'top': + mpath, mpath_alt = top, bottom + elif fs == 'bottom': + mpath, mpath_alt = bottom, top + elif fs == 'left': + mpath, mpath_alt = left, right + else: + mpath, mpath_alt = right, left + + rgbFace_alt = self._get_rgb_face(alt=True) + renderer.draw_markers(gc, mpath, transform, + path, path_trans, rgbFace) + renderer.draw_markers(gc, mpath_alt, transform, + path, path_trans, rgbFace_alt) + + def _draw_star(self, renderer, gc, path, path_trans): - fs = self.get_fillstyle() - if fs!='full': - raise NotImplementedError('non-full markers have not been implemented for this marker style yet; please contribute') gc.set_snap(renderer.points_to_pixels(self._markersize) >= 5.0) offset = 0.5 * renderer.points_to_pixels(self._markersize) transform = Affine2D().scale(offset) + rgbFace = self._get_rgb_face() - _starpath = Path.unit_regular_star(5, innerCircle=0.381966) - renderer.draw_markers(gc, _starpath, transform, - path, path_trans, rgbFace) + fs = self.get_fillstyle() + polypath = Path.unit_regular_star(5, innerCircle=0.381966) + if fs == 'full': + renderer.draw_markers(gc, polypath, transform, + path, path_trans, rgbFace) + else: + verts = polypath.vertices + + top = Path(np.vstack((verts[0:4,:], verts[7:10,:], verts[0]))) + bottom = Path(np.vstack((verts[3:8,:], verts[3]))) + left = Path(np.vstack((verts[0:6,:], verts[0]))) + right = Path(np.vstack((verts[0], verts[5:10,:], verts[0]))) + + if fs == 'top': + mpath, mpath_alt = top, bottom + elif fs == 'bottom': + mpath, mpath_alt = bottom, top + elif fs == 'left': + mpath, mpath_alt = left, right + else: + mpath, mpath_alt = right, left + + rgbFace_alt = self._get_rgb_face(alt=True) + renderer.draw_markers(gc, mpath, transform, + path, path_trans, rgbFace) + renderer.draw_markers(gc, mpath_alt, transform, + path, path_trans, rgbFace_alt) + + def _draw_hexagon1(self, renderer, gc, path, path_trans): - fs = self.get_fillstyle() - if fs!='full': - raise NotImplementedError('non-full markers have not been implemented for this marker style yet; please contribute') - gc.set_snap(renderer.points_to_pixels(self._markersize) >= 5.0) + gc.set_snap(renderer.points_to_pixels(self._markersize) >= 5.0) offset = 0.5 * renderer.points_to_pixels(self._markersize) transform = Affine2D().scale(offset) + rgbFace = self._get_rgb_face() - renderer.draw_markers(gc, Path.unit_regular_polygon(6), transform, - path, path_trans, rgbFace) + fs = self.get_fillstyle() + polypath = Path.unit_regular_polygon(6) + if fs == 'full': + renderer.draw_markers(gc, polypath, transform, + path, path_trans, rgbFace) + else: + verts = polypath.vertices + + # not drawing inside lines + x = abs(np.cos(5*np.pi/6.)) + top = Path(np.vstack(([-x,0],verts[(1,0,5),:],[x,0]))) + bottom = Path(np.vstack(([-x,0],verts[2:5,:],[x,0]))) + left = Path(verts[(0,1,2,3),:]) + right = Path(verts[(0,5,4,3),:]) + + if fs == 'top': + mpath, mpath_alt = top, bottom + elif fs == 'bottom': + mpath, mpath_alt = bottom, top + elif fs == 'left': + mpath, mpath_alt = left, right + else: + mpath, mpath_alt = right, left + + rgbFace_alt = self._get_rgb_face(alt=True) + renderer.draw_markers(gc, mpath, transform, + path, path_trans, rgbFace) + renderer.draw_markers(gc, mpath_alt, transform, + path, path_trans, rgbFace_alt) + + def _draw_hexagon2(self, renderer, gc, path, path_trans): - fs = self.get_fillstyle() - if fs!='full': - raise NotImplementedError('non-full markers have not been implemented for this marker style yet; please contribute') - gc.set_snap(renderer.points_to_pixels(self._markersize) >= 5.0) + gc.set_snap(renderer.points_to_pixels(self._markersize) >= 5.0) offset = 0.5 * renderer.points_to_pixels(self._markersize) transform = Affine2D().scale(offset).rotate_deg(30) + rgbFace = self._get_rgb_face() - renderer.draw_markers(gc, Path.unit_regular_polygon(6), transform, - path, path_trans, rgbFace) + fs = self.get_fillstyle() + polypath = Path.unit_regular_polygon(6) + if fs == 'full': + renderer.draw_markers(gc, polypath, transform, + path, path_trans, rgbFace) + else: + verts = polypath.vertices + + # not drawing inside lines + x, y = np.sqrt(3)/4, 3/4. + top = Path(verts[(1,0,5,4,1),:]) + bottom = Path(verts[(1,2,3,4),:]) + left = Path(np.vstack(([x,y],verts[(0,1,2),:],[-x,-y],[x,y]))) + right = Path(np.vstack(([x,y],verts[(5,4,3),:],[-x,-y]))) + + if fs == 'top': + mpath, mpath_alt = top, bottom + elif fs == 'bottom': + mpath, mpath_alt = bottom, top + elif fs == 'left': + mpath, mpath_alt = left, right + else: + mpath, mpath_alt = right, left + + rgbFace_alt = self._get_rgb_face(alt=True) + renderer.draw_markers(gc, mpath, transform, + path, path_trans, rgbFace) + renderer.draw_markers(gc, mpath_alt, transform, + path, path_trans, rgbFace_alt) + + _line_marker_path = Path([[0.0, -1.0], [0.0, 1.0]]) def _draw_vline(self, renderer, gc, path, path_trans): gc.set_snap(renderer.points_to_pixels(self._markersize) >= 1.0) @@ -1314,6 +1530,7 @@ self._color = other._color self._markersize = other._markersize self._markerfacecolor = other._markerfacecolor + self._markerfacecoloralt = other._markerfacecoloralt self._markeredgecolor = other._markeredgecolor self._markeredgewidth = other._markeredgewidth self._fillstyle = other._fillstyle @@ -1329,8 +1546,8 @@ self._drawstyle = other._drawstyle - def _get_rgb_face(self): - facecolor = self.get_markerfacecolor() + def _get_rgb_face(self, alt=False): + facecolor = self._get_markerfacecolor(alt=alt) if is_string_like(facecolor) and facecolor.lower()=='none': rgbFace = None else: @@ -1369,8 +1586,11 @@ def set_mfc(self, val): 'alias for set_markerfacecolor' - self.set_markerfacecolor(val) + self.set_markerfacecolor(val, alt=alt) + def set_mfcalt(self, val): + 'alias for set_markerfacecoloralt' + self.set_markerfacecoloralt(val) def set_ms(self, val): 'alias for set_markersize' @@ -1409,6 +1629,9 @@ 'alias for get_markerfacecolor' return self.get_markerfacecolor() + def get_mfcalt(self, alt=False): + 'alias for get_markerfacecoloralt' + return self.get_markerfacecoloralt() def get_ms(self): 'alias for get_markersize' @@ -1577,6 +1800,7 @@ lineStyles = Line2D._lineStyles lineMarkers = Line2D._markers drawStyles = Line2D.drawStyles +fillStyles = Line2D.fillStyles docstring.interpd.update(Line2D = artist.kwdoc(Line2D)) Modified: trunk/matplotlib/lib/matplotlib/path.py =================================================================== --- trunk/matplotlib/lib/matplotlib/path.py 2010-02-17 02:15:13 UTC (rev 8137) +++ trunk/matplotlib/lib/matplotlib/path.py 2010-02-17 02:33:01 UTC (rev 8138) @@ -500,7 +500,55 @@ cls._unit_circle = cls(vertices, codes) return cls._unit_circle + _unit_circle_righthalf = None + @classmethod + def unit_circle_righthalf(cls): + """ + (staticmethod) Returns a :class:`Path` of the right half + of a unit circle. The circle is approximated using cubic Bezier + curves. This uses 4 splines around the circle using the approach + presented here: + + Lancaster, Don. `Approximating a Circle or an Ellipse Using Four + Bezier Cubic Splines <http://www.tinaja.com/glib/ellipse4.pdf>`_. + """ + if cls._unit_circle_righthalf is None: + MAGIC = 0.2652031 + SQRTHALF = np.sqrt(0.5) + MAGIC45 = np.sqrt((MAGIC*MAGIC) / 2.0) + + vertices = np.array( + [[0.0, -1.0], + + [MAGIC, -1.0], + [SQRTHALF-MAGIC45, -SQRTHALF-MAGIC45], + [SQRTHALF, -SQRTHALF], + + [SQRTHALF+MAGIC45, -SQRTHALF+MAGIC45], + [1.0, -MAGIC], + [1.0, 0.0], + + [1.0, MAGIC], + [SQRTHALF+MAGIC45, SQRTHALF-MAGIC45], + [SQRTHALF, SQRTHALF], + + [SQRTHALF-MAGIC45, SQRTHALF+MAGIC45], + [MAGIC, 1.0], + [0.0, 1.0], + + [0.0, -1.0]], + + np.float_) + + codes = cls.CURVE4 * np.ones(14) + codes[0] = cls.MOVETO + codes[-1] = cls.CLOSEPOLY + + cls._unit_circle_righthalf = cls(vertices, codes) + return cls._unit_circle_righthalf + + @classmethod def arc(cls, theta1, theta2, n=None, is_wedge=False): """ (staticmethod) Returns an arc on the unit circle from angle This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2010-02-17 15:25:46
|
Revision: 8140 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8140&view=rev Author: jdh2358 Date: 2010-02-17 15:25:38 +0000 (Wed, 17 Feb 2010) Log Message: ----------- added customizable keymap patch; L or k works for log scaling xaxis Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/doc/users/navigation_toolbar.rst trunk/matplotlib/lib/matplotlib/backend_bases.py trunk/matplotlib/lib/matplotlib/rcsetup.py trunk/matplotlib/matplotlibrc.template Property Changed: ---------------- trunk/matplotlib/ Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/mathtex:1-7263 /branches/v0_99_maint:1-8135 + <<<<<<< (modified) /branches/mathtex:1-7263 /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7253 /trunk/matplotlib:1-7315======= /branches/mathtex:1-7263 /branches/v0_99_maint:1-8135>>>>>>> (latest) Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2010-02-17 02:43:26 UTC (rev 8139) +++ trunk/matplotlib/CHANGELOG 2010-02-17 15:25:38 UTC (rev 8140) @@ -1,3 +1,8 @@ +2010-02-17 Added Gokhan's and Mattias' customizable keybindings patch + for the toolbar. You can now set the keymap.* properties + in the matplotlibrc file. Newbindings were added for + toggling log scaling on the x-axis. JDH + 2010-02-16 Committed TJ's filled marker patch for left|right|bottom|top|full filled markers. See examples/pylab_examples/filledmarker_demo.py. JDH Modified: trunk/matplotlib/doc/users/navigation_toolbar.rst =================================================================== --- trunk/matplotlib/doc/users/navigation_toolbar.rst 2010-02-17 02:43:26 UTC (rev 8139) +++ trunk/matplotlib/doc/users/navigation_toolbar.rst 2010-02-17 15:25:38 UTC (rev 8140) @@ -79,6 +79,8 @@ Navigation Keyboard Shortcuts ----------------------------- +The following table holds all the default keys, which can be overwritten by use of your matplotlibrc (#keymap.\*). + ================================== ============================================== Command Keyboard Shortcut(s) ================================== ============================================== @@ -93,6 +95,7 @@ Constrain pan/zoom to y axis hold **y** Preserve aspect ratio hold **CONTROL** Toggle grid **g** +Toggle x axis scale (log/linear) **L** or **k** Toggle y axis scale (log/linear) **l** ================================== ============================================== Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backend_bases.py 2010-02-17 02:43:26 UTC (rev 8139) +++ trunk/matplotlib/lib/matplotlib/backend_bases.py 2010-02-17 15:25:38 UTC (rev 8140) @@ -1888,50 +1888,85 @@ # self.destroy() # how cruel to have to destroy oneself! # return - if event.key == 'f': + # Load key-mappings from your matplotlibrc file. + fullscreen_keys = rcParams['keymap.fullscreen'] + home_keys = rcParams['keymap.home'] + back_keys = rcParams['keymap.back'] + forward_keys = rcParams['keymap.forward'] + pan_keys = rcParams['keymap.pan'] + zoom_keys = rcParams['keymap.zoom'] + save_keys = rcParams['keymap.save'] + grid_keys = rcParams['keymap.grid'] + toggle_yscale_keys = rcParams['keymap.yscale'] + toggle_xscale_keys = rcParams['keymap.xscale'] + all = rcParams['keymap.all_axes'] + + # toggle fullscreen mode (default key 'f') + if event.key in fullscreen_keys: self.full_screen_toggle() - # *h*ome or *r*eset mnemonic - elif event.key == 'h' or event.key == 'r' or event.key == "home": + # home or reset mnemonic (default key 'h', 'home' and 'r') + elif event.key in home_keys: self.canvas.toolbar.home() - # c and v to enable left handed quick navigation - elif event.key == 'left' or event.key == 'c' or event.key == 'backspace': + # forward / backward keys to enable left handed quick navigation + # (default key for backward: 'left', 'backspace' and 'c') + elif event.key in back_keys: self.canvas.toolbar.back() - elif event.key == 'right' or event.key == 'v': + # (default key for forward: 'right' and 'v') + elif event.key in forward_keys: self.canvas.toolbar.forward() - # *p*an mnemonic - elif event.key == 'p': + # pan mnemonic (default key 'p') + elif event.key in pan_keys: self.canvas.toolbar.pan() - # z*o*om mnemonic - elif event.key == 'o': + # zoom mnemonic (default key 'o') + elif event.key in zoom_keys: self.canvas.toolbar.zoom() - elif event.key == 's': + # saving current figure (default key 's') + elif event.key in save_keys: self.canvas.toolbar.save_figure(self.canvas.toolbar) if event.inaxes is None: return # the mouse has to be over an axes to trigger these - if event.key == 'g': + # switching on/off a grid in current axes (default key 'g') + if event.key in grid_keys: event.inaxes.grid() self.canvas.draw() - elif event.key == 'l': + # toggle scaling of y-axes between 'log and 'linear' (default key 'l') + elif event.key in toggle_yscale_keys: ax = event.inaxes scale = ax.get_yscale() - if scale=='log': + if scale == 'log': ax.set_yscale('linear') ax.figure.canvas.draw() - elif scale=='linear': + elif scale == 'linear': ax.set_yscale('log') ax.figure.canvas.draw() + # toggle scaling of x-axes between 'log and 'linear' (default key 'k') + elif event.key in toggle_xscale_keys: + ax = event.inaxes + scalex = ax.get_xscale() + if scalex == 'log': + ax.set_xscale('linear') + ax.figure.canvas.draw() + elif scalex == 'linear': + ax.set_xscale('log') + ax.figure.canvas.draw() - elif event.key is not None and (event.key.isdigit() and event.key!='0') or event.key=='a': - # 'a' enables all axes - if event.key!='a': - n=int(event.key)-1 + elif event.key is not None and \ + (event.key.isdigit() and event.key!='0') or event.key in all: + # keys in list 'all' enables all axes (default key 'a'), + # otherwise if key is a number only enable this particular axes + # if it was the axes, where the event was raised + if not (event.key in all): + n = int(event.key)-1 for i, a in enumerate(self.canvas.figure.get_axes()): - if event.x is not None and event.y is not None and a.in_axes(event): - if event.key=='a': + # consider axes, in which the event was raised + # FIXME: Why only this axes? + if event.x is not None and event.y is not None \ + and a.in_axes(event): + if event.key in all: a.set_navigate(True) else: a.set_navigate(i==n) Modified: trunk/matplotlib/lib/matplotlib/rcsetup.py =================================================================== --- trunk/matplotlib/lib/matplotlib/rcsetup.py 2010-02-17 02:43:26 UTC (rev 8139) +++ trunk/matplotlib/lib/matplotlib/rcsetup.py 2010-02-17 15:25:38 UTC (rev 8140) @@ -546,9 +546,22 @@ 'path.simplify' : [True, validate_bool], 'path.simplify_threshold' : [1.0 / 9.0, ValidateInterval(0.0, 1.0)], - 'agg.path.chunksize' : [0, validate_int] # 0 to disable chunking; - # recommend about 20000 to - # enable. Experimental. + 'agg.path.chunksize' : [0, validate_int], # 0 to disable chunking; + # recommend about 20000 to + # enable. Experimental. + # key-mappings + 'keymap.fullscreen' : ['f', validate_stringlist], + 'keymap.home' : [['h', 'r', 'home'], validate_stringlist], + 'keymap.back' : [['left', 'c', 'backspace'], validate_stringlist], + 'keymap.forward' : [['right', 'v'], validate_stringlist], + 'keymap.pan' : ['p', validate_stringlist], + 'keymap.zoom' : ['o', validate_stringlist], + 'keymap.save' : ['s', validate_stringlist], + 'keymap.grid' : ['g', validate_stringlist], + 'keymap.yscale' : ['l', validate_stringlist], + 'keymap.xscale' : [['k', 'L'], validate_stringlist], + 'keymap.all_axes' : ['a', validate_stringlist] + } if __name__ == '__main__': Modified: trunk/matplotlib/matplotlibrc.template =================================================================== --- trunk/matplotlib/matplotlibrc.template 2010-02-17 02:43:26 UTC (rev 8139) +++ trunk/matplotlib/matplotlibrc.template 2010-02-17 15:25:38 UTC (rev 8140) @@ -360,3 +360,20 @@ # from matplotlib import verbose. #verbose.level : silent # one of silent, helpful, debug, debug-annoying #verbose.fileo : sys.stdout # a log filename, sys.stdout or sys.stderr + +# Event keys to interact with figures/plots via keyboard. +# Customize these settings according to your needs. +# Leave the field(s) empty if you don't need a key-map. (i.e., fullscreen : '') + +#keymap.fullscreen : f # toggling +#keymap.home : h, r, home # home or reset mnemonic +#keymap.back : left, c, backspace # forward / backward keys to enable +#keymap.forward : right, v # left handed quick navigation +#keymap.pan : p # pan mnemonic +#keymap.zoom : o # zoom mnemonic +#keymap.save : s # saving current figure +#keymap.grid : g # switching on/off a grid in current axes +#keymap.yscale : l # toggle scaling of y-axes ('log'/'linear') +#keymap.xscale : L, k # toggle scaling of x-axes ('log'/'linear') +#keymap.all_axes : a # enable all axes + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2010-02-22 16:41:18
|
Revision: 8148 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8148&view=rev Author: mdboom Date: 2010-02-22 16:41:11 +0000 (Mon, 22 Feb 2010) Log Message: ----------- Initialized merge tracking via "svnmerge" with revisions "1-7318" from http://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_99_maint Modified Paths: -------------- trunk/matplotlib/doc/_templates/index.html trunk/matplotlib/doc/_templates/indexsidebar.html trunk/matplotlib/doc/faq/installing_faq.rst trunk/matplotlib/doc/users/installing.rst trunk/matplotlib/examples/pylab_examples/boxplot_demo2.py trunk/matplotlib/release/osx/Makefile Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README trunk/matplotlib/doc/sphinxext/gen_gallery.py trunk/matplotlib/doc/sphinxext/gen_rst.py trunk/matplotlib/examples/misc/multiprocess.py trunk/matplotlib/examples/mplot3d/contour3d_demo.py trunk/matplotlib/examples/mplot3d/contourf3d_demo.py trunk/matplotlib/examples/mplot3d/polys3d_demo.py trunk/matplotlib/examples/mplot3d/scatter3d_demo.py trunk/matplotlib/examples/mplot3d/surface3d_demo.py trunk/matplotlib/examples/mplot3d/wire3d_demo.py trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_spines/spines_axes_positions.png Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/mathtex:1-7263 /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7253 /branches/v0_99_maint:1-7318 /trunk/matplotlib:1-7315 + /branches/mathtex:1-7263 /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7253 /trunk/matplotlib:1-7315 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint:7323-7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Modified: trunk/matplotlib/doc/_templates/index.html =================================================================== --- trunk/matplotlib/doc/_templates/index.html 2010-02-22 16:30:27 UTC (rev 8147) +++ trunk/matplotlib/doc/_templates/index.html 2010-02-22 16:41:11 UTC (rev 8148) @@ -1,7 +1,7 @@ {% extends "layout.html" %} {% set title = 'matplotlib: python plotting' %} - + {% block body %} <h1>intro</h1> Modified: trunk/matplotlib/doc/_templates/indexsidebar.html =================================================================== --- trunk/matplotlib/doc/_templates/indexsidebar.html 2010-02-22 16:30:27 UTC (rev 8147) +++ trunk/matplotlib/doc/_templates/indexsidebar.html 2010-02-22 16:41:11 UTC (rev 8148) @@ -9,7 +9,7 @@ pathto('users/installing') }}">installing</a> </p> -<p>Sandro Tosi has a new book +<p>Sandro Tosi has a new book <a href="http://www.packtpub.com/matplotlib-python-development/book">Matplotlib for python developers</a> also @@ -22,13 +22,12 @@ tutorial. </p> - <h3>Videos</h3> <p>Watch the <a href="http://conference.scipy.org/">SciPy</a> 2009 <a href="http://www.archive.org/details/scipy09_introTutorialDay2_1">intro</a> and <a href="http://www.archive.org/details/scipy09_advancedTutorialDay1_3">advanced</a> matplotlib tutorials </p> -<p>Watch a <a href="http://videolectures.net/mloss08_hunter_mat">talk</a> about matplotlib presented at <a href="http://videolectures.net/mloss08_whistler">NIPS 08 Workshop</a> <i>MLOSS</i></a>. +<p>Watch a <a href="http://videolectures.net/mloss08_hunter_mat">talk</a> about matplotlib presented at <a href="http://videolectures.net/mloss08_whistler">NIPS 08 Workshop</a> <i>MLOSS</i></a>. </p> Modified: trunk/matplotlib/doc/faq/installing_faq.rst =================================================================== --- trunk/matplotlib/doc/faq/installing_faq.rst 2010-02-22 16:30:27 UTC (rev 8147) +++ trunk/matplotlib/doc/faq/installing_faq.rst 2010-02-22 16:41:11 UTC (rev 8148) @@ -206,19 +206,19 @@ using the `Anti-Grain Geometry`_ engine PS :term:`ps` :term:`vector graphics` -- Postscript_ output :term:`eps` -PDF :term:`pdf` :term:`vector graphics` -- +PDF :term:`pdf` :term:`vector graphics` -- `Portable Document Format`_ SVG :term:`svg` :term:`vector graphics` -- `Scalable Vector Graphics`_ :term:`Cairo` :term:`png` :term:`vector graphics` -- :term:`ps` `Cairo graphics`_ - :term:`pdf` - :term:`svg` - ... + :term:`pdf` + :term:`svg` + ... :term:`GDK` :term:`png` :term:`raster graphics` -- :term:`jpg` the `Gimp Drawing Kit`_ - :term:`tiff` - ... + :term:`tiff` + ... ============= ============ ================================================ And here are the user interfaces and renderer combinations supported: @@ -264,8 +264,8 @@ :file:`pygobject.h` to add the :cmacro:`G_BEGIN_DECLS` and :cmacro:`G_END_DECLS` macros, and rename :cdata:`typename` parameter to :cdata:`typename_`:: - - const char *typename, - + const char *typename_, + - const char *typename, + + const char *typename_, .. _`bug in PyGTK-2.4`: http://bugzilla.gnome.org/show_bug.cgi?id=155304 @@ -294,20 +294,22 @@ ----------------------- If you want to install matplotlib from one of the binary installers we -build, you have two choices: a dmg installer, which is a typical +build, you have two choices: a mpkg installer, which is a typical Installer.app, or an binary OSX egg, which you can install via setuptools easy_install. -The mkpg installer will have a "dmg" extension, and will have a name -like :file:`matplotlib-0.99.0-py2.5-macosx10.5.dmg` depending on the -python, matplotlib, and OSX versions. Save this file and double -click it, which will open up a folder with a file in it that has the -mpkg extension. Double click this to run the Installer.app, which -will prompt you for a password if you need system wide installation -privileges, and install to a directory like -:file:`/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages`, -again depedending on your python version. This directory should be in -your python path, so you can test your installation with:: +The mkpg installer will have a "zip" extension, and will have a name +like file:`matplotlib-0.99.0.rc1-py2.5-macosx10.5_mpkg.zip` depending on +the python, matplotlib, and OSX versions. You need to unzip this file +using either the "unzip" command on OSX, or simply double clicking on +it to run StuffIt Expander. When you double click on the resultant +mpkd directory, which will have a name like +file:`matplotlib-0.99.0.rc1-py2.5-macosx10.5.mpkg`, it will run the +Installer.app, prompt you for a password if you need system wide +installation privileges, and install to a directory like +file:`/Library/Python/2.5/site-packages/`, again depedending on your +python version. This directory may not be in your python path, so you +can test your installation with:: > python -c 'import matplotlib; print matplotlib.__version__, matplotlib.__file__' @@ -319,24 +321,10 @@ then you will need to set your PYTHONPATH, eg:: - export PYTHONPATH=/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages:$PYTHONPATH + export PYTHONPATH=/Library/Python/2.5/site-packages:$PYTHONPATH -See also :ref:`environment-variables`. +See also ref:`environment-variables`. - -If you are upgrading your matplotlib using the dmg installer over an -Enthought Python Distribution, you may get an error like "You must use -a framework install of python". EPD puts their python in a directory -like :file:``//Library/Frameworks/Python.framework/Versions/4.3.0`` -where 4.3.0 is an EPD version number. The mpl installer needs the -`python` version number, so you need to create a symlink pointing your -python version to the EPS version before installing matplotlib. For -example, for python veersion 2.5 and EPD version 4.3.0:: - - > cd /Library/Frameworks/Python.framework/Versions - > ln -s 4.3.0 2.5 - - .. _easy-install-osx-egg: easy_install from egg @@ -411,25 +399,25 @@ #branch="release" branch="trunk" if [ $branch = "trunk" ] - then - echo getting the trunk - svn co https://matplotlib.svn.sourceforge.net/svnroot/$NAME/trunk/$NAME $NAME - cd $NAME + then + echo getting the trunk + svn co https://matplotlib.svn.sourceforge.net/svnroot/$NAME/trunk/$NAME $NAME + cd $NAME - fi - if [ $branch = "release" ] - then - echo getting the maintenance branch - svn co https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v${VERSION}_maint $NAME$VERSION - cd $NAME$VERSION - fi - export CFLAGS="-Os -arch i386" - export LDFLAGS="-Os -arch i386" - export PKG_CONFIG_PATH="/usr/x11/lib/pkgconfig" - export ARCHFLAGS="-arch i386" - python setup.py build - python setup.py install #--prefix=$PREFIX #Use this if you don't want it installed into your default location - cd .. + fi + if [ $branch = "release" ] + then + echo getting the maintenance branch + svn co https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v${VERSION}_maint $NAME$VERSION + cd $NAME$VERSION + fi + export CFLAGS="-Os -arch i386" + export LDFLAGS="-Os -arch i386" + export PKG_CONFIG_PATH="/usr/x11/lib/pkgconfig" + export ARCHFLAGS="-arch i386" + python setup.py build + python setup.py install #--prefix=$PREFIX #Use this if you don't want it installed into your default location + cd .. Run this script (for example ``sh ./install-matplotlib-epd-osx.sh``) in the directory in which you want the source code to be placed, or simply type the Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/pyplots/README:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/pyplots/README:7323-7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_gallery.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 + /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_gallery.py:7323-7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_rst.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 + /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_rst.py:7323-7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Modified: trunk/matplotlib/doc/users/installing.rst =================================================================== --- trunk/matplotlib/doc/users/installing.rst 2010-02-22 16:30:27 UTC (rev 8147) +++ trunk/matplotlib/doc/users/installing.rst 2010-02-22 16:41:11 UTC (rev 8148) @@ -79,6 +79,9 @@ In [2]: hist(x, 100) +Instructions for installing our OSX binaries are found in the FAQ +ref:`install_osx_binaries`. + Note that when testing matplotlib installations from the interactive python console, there are some issues relating to user interface toolkits and interactive settings that are discussed in Property changes on: trunk/matplotlib/examples/misc/multiprocess.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/misc/log.py:5753-5771 /branches/v0_98_5_maint/examples/misc/log.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/misc/multiprocess.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 + /branches/v0_91_maint/examples/misc/log.py:5753-5771 /branches/v0_98_5_maint/examples/misc/log.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/misc/multiprocess.py:7323-7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Property changes on: trunk/matplotlib/examples/mplot3d/contour3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/contour.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contour.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contour3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 + /branches/v0_91_maint/examples/mplot3d/contour.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contour.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contour3d_demo.py:7323-7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Property changes on: trunk/matplotlib/examples/mplot3d/contourf3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/contourf.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contourf.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contourf3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 + /branches/v0_91_maint/examples/mplot3d/contourf.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contourf.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contourf3d_demo.py:7323-7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Property changes on: trunk/matplotlib/examples/mplot3d/polys3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/polys.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/polys.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/polys3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 + /branches/v0_91_maint/examples/mplot3d/polys.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/polys.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/polys3d_demo.py:7323-7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Property changes on: trunk/matplotlib/examples/mplot3d/scatter3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/scatter.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/scatter.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/scatter3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 + /branches/v0_91_maint/examples/mplot3d/scatter.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/scatter.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/scatter3d_demo.py:7323-7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Property changes on: trunk/matplotlib/examples/mplot3d/surface3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/surface.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/surface.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/surface3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 + /branches/v0_91_maint/examples/mplot3d/surface.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/surface.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/surface3d_demo.py:7323-7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Property changes on: trunk/matplotlib/examples/mplot3d/wire3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/wire.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/wire.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/wire3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 + /branches/v0_91_maint/examples/mplot3d/wire.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/wire.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/wire3d_demo.py:7323-7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Modified: trunk/matplotlib/examples/pylab_examples/boxplot_demo2.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/boxplot_demo2.py 2010-02-22 16:30:27 UTC (rev 8147) +++ trunk/matplotlib/examples/pylab_examples/boxplot_demo2.py 2010-02-22 16:41:11 UTC (rev 8148) @@ -16,9 +16,6 @@ randomDists = ['Normal(1,1)',' Lognormal(1,1)', 'Exp(1)', 'Gumbel(6,4)', 'Triangular(2,9,11)'] N = 500 - -np.random.seed(3) # make identical plots each time - norm = np.random.normal(1,1, N) logn = np.random.lognormal(1,1, N) expo = np.random.exponential(1, N) @@ -42,8 +39,8 @@ ax1 = fig.add_subplot(111) plt.subplots_adjust(left=0.075, right=0.95, top=0.9, bottom=0.25) -bp = plt.boxplot(data, notch=0, sym='+', vert=1, whis=1.5, patch_artist=True) -plt.setp(bp['boxes'], edgecolor='black') +bp = plt.boxplot(data, notch=0, sym='+', vert=1, whis=1.5) +plt.setp(bp['boxes'], color='black') plt.setp(bp['whiskers'], color='black') plt.setp(bp['fliers'], color='red', marker='+') @@ -64,12 +61,25 @@ medians = range(numBoxes) for i in range(numBoxes): box = bp['boxes'][i] + boxX = [] + boxY = [] + for j in range(5): + boxX.append(box.get_xdata()[j]) + boxY.append(box.get_ydata()[j]) + boxCoords = zip(boxX,boxY) + # Alternate between Dark Khaki and Royal Blue k = i % 2 - # Set the box colors - box.set_facecolor(boxColors[k]) - # Now get the medians + boxPolygon = Polygon(boxCoords, facecolor=boxColors[k]) + ax1.add_patch(boxPolygon) + # Now draw the median lines back over what we just filled in med = bp['medians'][i] - medians[i] = med.get_ydata()[0] + medianX = [] + medianY = [] + for j in range(2): + medianX.append(med.get_xdata()[j]) + medianY.append(med.get_ydata()[j]) + plt.plot(medianX, medianY, 'k') + medians[i] = medianY[0] # Finally, overplot the sample averages, with horixzontal alignment # in the center of each box plt.plot([np.average(med.get_xdata())], [np.average(data[i])], Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/mathmpl.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 + /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/mathmpl.py:7323-7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/only_directives.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 + /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/only_directives.py:7323-7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/plot_directive.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 + /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/plot_directive.py:7323-7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_spines/spines_axes_positions.png ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_99_maint/lib/matplotlib/tests/baseline_images/test_spines/spines_axes_positions.png:7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 + /branches/v0_99_maint/lib/matplotlib/tests/baseline_images/test_spines/spines_axes_positions.png:7323-7337,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844,7846-7847,7849,7858,7864,7866-7867,7874,7884,7896,7901-7903,7916,7919,7924,7928,7944,7952,7970,7972,7981,7983,7989-7991,7998,8001,8003,8016-8057,8068,8070,8092-8116,8121-8135 Modified: trunk/matplotlib/release/osx/Makefile =================================================================== --- trunk/matplotlib/release/osx/Makefile 2010-02-22 16:30:27 UTC (rev 8147) +++ trunk/matplotlib/release/osx/Makefile 2010-02-22 16:41:11 UTC (rev 8148) @@ -22,86 +22,86 @@ LDFLAGS_DEPS="-arch i386 -arch ppc -L${SRCDIR}/zlib-${ZLIBVERSION} -syslibroot,/Developer/SDKs/MacOSX10.4u.sdk" clean: - rm -rf zlib-${ZLIBVERSION}.tar.gz libpng-${PNGVERSION}.tar.bz2 \ - freetype-${FREETYPEVERSION}.tar.bz2 bdist_mpkg-${BDISTMPKGVERSION}.tar.gz \ - bdist_mpkg-${BDISTMPKGVERSION} \ - zlib-${ZLIBVERSION} libpng-${PNGVERSION} freetype-${FREETYPEVERSION} \ - matplotlib-${MPLVERSION} *~ + rm -rf zlib-${ZLIBVERSION}.tar.gz libpng-${PNGVERSION}.tar.bz2 \ + freetype-${FREETYPEVERSION}.tar.bz2 bdist_mpkg-${BDISTMPKGVERSION}.tar.gz \ + bdist_mpkg-${BDISTMPKGVERSION} \ + zlib-${ZLIBVERSION} libpng-${PNGVERSION} freetype-${FREETYPEVERSION} \ + matplotlib-${MPLVERSION} *~ fetch: - curl -LO http://www.zlib.net/zlib-${ZLIBVERSION}.tar.gz &&\ - curl -LO http://internap.dl.sourceforge.net/sourceforge/libpng/libpng-${PNGVERSION}.tar.bz2 &&\ - curl -LO http://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPEVERSION}.tar.bz2&&\ - curl -LO http://pypi.python.org/packages/source/b/bdist_mpkg/bdist_mpkg-${BDISTMPKGVERSION}.tar.gz&&\ - tar xvfz bdist_mpkg-${BDISTMPKGVERSION}.tar.gz &&\ - echo "You need to install bdist_mpkg-${BDISTMPKGVERSION} now" + curl -LO http://www.zlib.net/zlib-${ZLIBVERSION}.tar.gz &&\ + curl -LO http://internap.dl.sourceforge.net/sourceforge/libpng/libpng-${PNGVERSION}.tar.bz2 &&\ + curl -LO http://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPEVERSION}.tar.bz2&&\ + curl -LO http://pypi.python.org/packages/source/b/bdist_mpkg/bdist_mpkg-${BDISTMPKGVERSION}.tar.gz&&\ + tar xvfz bdist_mpkg-${BDISTMPKGVERSION}.tar.gz &&\ + echo "You need to install bdist_mpkg-${BDISTMPKGVERSION} now" zlib: - unset PKG_CONFIG_PATH &&\ - rm -rf zlib-${ZLIBVERSION} &&\ - tar xvfz zlib-${ZLIBVERSION}.tar.gz &&\ - cd zlib-${ZLIBVERSION} &&\ - export MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} &&\ - export CFLAGS=${CFLAGS_DEPS} &&\ - export LDFLAGS=${LDFLAGS_DEPS} &&\ - ./configure &&\ - MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} CFLAGS=${CFLAGS_ZLIB} LDFLAGS=${LDFLAGS_ZLIB} make -j3&& \ - unset MACOSX_DEPLOYMENT_TARGET + unset PKG_CONFIG_PATH &&\ + rm -rf zlib-${ZLIBVERSION} &&\ + tar xvfz zlib-${ZLIBVERSION}.tar.gz &&\ + cd zlib-${ZLIBVERSION} &&\ + export MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} &&\ + export CFLAGS=${CFLAGS_DEPS} &&\ + export LDFLAGS=${LDFLAGS_DEPS} &&\ + ./configure &&\ + MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} CFLAGS=${CFLAGS_ZLIB} LDFLAGS=${LDFLAGS_ZLIB} make -j3&& \ + unset MACOSX_DEPLOYMENT_TARGET png: zlib - unset PKG_CONFIG_PATH &&\ - rm -rf libpng-${PNGVERSION} &&\ - tar xvfj libpng-${PNGVERSION}.tar.bz2 - cd libpng-${PNGVERSION} &&\ - export MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} &&\ - export CFLAGS=${CFLAGS_DEPS} &&\ - export LDFLAGS=${LDFLAGS_DEPS} &&\ - ./configure --disable-dependency-tracking &&\ - make -j3 &&\ - cp .libs/libpng.a . &&\ - unset MACOSX_DEPLOYMENT_TARGET + unset PKG_CONFIG_PATH &&\ + rm -rf libpng-${PNGVERSION} &&\ + tar xvfj libpng-${PNGVERSION}.tar.bz2 + cd libpng-${PNGVERSION} &&\ + export MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} &&\ + export CFLAGS=${CFLAGS_DEPS} &&\ + export LDFLAGS=${LDFLAGS_DEPS} &&\ + ./configure --disable-dependency-tracking &&\ + make -j3 &&\ + cp .libs/libpng.a . &&\ + unset MACOSX_DEPLOYMENT_TARGET freetype: zlib - unset PKG_CONFIG_PATH &&\ - rm -rf ${FREETYPEVERSION} &&\ - tar xvfj freetype-${FREETYPEVERSION}.tar.bz2 &&\ - cd freetype-${FREETYPEVERSION} &&\ - export MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} &&\ - export CFLAGS=${CFLAGS_DEPS} &&\ - export LDFLAGS=${LDFLAGS_DEPS} &&\ - ./configure &&\ - make -j3 &&\ - cp objs/.libs/libfreetype.a . &&\ - unset MACOSX_DEPLOYMENT_TARGET + unset PKG_CONFIG_PATH &&\ + rm -rf ${FREETYPEVERSION} &&\ + tar xvfj freetype-${FREETYPEVERSION}.tar.bz2 &&\ + cd freetype-${FREETYPEVERSION} &&\ + export MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} &&\ + export CFLAGS=${CFLAGS_DEPS} &&\ + export LDFLAGS=${LDFLAGS_DEPS} &&\ + ./configure &&\ + make -j3 &&\ + cp objs/.libs/libfreetype.a . &&\ + unset MACOSX_DEPLOYMENT_TARGET deps: - make zlib png freetype + make zlib png freetype installers: - unset PKG_CONFIG_PATH &&\ - tar xvfz matplotlib-${MPLVERSION}.tar.gz && \ - cd ${MPLSRC} && \ - rm -rf build && \ - cp ../data/setup.cfg ../data/ReadMe.txt . &&\ - export CFLAGS=${CFLAGS} &&\ - export LDFLAGS=${LDFLAGS} &&\ - /Library/Frameworks/Python.framework/Versions/${PYVERSION}/bin/bdist_mpkg --readme=ReadMe.txt &&\ - hdiutil create -srcdir dist/matplotlib-${MPLVERSION}-py${PYVERSION}-macosx10.5.mpkg dist/matplotlib-${MPLVERSION}-py${PYVERSION}-macosx10.5.dmg &&\ - ${PYTHON} setupegg.py bdist_egg + unset PKG_CONFIG_PATH &&\ + tar xvfz matplotlib-${MPLVERSION}.tar.gz && \ + cd ${MPLSRC} && \ + rm -rf build && \ + cp ../data/setup.cfg ../data/ReadMe.txt . &&\ + export CFLAGS=${CFLAGS} &&\ + export LDFLAGS=${LDFLAGS} &&\ + /Library/Frameworks/Python.framework/Versions/${PYVERSION}/bin/bdist_mpkg --readme=ReadMe.txt &&\ + hdiutil create -srcdir dist/matplotlib-${MPLVERSION}-py${PYVERSION}-macosx10.5.mpkg dist/matplotlib-${MPLVERSION}-py${PYVERSION}-macosx10.5.dmg &&\ + ${PYTHON} setupegg.py bdist_egg upload: - rm -rf upload &&\ - mkdir upload &&\ - cp matplotlib-${MPLVERSION}.tar.gz upload/ &&\ - cp matplotlib-${MPLVERSION}/dist/matplotlib-${MPLVERSION}_r0-py${PYVERSION}-macosx-10.3-fat.egg upload/matplotlib-${MPLVERSION}-macosx-py${PYVERSION}.egg &&\ - cp matplotlib-${MPLVERSION}/dist/matplotlib-${MPLVERSION}-py${PYVERSION}-macosx10.5.zip upload/matplotlib-${MPLVERSION}-py${PYVERSION}-mpkg.zip&&\ - scp upload/* jd...@fr...:uploads/ + rm -rf upload &&\ + mkdir upload &&\ + cp matplotlib-${MPLVERSION}.tar.gz upload/ &&\ + cp matplotlib-${MPLVERSION}/dist/matplotlib-${MPLVERSION}_r0-py${PYVERSION}-macosx-10.3-fat.egg upload/matplotlib-${MPLVERSION}-macosx-py${PYVERSION}.egg &&\ + cp matplotlib-${MPLVERSION}/dist/matplotlib-${MPLVERSION}-py${PYVERSION}-macosx10.5.zip upload/matplotlib-${MPLVERSION}-py${PYVERSION}-mpkg.zip&&\ + scp upload/* jd...@fr...:uploads/ all: - make clean fetch deps installers upload + make clean fetch deps installers upload This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |