You can subscribe to this list here.
2003 
_{Jan}

_{Feb}

_{Mar}

_{Apr}

_{May}
(3) 
_{Jun}

_{Jul}

_{Aug}
(12) 
_{Sep}
(12) 
_{Oct}
(56) 
_{Nov}
(65) 
_{Dec}
(37) 

2004 
_{Jan}
(59) 
_{Feb}
(78) 
_{Mar}
(153) 
_{Apr}
(205) 
_{May}
(184) 
_{Jun}
(123) 
_{Jul}
(171) 
_{Aug}
(156) 
_{Sep}
(190) 
_{Oct}
(120) 
_{Nov}
(154) 
_{Dec}
(223) 
2005 
_{Jan}
(184) 
_{Feb}
(267) 
_{Mar}
(214) 
_{Apr}
(286) 
_{May}
(320) 
_{Jun}
(299) 
_{Jul}
(348) 
_{Aug}
(283) 
_{Sep}
(355) 
_{Oct}
(293) 
_{Nov}
(232) 
_{Dec}
(203) 
2006 
_{Jan}
(352) 
_{Feb}
(358) 
_{Mar}
(403) 
_{Apr}
(313) 
_{May}
(165) 
_{Jun}
(281) 
_{Jul}
(316) 
_{Aug}
(228) 
_{Sep}
(279) 
_{Oct}
(243) 
_{Nov}
(315) 
_{Dec}
(345) 
2007 
_{Jan}
(260) 
_{Feb}
(323) 
_{Mar}
(340) 
_{Apr}
(319) 
_{May}
(290) 
_{Jun}
(296) 
_{Jul}
(221) 
_{Aug}
(292) 
_{Sep}
(242) 
_{Oct}
(248) 
_{Nov}
(242) 
_{Dec}
(332) 
2008 
_{Jan}
(312) 
_{Feb}
(359) 
_{Mar}
(454) 
_{Apr}
(287) 
_{May}
(340) 
_{Jun}
(450) 
_{Jul}
(403) 
_{Aug}
(324) 
_{Sep}
(349) 
_{Oct}
(385) 
_{Nov}
(363) 
_{Dec}
(437) 
2009 
_{Jan}
(500) 
_{Feb}
(301) 
_{Mar}
(409) 
_{Apr}
(486) 
_{May}
(545) 
_{Jun}
(391) 
_{Jul}
(518) 
_{Aug}
(497) 
_{Sep}
(492) 
_{Oct}
(429) 
_{Nov}
(357) 
_{Dec}
(310) 
2010 
_{Jan}
(371) 
_{Feb}
(657) 
_{Mar}
(519) 
_{Apr}
(432) 
_{May}
(312) 
_{Jun}
(416) 
_{Jul}
(477) 
_{Aug}
(386) 
_{Sep}
(419) 
_{Oct}
(435) 
_{Nov}
(320) 
_{Dec}
(202) 
2011 
_{Jan}
(321) 
_{Feb}
(413) 
_{Mar}
(299) 
_{Apr}
(215) 
_{May}
(284) 
_{Jun}
(203) 
_{Jul}
(207) 
_{Aug}
(314) 
_{Sep}
(321) 
_{Oct}
(259) 
_{Nov}
(347) 
_{Dec}
(209) 
2012 
_{Jan}
(322) 
_{Feb}
(414) 
_{Mar}
(377) 
_{Apr}
(179) 
_{May}
(173) 
_{Jun}
(234) 
_{Jul}
(151) 
_{Aug}

_{Sep}

_{Oct}

_{Nov}

_{Dec}

S  M  T  W  T  F  S 







1
(11) 
2
(24) 
3
(24) 
4
(31) 
5
(30) 
6
(27) 
7
(25) 
8
(8) 
9
(2) 
10
(12) 
11
(16) 
12
(33) 
13
(18) 
14
(17) 
15
(3) 
16
(7) 
17
(8) 
18
(22) 
19
(20) 
20
(25) 
21
(10) 
22
(17) 
23
(18) 
24
(23) 
25
(15) 
26
(19) 
27
(6) 
28
(7) 
29
(6) 
30
(1) 
31
(12) 





