From: John H. <jdh...@ac...> - 2004-08-09 20:31:09
|
What's new in matplotlib-0.61.0 - Note win32 pygtk users - if you encounter problems or errors related to svg loading, see note at end of this email. You can read these announce notes in html with hyperlinks at http://matplotlib.sf.net/whats_new.html. * A new, enhanced, navigation toolbar. Set 'toolbar : toolbar2' in matplotlibrc to try it out. Tutorial on the new toolbar is at http://matplotlib.sf.net/tutorial.html#toolbar2. Note that this toolbar behaves very differently than the classic toolbar. To use it, you must click on the pan/zoom or zoom to rect and then interact with the axes by dragging your mouse over it. The 'forward', 'back' and 'home' buttons are used to navigate between previously defined view limits. At some point we'll add multiple simultaneous axes support for the new toolbar but we're still mulling over the interface - if you need it you can still uses toolbar : classic. * Mathtext for PS!!! Also, PS now embeds TrueType fonts so the same fonts you use in the *Agg GUIs should be displayed in PS output. Thanks Paul Barrett! * The imread function is used to load PNGs into arrays. I'd like to add more image loaders and savers down the road - http://matplotlib.sourceforge.net/matplotlib.matlab.html#-imread * New event handling. The functions mpl_connect and mpl_disconnect are used for backend independent event handling. The callback signature is func(event). See http://matplotlib.sf.net/tutorial.html#events and http://matplotlib.sf.net/examples/coords_demo.py. The new events carry lots of useful information in them, like the coords in display and data units, the axes instance they were over, keys pressed during the event and more. * Many fixes to the SVG backend, including page layout, font support and image support. SVG is now considered alpha. You can save ps/eps/svg figures from GUI backends by providing the right extensions. SVG is currently the fastest backend in my tests. * More memory leaks fixed - see http://matplotlib.sourceforge.net/faq.html#LEAKS for details. My estimate is that complex figures (multiple subplots, images, etc..) now leak no more than 10-50 bytes per figure. Down from several hundred bytes per figure in 0.60. * Vertical mathtext in backend_agg (ylabels now work properly!). mathtext with arbitrary rotations in PS. Thanks Jim Benson and Paul Barrett! * Added some abbrev functions in matplotlib.lines, mainly for interactive users trying to save key strokes. markerfacecolor is a lot of keys! For lines, these abbrevs were added aa : antialiased c : color ls : linestyle lw : linewidth mec : markeredgecolor mew : markeredgewidth mfc : markerfacecolor ms : markersize Thus you can type --not necessarily recommended for readability in scripts or apps but great for throwaway use in interactive shells # no antialiasing, thick green markeredge lines >>> plot(range(10), 'ro', aa=False, mew=2, mec='g') Analogs in matplotlib.patches aa : antialiased lw : linewidth ec : edgecolor fc : facecolor * You can put a .matplotlibrc file in a dir to override the one in your HOME dir. If you have a project, say a book, and you want to make a bunch of images with the same look and feel for the book, you can place a custom rc file in the code dir for that book and this won't affect the configs you use for normal, interactive use. * Updated installing instructions at http://matplotlib.sf.net/installing.html (see also INSTALL in src distro). Fixed a tk/osx install problem in setupext.py * New demo for wx/wxagg showing how to to make a flicker free cursor that follows the mouse and reports the coords in a status bar - see http://matplotlib.sf.net/examples/wxcursor_demo.py * Numerous bug fixes and minor enhancements detailed at http://matplotlib.sf.net/CHANGELOG Downloads at http://sourceforge.net/projects/matplotlib pygtk / win32 bug Alas, an enterprising matplotlib user found a bug in matplotlib-0.61 on win32 with recent versions of pygtk even before the announcement. Sigh. Is it just me or is testing multiple GUIs with multiple, incompatible versions on multiple platforms a pain? Apparently this bug is only exposed on recent versions of pygtk for win32. If you encounter problems, try removing or commenting out the last lines of site-packages\matplotlib\backends\backend_gtk.py which set the matplotlib minimization icon. Eg, triple quote """ # set icon used when windows are minimized if gtk.pygtk_version >= (2,2,0): basedir = matplotlib.rcParams['datapath'] fname = os.path.join(basedir, 'matplotlib.svg') try: gtk.window_set_default_icon_from_file (fname) except gobject.GError, exc: print >>sys.stderr, exc """ |
From: Philipp W. <ma...@ph...> - 2004-08-09 20:46:38
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hallo matplitlib userse, when using fill_over, it does not draw exactly at one line but with a slightly aberration. This especially is horrible when using a low resolution: The following program draws a nice sinus-curve and fills all values above 0.5. But when reducing the resolution (i.e. set the variable res to "1") fill_over generates weird fillings. from matplotlib.matlab import * from matplotlib.helpers import * res=0.1 # < 0.1 -> nice resolution # > 1 -> weird fillings x=[] y=[] x=arange(0,20,res) for i in x: y.append(sin(i)) r=axes() r.plot(x,y); fill_over(r,x,y, 0.5, '#0000FF',over=True) show() -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Darwin) iD8DBQFBF+JHQz7EsHuNmkoRAg86AJkBLwXFD+ShYKh/k9p7ZnRLbJQarACghr7U 3fjj7ejBOl/XxB854CgfYD0= =zPc3 -----END PGP SIGNATURE----- |
From: Stephen W. <ste...@cs...> - 2004-08-09 21:26:53
|
On Mon, 2004-08-09 at 13:44, Philipp Weissmann wrote: > when using fill_over, it does not draw exactly at one line but with a=20 > slightly aberration. This especially is horrible when using a low=20 > resolution: It looks to me, when running your code, that fill_over is doing the right thing: filling everything between 0.5 and your plotted line with a color. It is just that with your coarse spacing, you don't have points at every multiple of pi/2. However, this is with the current CVS version, so you may have a problem with 0.60.2. Is fill_over supported in any way? I had a problem finding it, and it looks like it is in the category of unsupported contribted code. By the way, Herr Weissman, setting up your sample data can be done simply by typing x=3Darange(0,20) y=3Dsin(x) without 'x=3D[]', 'y=3D[]', or the for loop. --=20 Stephen Walton <ste...@cs...> Dept. of Physics & Astronomy, Cal State Northridge |
From: John H. <jdh...@ac...> - 2004-08-09 22:43:36
|
>>>>> "Stephen" == Stephen Walton <ste...@cs...> writes: Stephen> It looks to me, when running your code, that fill_over is Stephen> doing the right thing: filling everything between 0.5 and Stephen> your plotted line with a color. It is just that with Stephen> your coarse spacing, you don't have points at every Stephen> multiple of pi/2. However, this is with the current CVS Stephen> version, so you may have a problem with 0.60.2. Probably what Philipp is looking for is for fill_over to do some linear interpolation between his data points, which I think gives the least surprising results. The attached code probably comes closer to what he's looking for. It's probably a useful function to include in the library - see if it meets your needs from matplotlib.matlab import * def fill_over(ax, x, y, val, color, over=True): """ Plot filled x,y for all y over val If over = False, fill under """ x = asarray(x).astype(nx.Float32) y = asarray(y).astype(nx.Float32) ybase = asarray(y)-val crossings = nonzero(less(ybase[:-1] * ybase[1:],0)) on = not over indLast = 0 for ind in crossings: if not on: on = not on indLast = ind continue thisX = array(x[indLast:ind+2]) thisY = array(y[indLast:ind+2]) #find the x point between x[0] and x[1] on the line #connecting them such that f(x) = 0.5 #if len(thisX)<3: continue m = (thisY[1]-thisY[0])/(thisX[1]-thisX[0]) x0 = (val-thisY[0])/m+thisX[0] thisX[0] = x0 thisY[0] = val # now get the last point on the interpolated line m = (thisY[-1]-thisY[-2])/(thisX[-1]-thisX[-2]) xend = (val-thisY[-2])/m+thisX[-2] thisX[-1] = xend thisY[-1] = val on = not on ax.fill(thisX, thisY, color) indLast = ind x=arange(0.0, 20.0, 1.0) y = sin(x) plot(x,y, 'ro-') fill_over(gca(), x, y, 0.5, '#0000FF', over=True) show() |
From: Stephen W. <ste...@cs...> - 2004-08-10 04:27:15
|
On Mon, 2004-08-09 at 15:19, John Hunter wrote: > Probably what Philipp is looking for is for fill_over to do some > linear interpolation between his data points, which I think gives the > least surprising results. The attached code probably comes closer to > what he's looking for. John, you're quite right in your deduction. For some reason I wasn't seeing exactly the behavior Philipp reported, although it was enough different from your result that I agree your code is closer to what is required. His example code and yours give somewhat different results when used with the fill_over function on the matplotlib Web site. Boy, Python is fun...and I'm learning to like matplotlib a lot too. Steve |
From: Philipp W. <ma...@ph...> - 2004-08-10 06:33:21
|
> On Mon, 2004-08-09 at 15:19, John Hunter wrote: >> Probably what Philipp is looking for is for fill_over to do some >> linear interpolation between his data points, which I think gives the >> least surprising results. The attached code probably comes closer to >> what he's looking for. > > John, you're quite right in your deduction. For some reason I wasn't > seeing exactly the behavior Philipp reported, although it was enough > different from your result that I agree your code is closer to what is > required. His example code and yours give somewhat different results > when used with the fill_over function on the matplotlib Web site. > > Boy, Python is fun...and I'm learning to like matplotlib a lot too. > > Steve > > > Good Morning and thank you for your help. With the new function code, the filling works really great. Thank you ! Philipp Weißmann |