[Matplotlib-users] setting axis label offset from end of spine
I'm trying to change the position of the axis label so that it is a certain number of points off the end of the spine representing the x-axis. I'm trying to use the transform attribute and the offset_copy function to say "put the label 5 points right of the end of the spine". So far, my code looks something like: xlabel=subplot.xaxis.get_label() xlabel.set_horizontalalignment('left') xlabel.set_verticalalignment('baseline') xtrans=offset_copy(subplot.transData, subplot.figure, x=5, y=0, units='points') subplot.xaxis.set_label_coords(subplot.get_xlim()[1], 0,transform=xtrans) However, this doesn't handle the case where the spine representing the x-axis is not the same as the line y=0. Any ideas on how to construct the transform to say "5 points to the right of the right end of this given spine"? Thanks, Jason -- Jason Grout -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] "Piecewise Cubic Hermite Interpolating Polynomial" in python
Thanks for the inputs... perhaps it will provide the impetus for future postings as well... chris On Aug 29, 2009, at 11:49 AM, John Hunter wrote: > On Sat, Aug 29, 2009 at 1:12 PM, Eric Firing > wrote: > >> This looks interesting. I successfully ran your program by using >> copy >> and paste to get it into a file, but for the future I certainly >> recommend that you attach such a file directly--file attachments >> generally work very well these days, but bad things can happen to >> code >> included as inline text. I haven't contributed to matplotlib or numpy even though I've used them for some years now, so I wasn't sure about the "etiquette" of file attachments. The other thing I recommend is do not use the pylab namespace for any > > of the numerics. pylab is getting all the numerical functions from > numpy, so if you > > import numpy as np > > and then refer to any numerical functions you need as np.somefunc. Point well taken. Since pylab exposes most of the numpy calls I use, I typically include pylab instead for nump. > > Finally, for the functions to be suitable for inclusion in a > production package like numpy or matplotlib.mlab, you should not use > any print statements in the function, but rather a combination of > warnings.warn or exceptions or if it for matplotlib, use the > verbose.report infrastructure. That way users can configure how much > verbosity they want, where the output should be directed, etc. Point also well taken. I figured out when there were problems, but even after 7 years of writing large Python package, I haven't found the best way to handle exceptions. Usually I purposely cause a "crash" so I don't miss the fact that the code had ill formed data. > > After a cleanup, you may want to check with numpy or scipy to see of > it could find a home there. There was a discussion at scipy on the > need to improve scipy.interpolate and this seems to go part of the way > toward that objective. So I would start there. I'll send it along to the scipy people. I figured since I figured out a relatively simple solution to a problem that is often encountered, it might find use even in its primitive form. I'll add the URLs to the WIkipedia references as well. > > JDH -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] After update to 0.99.0 - mpl doesn't work
Hi When I try to import anything from mpl, Python's interpreter exits without any error. This happens after the 0.99.0 upgrade. This is example session: d:\>python Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import matplotlib.pyplot as plt matplotlib data path D:\msys\opt\python\lib\site-packages\matplotlib\mpl-data loaded rc file D:\msys\etc\.matplotlib\matplotlibrc matplotlib version 0.99.0 verbose.level debug-annoying interactive is False units is False platform is win32 loaded modules: ['numpy.lib._iotools', 'xml.sax.urlparse', 'distutils', 'functools', 'matplotlib.matplotlib', 'subprocess', 'gc', 'matplotlib.tempfile', 'distutils.sysconfig', 'ctypes._endian', 'encodings.encodings', 'matplotlib.colors', 'msvcrt', 'numpy.testing.sys', 'numpy.core.info', 'xml', 'numpy.fft.types', 'numpy.ma.operator', 'numpy.ma.cPickle', 'matplotlib.copy', 'numpy.random.info', 'tempfile', 'base64', 'numpy.linalg', 'matplotlib.threading', 'numpy.testing.operator', 'imp', 'numpy.testing', 'collections', 'numpy.core.umath', '_struct', 'distutils.types', 'numpy.lib.numpy', 'numpy.core.scalarmath', 'zipimport', 'string', 'matplotlib.subprocess', 'numpy.testing.os', 'matplotlib.locale', 'numpy.lib.arraysetops', 'numpy.testing.unittest', 'numpy.lib.math', 'textwrap', 'matplotlib.__future__', 'ssl', 'numpy.testing.re', 'itertools', 'numpy.version', 'numpy.lib.re', 'distutils.re', 'ctypes.os', 'numpy.core.os', 'numpy.lib.type_check', 'numpy.lib.__builtin__', 'signal', 'numpy.lib.types', 'numpy.lib._datasource', 'random', 'threading', 'token', 'numpy.fft.fftpack_lite', 'matplotlib.cbook', 'ctypes.ctypes', 'xml.sax.xmlreader', 'numpy.__builtin__', 'dis', 'distutils.version', 'cStringIO', 'numpy.ma.core', 'encodings.cp852', 'matplotlib.StringIO', 'numpy.ma.extras', 'locale', 'numpy.add_newdocs', 'numpy.lib.getlimits', 'xml.sax.saxutils', 'matplotlib.numpy', 'numpy.lib.sys', 'encodings', 'numpy.ma.itertools', 'StringIO', 'numpy.lib.io', 'abc', 'numpy.ctypes', 'numpy.testing.decorators', 'matplotlib.warnings', 'matplotlib.string', '_subprocess', 'urllib', 'matplotlib.sys', 're', 'numpy.lib._compiled_base', 'ntpath', 'numpy.random.mtrand', 'math', 'numpy.fft.helper', 'numpy.ma.warnings', 'inspect', 'numpy.ma.inspect', 'UserDict', 'numpy.lib.function_base', 'distutils.os', 'matplotlib', 'numpy.fft.numpy', 'xml.sax.codecs', 'exceptions', 'numpy.lib.info', 'numpy.core.numerictypes', 'ctypes', 'numpy.lib.warnings', 'ctypes.struct', 'codecs', 'numpy.core._sort', 'numpy.os', 'struct', '_functools', '_locale', 'matplotlib.sre_constants', 'matplotlib.os', 'thread', 'numpy.lib.ufunclike', 'numpy.core.memmap', 'traceback', 'weakref', 'numpy.core._internal', 'numpy.fft.fftpack', 'opcode', 'numpy.linalg.lapack_lite', 'distutils.sys', 'os', 'numpy.lib.itertools', '__future__', '_collections', 'xml.sax.types', 'matplotlib.traceback', '_sre', 'unittest', 'numpy.core.sys', 'numpy.random', 'numpy.linalg.numpy', '__builtin__', 'numpy.lib.twodim_base', 'matplotlib.re', 'numpy.core.cPickle', 'operator', 'numpy.core.arrayprint', 'distutils.string', 'numpy.lib.arrayterator', 'numpy.numpy', 'ctypes.sys', 'matplotlib.errno', 'numpy.lib.financial', 'numpy.core.multiarray', 'errno', '_socket', 'binascii', 'sre_constants', 'datetime', 'numpy.ma', 'xml.sax.handler', 'os.path', 'tokenize', 'numpy.lib.stride_tricks', 'numpy.core.numpy', 'numpy', '_warnings', 'matplotlib.types', 'numpy.core.defmatrix', 'xml.sax.os', 'cPickle', 'encodings.__builtin__', 'matplotlib.xml', '_codecs', 'numpy.lib.operator', 'numpy.__config__', 'matplotlib.pyparsing', 'nturl2path', 'numpy.ma.numpy', 'copy', 'numpy.core.re', 'socket', 'numpy.core.fromnumeric', 'numpy.ctypeslib', 'keyword', 'numpy.lib.scimath', 'numpy.fft', 'numpy.lib', 'numpy.random.numpy', 'encodings.aliases', 'matplotlib.distutils', 'fnmatch', 'sre_parse', 'numpy.core.ctypes', 'distutils.distutils', 'copy_reg', 'sre_compile', 'xml.sax', '_random', 'numpy.lib.__future__', 'site', 'numpy.lib.polynomial', 'encodings.cp1250', 'numpy._import_tools', '__main__', 'numpy.fft.info', 'numpy.core.records', 'shutil', 'numpy.lib.cPickle', 'numpy.sys', 'matplotlib.weakref', 'xml.sax.urllib', 'numpy.testing.traceback', 'strop', 'numpy.testing.numpytest', 'numpy.core.numeric', 'numpy.linalg.info', 'encodings.codecs', 'ctypes._ctypes', '_abcoll', 'numpy.core', 'matplotlib.rcsetup', 'matplotlib.time', 'nt', 'xml.sax._exceptions', 'genericpath', 'stat', '_ssl', 'numpy.lib.index_tricks', 'warnings', 'numpy.lib.utils', 'numpy.core.defchararray', '_ctypes', 'numpy.lib.shape_base', 'numpy.core.types', 'sys', 'numpy.core.warnings', 'numpy.core.__builtin__', 'xml.sax.sys', 'numpy.lib.format', 'numpy.lib.os', 'numpy.testing.nosetester', 'types', 'numpy.lib.shutil', 'matplotlib.datetime', 'matplotlib.fontconfig_pattern', '_weakref', 'distutils.errors', 'urlparse', 'linecache', 'matplotlib.shutil', 'numpy.lib.cStringIO', 'time', 'num
Re: [Matplotlib-users] "Piecewise Cubic Hermite Interpolating Polynomial" in python
On Sat, Aug 29, 2009 at 1:12 PM, Eric Firing wrote: > This looks interesting. I successfully ran your program by using copy > and paste to get it into a file, but for the future I certainly > recommend that you attach such a file directly--file attachments > generally work very well these days, but bad things can happen to code > included as inline text. The other thing I recommend is do not use the pylab namespace for any of the numerics. pylab is getting all the numerical functions from numpy, so if you import numpy as np and then refer to any numerical functions you need as np.somefunc. Finally, for the functions to be suitable for inclusion in a production package like numpy or matplotlib.mlab, you should not use any print statements in the function, but rather a combination of warnings.warn or exceptions or if it for matplotlib, use the verbose.report infrastructure. That way users can configure how much verbosity they want, where the output should be directed, etc. After a cleanup, you may want to check with numpy or scipy to see of it could find a home there. There was a discussion at scipy on the need to improve scipy.interpolate and this seems to go part of the way toward that objective. So I would start there. JDH -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] "Piecewise Cubic Hermite Interpolating Polynomial" in python
Chris Michalski wrote: > > Offered for those who might have the same need – a Python pchip() > equivalent ==> pypchip(). Since I'm not sure how attachments work (or > if they work at all...), I copied the code I used below, followed by a > PNG showing "success": Chris, This looks interesting. I successfully ran your program by using copy and paste to get it into a file, but for the future I certainly recommend that you attach such a file directly--file attachments generally work very well these days, but bad things can happen to code included as inline text. It would also be helpful if you include the actual URLs of the Wikipedia articles that you used. (Or did I miss them?) Thanks for providing this code, example, and references. Eric -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] plot a complete sine, but shade where x>0.25pi and x<0.75pi
Is this the only way to plot a sin from x=0 to x=2pi, but shade where x>0.25pi and x<0.75pi? x0 = np.linspace(0.0, 0.25*np.pi, 100) x1 = np.linspace(0.25*np.pi, 0.75*np.pi, 100) x2 = np.linspace(0.75*np.pi,2*np.pi, 100) y0 = np.sin(x0) y1 = np.sin(x1) y2 = np.sin(x2) fig = figure() ax1 = fig.add_subplot(111) ax1.plot(x0,y0) ax1.fill_between(x1,0,y1) ax1.plot(x2,y2) show() thanks Marc Desmarais -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users