From: Andrew Kelly <ndrukelly@gm...>  20090831 22:55:20

I spent some time trying to cobble one together but it was taking too much time so I tried the following and it seems to work now: Instead of using a thick line2D and adding it to the drawing, I added a patches.Rectangle instead. The line2D works in 0.88.5 but not in 0.99. The newer version was tripping over the Artist.contains() function call when used with line2D. On Mon, Aug 31, 2009 at 1:28 PM, Michael Droettboom <mdroe@...> wrote: > Can you provide a standalone example that reproduces this error? > > Cheers, > Mike > > Andrew Kelly wrote: > >> I recently reinstalled matplotlib (0.99) on my vista machine and my code >> that worked yesterday (no changes) no longer runs because of the following >> matplotlib error: >> >> File "C:\Python25\Lib\sitepackages\matplotlib\lines.py", line 286, in >> contains >> path, affine = self._transformed_path.get_transformed_path_and_affine() >> AttributeError: 'NoneType' object has no attribute >> 'get_transformed_path_and_affine' >> >> All I am doing is initially drawing a line2D (which works) and then >> testing if line2D.contains(event)==True if I mouse over the line. As I said >> this worked fine yesterday. >> >> I tried reinstalling with an older version but to no avail. I am totally >> clueless as to why this is happening. Anyone have a guess. >> >> Andrew >> >>  >> >> >>  >> Let Crystal Reports handle the reporting  Free Crystal Reports 2008 >> 30Day 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/bobjjuly >>  >> >> _______________________________________________ >> Matplotlibusers mailing list >> Matplotlibusers@... >> https://lists.sourceforge.net/lists/listinfo/matplotlibusers >> >> > >  > Michael Droettboom > Science Software Branch > Operations and Engineering Division > Space Telescope Science Institute > Operated by AURA for NASA > > 
From: JaeJoon Lee <lee.joon@gm...>  20090831 22:14:39

If you need to stick to eps, another option is to use rasterization feature of the matplotlib itself. This way you can keep part of plot in vector format (e.g., texts, lines, etc ) while rasterizing others. Of course this solution only works if the "quality" of those being rasterized is not very important. http://matplotlib.sourceforge.net/examples/misc/rasterization_demo.html The rasterization in the ps backend works in a way that all the artist whose zorder is smaller than the specified value are rasterized while those with larger zorder are not. Regards, JJ 
From: Jouni K. Seppänen <jks@ik...>  20090831 21:00:40

Chuck PepeRanney <cpepera@...> writes: >> The postscript format does not support transparency. This is not a >> matplotlib limitation but a postscript limitation. The best solution >> is to save your matplotlib figures as pdf, [...] > > Thanks, I guess my problem is that I am using the latex prosper > package to make presentation slides but I cannot compile prosper > documents with pdflatex [...] You could try creating pdf output from matplotlib and converting it to ps using ps2ps2, which will flatten the transparent objects into one big bitmap: http://ghostscript.com/doc/current/Ps2ps2.htm http://www.ghostscript.com/pipermail/gsdevel/2009April/008328.html You may need to tweak the ps2write parameters, especially the output resolution, to find the best tradeoff between file size and quality.  Jouni K. Seppänen http://www.iki.fi/jks 
From: Michael Droettboom <mdroe@st...>  20090831 20:28:16

Can you provide a standalone example that reproduces this error? Cheers, Mike Andrew Kelly wrote: > I recently reinstalled matplotlib (0.99) on my vista machine and my > code that worked yesterday (no changes) no longer runs because of the > following matplotlib error: > > File "C:\Python25\Lib\sitepackages\matplotlib\lines.py", line 286, > in contains > path, affine = > self._transformed_path.get_transformed_path_and_affine() > AttributeError: 'NoneType' object has no attribute > 'get_transformed_path_and_affine' > > All I am doing is initially drawing a line2D (which works) and then > testing if line2D.contains(event)==True if I mouse over the line. As > I said this worked fine yesterday. > > I tried reinstalling with an older version but to no avail. I am > totally clueless as to why this is happening. Anyone have a guess. > > Andrew > >  > >  > Let Crystal Reports handle the reporting  Free Crystal Reports 2008 30Day > 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/bobjjuly >  > > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers >  Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA 
From: Chuck PepeRanney <cpepera@mi...>  20090831 20:26:43

Thanks, I guess my problem is that I am using the latex prosper package to make presentation slides but I cannot compile prosper documents with pdflatex (see here <http://www.nefkom.net/georg.drenkhahn/prosper/>;). Sorry, I see that this is not a matplotlib specific question so I will try to find a solution somewhere else. On Mon, Aug 31, 2009 at 12:10 PM, John Hunter <jdh2358@...> wrote: > On Mon, Aug 31, 2009 at 1:04 PM, Chuck PepeRanney<cpepera@...> > wrote: > > Does anybody have a good method for preserving quality and transparancy > of > > eps images when going from matplotlib to latex to pdf? I can only > preserve > > the transparency if I save as png and then convert to eps but then I lose > > quality. If I save as eps directly, all my patches are opaque despite > the > > alpha values. > > The postscript format does not support transparency. This is not a > matplotlib limitation but a postscript limitation. The best solution > is to save your matplotlib figures as pdf, which is also a vector > format but which does support transparency, and then use pdflatex > > JDH >  Chuck PepeRanney Spear Lab Colorado School of Mines Work: (303)3842477 Cell: (575)3130993 
From: Andrew Kelly <ndrukelly@gm...>  20090831 20:14:20

I recently reinstalled matplotlib (0.99) on my vista machine and my code that worked yesterday (no changes) no longer runs because of the following matplotlib error: File "C:\Python25\Lib\sitepackages\matplotlib\lines.py", line 286, in contains path, affine = self._transformed_path.get_transformed_path_and_affine() AttributeError: 'NoneType' object has no attribute 'get_transformed_path_and_affine' All I am doing is initially drawing a line2D (which works) and then testing if line2D.contains(event)==True if I mouse over the line. As I said this worked fine yesterday. I tried reinstalling with an older version but to no avail. I am totally clueless as to why this is happening. Anyone have a guess. Andrew 
From: Eric Firing <efiring@ha...>  20090831 18:38:39

Teemu Ikonen wrote: > > I also need error band plotting regularly (also the loglog and semilog > versions) and currently have some quickly written code to do this in > matplotlib. > > If I clean up my code and submit a patch to axes and pyplot classes, > would it have a chance to be accepted? > > Teemu Also, if you haven't already, see http://matplotlib.sourceforge.net/devel/coding_guide.html. Eric 
From: Eric Firing <efiring@ha...>  20090831 18:33:53

Teemu Ikonen wrote: > Hi, > > I also need error band plotting regularly (also the loglog and semilog > versions) and currently have some quickly written code to do this in > matplotlib. > > If I clean up my code and submit a patch to axes and pyplot classes, > would it have a chance to be accepted? > Yes. Eric > Teemu 
From: John Hunter <jdh2358@gm...>  20090831 18:10:21

On Mon, Aug 31, 2009 at 1:04 PM, Chuck PepeRanney<cpepera@...> wrote: > Does anybody have a good method for preserving quality and transparancy of > eps images when going from matplotlib to latex to pdf? I can only preserve > the transparency if I save as png and then convert to eps but then I lose > quality. If I save as eps directly, all my patches are opaque despite the > alpha values. The postscript format does not support transparency. This is not a matplotlib limitation but a postscript limitation. The best solution is to save your matplotlib figures as pdf, which is also a vector format but which does support transparency, and then use pdflatex JDH 
From: Chuck PepeRanney <cpepera@mi...>  20090831 18:05:02

Does anybody have a good method for preserving quality and transparancy of eps images when going from matplotlib to latex to pdf? I can only preserve the transparency if I save as png and then convert to eps but then I lose quality. If I save as eps directly, all my patches are opaque despite the alpha values. Thanks,  Chuck 
From: Teemu Ikonen <tpikonen@gm...>  20090831 17:55:56

John Hunter wrote: >On Wed, Aug 5, 2009 at 9:40 AM, per freem<perfreem@...> wrote: >> hi all, >> >> is there a way in matplotlib to plot lines with errorbars, e.g. using >> errorbar(...) but instead of lines just have shaded, partly transparent >> regions that represent the error bars? people often use this to show >> confidence intervals or error bars... an example is here: >> >> http://eva.nersc.no/vhost/arcticroos.org/doc/observations/images/ssmi1_ice_ext.png >> >> where the black line has shaded grey bands around. i'd like to plot >> something like this but have the band be partly transparent. > >I use fill_between for this  draw the line with "plot" and the >shaded region with "fill_between". Hi, I also need error band plotting regularly (also the loglog and semilog versions) and currently have some quickly written code to do this in matplotlib. If I clean up my code and submit a patch to axes and pyplot classes, would it have a chance to be accepted? Teemu 
From: Christian Meesters <meesters@im...>  20090831 10:08:43

Jeff, that's a good point. I remember ... On Thu, 20090827 at 07:54 0600, Jeff Whitaker wrote: > Christian Meesters wrote: > >> Christian: That should work, if you created the masked array > >> correctly. Why are you creating the mask with data=='NA'? I suspect > >> that this always evaluates to False, so you don't get a mask. You > >> probably want to check for a numeric value, not a string. For example: > >> > > Thanks a lot, Jeff! > > > > Yes, the nonnumerical comparison was indeed causing problems  although > > I don't understand why. > > > > However, I can easily inject numerical nonsense values into the array. > > As to the 'NA': The data are an R output file. As I don't like R too > > much, I'm falling back to Python. > > > > Christian > > > > > Christian: What type of array is that (data.dtype)? I don't see how a > numpy array can have values equal to 'NA', unless it is an array of > strings. In that case, it would not be plottable anyway. > > Jeff 
From: <jasonsage@cr...>  20090830 04:14:08

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 xaxis. 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 xaxis 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 
From: Chris Michalski <chris.michalski@gm...>  20090829 23:43:06

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<efiring@...> > 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 directlyfile 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 
From: Sebastian Pająk <spconv+<m@gm...>  20090829 21:03:36

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\sitepackages\matplotlib\mpldata loaded rc file D:\msys\etc\.matplotlib\matplotlibrc matplotlib version 0.99.0 verbose.level debugannoying 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', 'numpy.lib.machar', 'numpy.linalg.linalg', 'numpy.testing.utils'] d:\> Can somebody help me?? 
From: John Hunter <jdh2358@gm...>  20090829 18:49:16

On Sat, Aug 29, 2009 at 1:12 PM, Eric Firing<efiring@...> 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 directlyfile 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 
From: Eric Firing <efiring@ha...>  20090829 18:12:54

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 directlyfile 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 
From: marc desmarais <mdesm2005@ya...>  20090829 07:15:30

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 
From: Craig <destroooooy@gm...>  20090829 02:09:34

From: John Hunter <jdh2358@gm...>  20090828 19:32:29

On Fri, Aug 28, 2009 at 1:59 PM, DEMOLISHOR! the Demolishor<destroooooy@...> wrote: > This is the result from a call to pyplot.pcolor()  why do the axes > automatically expand beyond the range of the data? And how can I set them > back? I am not seeing an obvious keyword argument in the pcolor docs to do > this... > could you post a complete example that replicates the problem? JDH 
From: Gökhan Sever <gokhansever@gm...>  20090828 19:14:15

Finetuning with axis(xmin=, xmax= , ymin= , ymax=) should yield a better looking result. You might use figure(frameon=False) for a transparent background. On Fri, Aug 28, 2009 at 1:59 PM, DEMOLISHOR! the Demolishor < destroooooy@...> wrote: > This is the result from a call to pyplot.pcolor()  why do the axes > automatically expand beyond the range of the data? And how can I set them > back? I am not seeing an obvious keyword argument in the pcolor docs to do > this... > > Thanks in advance > >  Craig > > >  > Let Crystal Reports handle the reporting  Free Crystal Reports 2008 30Day > 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/bobjjuly > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > >  Gökhan 
From: DEMOLISHOR! the Demolishor <destroooooy@gm...>  20090828 19:00:02

From: Chris Michalski <chris.michalski@gm...>  20090828 17:43:31

Recently, I had a need for a monotonic piecewise cubic Hermite interpolator. Matlab provides the function "pchip" (Piecewise Cubic Hermite Interpolator), but when I Googled I didn't find any Python equivalent. I tried "interp1d()" from scipy.interpolate but this was a standard cubic spline using all of the data  not a piecewise cubic spline. I had access to Matlab documentation, so I spent a some time tracing through the code to figure out how I might write a Python duplicate. This was an massive exercise in frustration and a potent reminder on why I love Python and use Matlab only under duress. I find typical Matlab code is poorly documented (if at all) and that apparently includes the code included in their official releases. I also find Matlab syntax “dated” and the code very difficult to “read”. Wikipedia to the rescue. Not to be deterred, I found a couple of very well written Wikipedia entries, which explained in simple language how to compute the interpolant. Hats off to whoever wrote these entries – they are excellent. The result was a surprising small amount of code considering the Matlab code was approaching 10 pages of incomprehensible code. Again  strong evidence that things are just better in Python... 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": # # pychip.py # Michalski # 20090818 # # Piecewise cubic Hermite interpolation (monotonic...) in Python # # References: # # Wikipedia: Monotone cubic interpolation # Cubic Hermite spline # # A cubic Hermte spline is a third degree spline with each polynomial of the spline # in Hermite form. The Hermite form consists of two control points and two control # tangents for each polynomial. Each interpolation is performed on one subinterval # at a time (piecewise). A monotone cubic interpolation is a variant of cubic # interpolation that preserves monotonicity of the data to be interpolated (in other # words, it controls overshoot). Monotonicity is preserved by linear interpolation # but not by cubic interpolation. # # Use: # # There are two separate calls, the first call, pchip_init(), computes the slopes that # the interpolator needs. If there are a large number of points to compute, # it is more efficient to compute the slopes once, rather than for every point # being evaluated. The second call, pchip_eval(), takes the slopes computed by # pchip_init() along with X, Y, and a vector of desired "xnew"s and computes a vector # of "ynew"s. If only a handful of points is needed, pchip() is a third function # which combines a call to pchip_init() followed by pchip_eval(). # import pylab as P #========================================================= def pchip(x, y, xnew): # Compute the slopes used by the piecewise cubic Hermite interpolator m = pchip_init(x, y) # Use these slopes (along with the Hermite basis function) to interpolate ynew = pchip_eval(x, y, xnew) return ynew #========================================================= def x_is_okay(x,xvec): # Make sure "x" and "xvec" satisfy the conditions for # running the pchip interpolator n = len(x) m = len(xvec) # Make sure "x" is in sorted order (brute force, but works...) xx = x.copy() xx.sort() total_matches = (xx == x).sum() if total_matches != n: print "*" * 50 print "x_is_okay()" print "x values weren't in sorted order  aborting" return False # Make sure 'x' doesn't have any repeated values delta = x[1:]  x[:1] if (delta == 0.0).any(): print "*" * 50 print "x_is_okay()" print "x values weren't monotonic aborting" return False # Check for inrange xvec values (beyond upper edge) check = xvec > x[1] if check.any(): print "*" * 50 print "x_is_okay()" print "Certain 'xvec' values are beyond the upper end of 'x'" print "x_max = ", x[1] indices = P.compress(check, range(m)) print "outofrange xvec's = ", xvec[indices] print "outofrange xvec indices = ", indices return False # Second  check for inrange xvec values (beyond lower edge) check = xvec< x[0] if check.any(): print "*" * 50 print "x_is_okay()" print "Certain 'xvec' values are beyond the lower end of 'x'" print "x_min = ", x[0] indices = P.compress(check, range(m)) print "outofrange xvec's = ", xvec[indices] print "outofrange xvec indices = ", indices return False return True #========================================================= def pchip_eval(x, y, m, xvec): # Evaluate the piecewise cubic Hermite interpolant with monoticity preserved # # x = array containing the xdata # y = array containing the ydata # m = slopes at each (x,y) point [computed to preserve monotonicity] # xnew = new "x" value where the interpolation is desired # # x must be sorted low to high... (no repeats) # y can have repeated values # # This works with either a scalar or vector of "xvec" n = len(x) mm = len(xvec) ############################ # Make sure there aren't problems with the input data ############################ if not x_is_okay(x, xvec): print "pchip_eval2()  ill formed 'x' vector!!!!!!!!!!!!!" # Cause a hard crash... STOP_pchip_eval2 # Find the indices "k" such that x[k] < xvec < x[k+1] # Create "copies" of "x" as rows in a mxn 2dimensional vector xx = P.resize(x,(mm,n)).transpose() xxx = xx > xvec # Compute column by column differences z = xxx[:1,:]  xxx[1:,:] # Collapse over rows... k = z.argmax(axis=0) # Create the Hermite coefficients h = x[k+1]  x[k] t = (xvec  x[k]) / h[k] # Hermite basis functions h00 = (2 * t**3)  (3 * t**2) + 1 h10 = t**3  (2 * t**2) + t h01 = (2* t**3) + (3 * t**2) h11 = t**3  t**2 # Compute the interpolated value of "y" ynew = h00*y[k] + h10*h*m[k] + h01*y[k+1] + h11*h*m[k+1] return ynew #========================================================= def pchip_init(x,y): # Evaluate the piecewise cubic Hermite interpolant with monoticity preserved # # x = array containing the xdata # y = array containing the ydata # # x must be sorted low to high... (no repeats) # y can have repeated values # # x input conditioning is assumed but not checked n = len(x) # Compute the slopes of the secant lines between successive points delta = (y[1:]  y[:1]) / (x[1:]  x[:1]) # Initialize the tangents at every points as the average of the secants m = P.zeros(n, dtype='d') # At the endpoints  use onesided differences m[0] = delta[0] m[n1] = delta[1] # In the middle  use the average of the secants m[1:1] = (delta[:1] + delta[1:]) / 2.0 # Special case: intervals where y[k] == y[k+1] # Setting these slopes to zero guarantees the spline connecting # these points will be flat which preserves monotonicity indices_to_fix = P.compress((delta == 0.0), range(n)) # print "zero slope indices to fix = ", indices_to_fix for ii in indices_to_fix: m[ii] = 0.0 m[ii+1] = 0.0 alpha = m[:1]/delta beta = m[1:]/delta dist = alpha**2 + beta**2 tau = 3.0 / P.sqrt(dist) # To prevent overshoot or undershoot, restrict the position vector # (alpha, beta) to a circle of radius 3. If (alpha**2 + beta**2)>9, # then set m[k] = tau[k]alpha[k]delta[k] and m[k+1] = tau[k]beta[b]delta[k] # where tau = 3/sqrt(alpha**2 + beta**2). # Find the indices that need adjustment over = (dist > 9.0) indices_to_fix = P.compress(over, range(n)) # print "overshoot indices to fix... = ", indices_to_fix for ii in indices_to_fix: m[ii] = tau[ii] * alpha[ii] * delta[ii] m[ii+1] = tau[ii] * beta[ii] * delta[ii] return m #= ======================================================================= def CubicHermiteSpline(x, y, x_new): # Piecewise Cubic Hermite Interpolation using CatmullRom # method for computing the slopes. # # Note  this only works if deltax is uniform? # Find the two points which "bracket" "x_new" found_it = False for ii in range(len(x)1): if (x[ii] <= x_new) and (x[ii+1] > x_new): found_it = True break if not found_it: print print "requested x=<%f> outside X range[%f,%f]" % (x_new, x[0], x[1]) STOP_CubicHermiteSpline() # Starting and ending data points x0 = x[ii] x1 = x[ii+1] y0 = y[ii] y1 = y[ii+1] # Starting and ending tangents (using CatmullRom spline method) # Handle special cases (hit one of the endpoints...) if ii == 0: # Hit lower endpoint m0 = (y[1]  y[0]) m1 = (y[2]  y[0]) / 2.0 elif ii == (len(x)  2): # Hit upper endpoints m0 = (y[ii+1]  y[ii1]) / 2.0 m1 = (y[ii+1]  y[ii]) else: # Inside the field... m0 = (y[ii+1]  y[ii1])/ 2.0 m1 = (y[ii+2]  y[ii]) / 2.0 # Normalize to x_new to [0,1] interval h = (x1  x0) t = (x_new  x0) / h # Compute the four Hermite basis functions h00 = ( 2.0 * t**3)  (3.0 * t**2) + 1.0 h10 = ( 1.0 * t**3)  (2.0 * t**2) + t h01 = (2.0 * t**3) + (3.0 * t**2) h11 = ( 1.0 * t**3)  (1.0 * t**2) h = 1 y_new = (h00 * y0) + (h10 * h * m0) + (h01 * y1) + (h11 * h * m1) return y_new #============================================================== def main(): ############################################################ # Sine wave test ############################################################ # Create a example vector containing a sine wave. x = P.arange(30.0)/10. y = P.sin(x) # Interpolate the data above to the grid defined by "xvec" xvec = P.arange(250.)/100. # Initialize the interpolator slopes m = pchip_init(x,y) # Call the monotonic piecewise Hermite cubic interpolator yvec2 = pchip_eval(x, y, m, xvec) P.figure(1) P.plot(x,y, 'ro') P.title("pchip() Sin test code") # Plot the interpolated points P.plot(xvec, yvec2, 'b') ######################################################################### # Step function test... ######################################################################### P.figure(2) P.title("pchip() step function test") # Create a step function (will demonstrate monotonicity) x = P.arange(7.0)  3.0 y = P.array([1.0, 1,1,0,1,1,1]) # Interpolate using monotonic piecewise Hermite cubic spline xvec = P.arange(599.)/100.  3.0 # Create the pchip slopes slopes m = pchip_init(x,y) # Interpolate... yvec = pchip_eval(x, y, m, xvec) # Call the Scipy cubic spline interpolator from scipy.interpolate import interpolate function = interpolate.interp1d(x, y, kind='cubic') yvec2 = function(xvec) # Nonmontonic cubic Hermite spline interpolator using # CatmulRom method for computing slopes... yvec3 = [] for xx in xvec: yvec3.append(CubicHermiteSpline(x,y,xx)) yvec3 = P.array(yvec3) # Plot the results P.plot(x, y, 'ro') P.plot(xvec, yvec, 'b') P.plot(xvec, yvec2, 'k') P.plot(xvec, yvec3, 'g') P.xlabel("X") P.ylabel("Y") P.title("Comparing pypchip() vs. Scipy interp1d() vs. non monotonic CHS") legends = ["Data", "pypchip()", "interp1d","CHS"] P.legend(legends, loc="upper left") P.show() ################################################################### main() 
From: Jeff Whitaker <jswhit@fa...>  20090828 12:22:26

Michael Droettboom wrote: > It's important to note that we're not, as far as I'm aware, > considering anything lighting or raytracinglike yet. I'm not sure > that Phong shading actually makes sense without doing that. The > Gouraud shading we're in the process of implementing uses only > explicit colors specified in the plot, not any sort of > lightsourcecalculated values. > > Add perhaps more importantly, Gouraud is implemented in a number of > vector formats, including PDF and PS (though matplotlib doesn't have > support for that yet, that's coming...) > > Mike Mike: I did add some support for crude lightsource shading a while back. It works directly on rgb values  see pylab_examples/shading_example.py. Jeff > > On 08/26/2009 07:06 PM, Nicolas Bigaouette wrote: >> Its great news that the 3D is receiving more polish :) >> >> After reading on wikipedia, wouldn't it be nicier to have Phong >> reflection[1] instead of Gouraud? >> >> Maybe it would be too hard, as the Gouraud seems to be implemented >> directly in Agg (from what others just said...) >> >> Anyway, just a suggestion ;) >> >> >> [1] http://en.wikipedia.org/wiki/Phong_reflection_model >> >> >> 2009/8/26 Eric Firing <efiring@... <mailto:efiring@...>> >> >> Reinier Heeres wrote: >> > Hi JJ, >> > >> > Thanks for the examples! I indeed suspected the antialiasing >> as well. >> > I'll include an option for linecolors = facecolors soon >> (probably this >> > weekend); it seems to be a good solution. >> >> No, not in general. There are two problems: it distorts the >> sizes and >> positions of the patches, very slightly, but enough that it might >> be a >> problem in some applications; and it does not work with alpha != 1. >> >> Eric >> >>  >> Let Crystal Reports handle the reporting  Free Crystal Reports >> 2008 30Day >> 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/bobjjuly >> _______________________________________________ >> Matplotlibusers mailing list >> Matplotlibusers@... >> <mailto:Matplotlibusers@...> >> https://lists.sourceforge.net/lists/listinfo/matplotlibusers >> >> >> >>  >> Let Crystal Reports handle the reporting  Free Crystal Reports 2008 30Day >> 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/bobjjuly >> >> _______________________________________________ >> Matplotlibusers mailing list >> Matplotlibusers@... <mailto:Matplotlibusers@...> >> https://lists.sourceforge.net/lists/listinfo/matplotlibusers >> > >  > >  > Let Crystal Reports handle the reporting  Free Crystal Reports 2008 30Day > 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/bobjjuly >  > > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > 
From: Michael Droettboom <mdroe@st...>  20090828 02:02:20

Maybe with the new spines support in 0.99 this could be an attribute/method on the spine? Mike On 08/27/2009 02:18 PM, JaeJoon Lee wrote: > I don't think there is a direct support for this in mpl and I guess > only way is to adjust the parameters of each ticks. > > def set_ticks_both(axis): > ticks = list( axis.majorTicks ) # a copy > ticks.extend( axis.minorTicks ) > > for t in ticks: > t.tick1On = True # tick marker on left (or bottom) > t.tick2On = True # tick marker on right (or top) > t.label1On = True # tick label marker on left (or bottom) > t.label2On = True # tick label on right (or top) > > set_ticks_both(ax.yaxis) > > JJ > > > > On Thu, Aug 27, 2009 at 7:22 AM, Peter Saffrey<pzs@...> wrote: > >> Some of my plots are very wide. I'd like Y axis labels on both sides so >> that it's clearer to read the bars towards the right hand side. >> >> I can change the ticks with yaxis.set_ticks_position("both") but there >> doesn't seem to be a similar call for labels. Any ideas? >> >> Thanks, >> >> Peter >> >>  >> Let Crystal Reports handle the reporting  Free Crystal Reports 2008 30Day >> 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/bobjjuly >> _______________________________________________ >> Matplotlibusers mailing list >> Matplotlibusers@... >> https://lists.sourceforge.net/lists/listinfo/matplotlibusers >> >> >  > Let Crystal Reports handle the reporting  Free Crystal Reports 2008 30Day > 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/bobjjuly > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > 