Re: [Matplotlib-users] Printing problems with WXAgg on Linux (minakawa)
Happy New Year to you as well! I see now where part of the confusion lies -- even though you have specified the WxAgg backend, the Wx backend is being used for the printing. Though I didn't write this code, I assume this is by design -- WxAgg can only generate bitmaps, and we don't want to use those for printing. Unfortunately, Wx (non-Agg) has some limitations, as you've discovered. (For a list of the limitations, see http://matplotlib.sourceforge.net/backends.html). Given all those shortcomings, you may be better off generating a Postscript file and then send that to lpr. That should work on most modern Linux distributions even without a Postscript printer. You can do: savefig(foo.ps) to use the matplotlib built-in Postscript backend. As for your other questions -- 1. You cannot set orientation to LANDSCAPE, it seems SetOrientation does not work. 2. When you set LANDSCAPE manually, only lower half part will be printed. I can't reproduce this. Your included example seems to produce correct LANDSCAPE pages for me. These are my relevant versions -- what are yours? wxPython: 2.8.6.1 gtk+: 2.10.9 RHEL4 3. Printing quality is far much worse than Windows's printing. I can confirm that the Postscript generated by Wx is storing a bitmap, and not vector data. This is probably the source of the quality loss. I can't quite figure out why this is happening, but I have experienced similar problems with another Wx project. Perhaps that's an inherent limitation of Wx printing? In any case, it's a little bit below the level of matplotlib, so perhaps a question on the wxPython mailing list would help... But my suggested workaround -- generating a Postscript file using matplotlib's built-in Postscript support, instead of the Wx printing framework -- and then printing that may be a better option for you. Cheers, Mike Johann Cohen-Tanugi wrote: hi Mike, no it is WxAgg, the code is here: - import wx import os import matplotlib matplotlib.use('WxAgg') from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigCanvas from matplotlib.figure import Figure import matplotlib.numerix as numpy class PlotFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, -1, Test Printing with WX Backend) self.fig = Figure(None, 100) self.canvas= FigCanvas(self, -1, self.fig) self.axes = self.fig.add_axes([0.15,0.15,0.75,0.75]) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.canvas, 1, wx.LEFT|wx.TOP|wx.GROW) self.Fit() self.Plot_Data() def Print_Data(self): self.canvas.printerData.SetPaperId(wx.PAPER_A4) self.canvas.printerData.SetOrientation(wx.LANDSCAPE) dpi = self.canvas.figure.dpi.get() self.canvas.figure.dpi.set(200) self.canvas.Printer_Print() self.canvas.figure.dpi.set(dpi) self.canvas.draw() def Plot_Data(self): t = numpy.arange(0.0,5.0,0.01) s = numpy.sin(2.0*numpy.pi*t) c = numpy.cos(0.4*numpy.pi*t) self.axes.plot(t,s) self.axes.plot(t,c) if __name__ == '__main__': app = wx.PySimpleApp() fig = PlotFrame() fig.Show(True) fig.Print_Data() app.MainLoop() - But you got a point with usetex : I set it to False and then no more traceback, though the preview indicates that LANDSCAPE mode was not applied. So : WxAgg seems to have issues with usetex=True, and LANDSCAPE request does not seem to be honored... I am using svn revision 4797. best, and happy New Year! Johann Michael Droettboom wrote: From the traceback, it looks as if you are using the Wx backend, not the WxAgg backend, and you are using usetex (text rendering using (La)TeX). The Wx backend does not support usetex -- the WxAgg backend does. Check your matplotlibrc or your matplotlib.use command and make sure you're selecting the WxAgg backend. Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] mouse coordinate precision in figures
You can also set a custom formatter for each axis without hacking the matplotlib code:: def custom_formatter(value): return str(value) gca().fmt_xdata = custom_formatter gca().fmt_ydata = custom_formatter We may want to add a cleaner (more obvious) API for this -- but there might be good reasons that it works this way that I just don't know about. Cheers, Mike Yongtao Cui wrote: Hi Jack, In \matplotlib\axes.py, Axes.format_xdata() func = self.xaxis.get_major_formatter().format_data_short -func = self.xaxis.get_major_formatter().format_data same for Axes.format_ydata() -Yongtao On Dec 22, 2007 1:46 PM, Jack Sankey [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hello, When you make a figure and move the mouse around inside the axes, the x- and y-values appear in the status bar. Is there a way to change the precision of this data? It's only tracking 3 significant figures and I need more (say you're zoomed in on some data with a large offset). Is there a way to change this in matplotlibrc or some global preference? If not, is it a figure property? Thanks in advance, Jack - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net mailto:Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users https://lists.sourceforge.net/lists/listinfo/matplotlib-users - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] problem with ticker and mathtext
The default mathtext font should have the times symbol. Are you making any other changes that would affect the selection of mathtext fonts? (Can you please attach a copy of your matplotlibrc file?) If that looks ok, perhaps it isn't finding the math fonts correctly. There are a multitude of reasons that could be happening. It is sometimes helpful to set verbose.level to debug-annoying and then look at the logs to see what might be going on. Also, you could try deleting the fonts cache in ~/.matplotlib/fontManager.cache to force it to regenerate. Cheers, Mike Matthias Michler wrote: Hello list, the little example below seems to fail, can anybody help me? I'm on Debian using the release 0.91.2. best regards and thanks in advance for any hints, Matthias --- from matplotlib.ticker import ScalarFormatter from matplotlib.pyplot import * ax = axes() axis([0.0, 10**-7, 0, 10**-7]) ax.yaxis.set_major_formatter(ScalarFormatter(useMathText=True)) show() error message: /scratch/michler/SOFT/lib/python2.4/site-packages/matplotlib/mathtext.py:722: MathTextWarning: Unrecognized symbol '\times'. Substituting with a dummy symbol. % sym.encode('ascii', 'backslashreplace'), MathTextWarning) the string '\times' is due to line sciNotStr = r'{\times}'+self.format_data(10**self.orderOfMagnitude) in function ScalarFormatter.get_offset - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Arrows that shimmy
Norman, There is code (in 0.91, going back before my time) that rounds the vertices of polygons (which arrows in effect are) to the center of pixels. You can see it here inside RendererAgg::draw_polygon() in _backend_agg.cpp: agg::path_storage path; for (size_t j=0; jNpoints; j++) { double x = xs[j]; double y = ys[j]; //snapto pixel centers x = (int)x + 0.5; y = (int)y + 0.5; if (j==0) path.move_to(x,y); else path.line_to(x,y); } path.close_polygon(); You could comment out these two lines: x = (int)x + 0.5; y = (int)y + 0.5; and see if that corrects your wiggliness problem, just to confirm that as the source. The bigger question is -- there was probably a good reason that this code was put in there in the first place, so it probably isn't a good idea to remove it en masse. It may need to be exposed as an argument so some things get this behavior and others don't. I know that dashed lines that are perpendicular to the edges of the figure (e.g. grid lines) look much worse if they aren't rounded to pixel centers. But in general for polygons, I don't know if that's true. Now to veer away from your question a little bit -- On the transforms branch (which is now in SVN head, and not in any release), this behavior has changed. The new heuristic is that if a path (which includes everything including lines and polygons) includes only straight and axis-aligned segments, it is rounded. If it includes any curves or non-axis-aligned segments it is not rounded. This heuristic seems to work quite well in practice, since it includes grid lines, non-rotated rectangles etc., but I am interested in getting feedback from other users if that heuristic fails in any special circumstances. Cheers, Mike Norman Davis wrote: Hi all, I' ve been using matplotlib to create some animations and it seems that the endpoints for arrow polygon lines are being rounded off to the nearest pixel. At least thats my guess. When viewing an animation the arrow changes shape and distorts as it moves around. The code below shows it on my Windows XP system where I'm using Matplotlib 0.91.1, SciPy 0.6.0, Numpy 1.0.4, Python 2.4. (The code is adapted from examples/animation_blit_tk.py) I've also seen this on my Linux setup when producing .png's for animation. I think I also remember noticing circle patches having discrete movements, so it may be more general than arrows. I'm wondering if other's find this to be a problem. Its distracting in my particular case. What can I do to help change this? I've been enjoying matplotlib along with basemap for the past two years and would like to help out if I can. Norm. - - - - - - import matplotlib matplotlib.use('TkAgg') import sys import pylab as p from matplotlib.patches import Arrow ax = p.subplot(111) canvas = ax.figure.canvas def run(*args): background = canvas.copy_from_bbox(ax.bbox) while 1: canvas.restore_region(background) ells = [Arrow(x = i/20.+ (run.cnt+1)/16000., y = 0.4+ (run.cnt+1)/3., dx = 0.04 + 1/200., dy = 0.06, width=0.03) for i in xrange(10)] for e in ells: ax.add_artist(e) for e in ells: ax.draw_artist(e) canvas.blit(ax.bbox) for e in ells: e.remove() if run.cnt==1000: sys.exit() run.cnt += 1 run.cnt = 0 p.subplots_adjust(left=0.3, bottom=0.3) p.grid() manager = p.get_current_fig_manager() manager.window.after(100, run) p.show() - - - - - - - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] screen colors invert with matplotlib
I wonder if the problem exhibits itself in any other pyqt4 apps (such as the demo apps)... In that case, I would take your question to the pyqt list. Otherwise, we'll want to track down what specifically matplotlib is doing that causes this. Cheers, Mike Dan Karipides wrote: Thanks John. I did this test: python simple_plot.py -dTkAgg and it worked just fine. (The GTK backend won't compile for me, but that is a topic for another email.) So you are correct, it seems to be a qt4 problem or a pyqt4 problem, I guess. At least I know where to look now. -Dan -Original Message- From: John Hunter [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 09, 2008 11:40 AM To: Dan Karipides Cc: Matplotlib Users Subject: Re: [Matplotlib-users] screen colors invert with matplotlib On Jan 9, 2008 10:14 AM, Dan Karipides [EMAIL PROTECTED] wrote: OS: Fedora Core 8 Video Card: Nvidia GeForce 8800 Ultra Driver: Latest Unix driver from Nvidia (169.07, release date: Dec 20, 2007) Matplotlib version: matplotlib-0.91.2.tar.gz (built from source) Backend chosen: qt4agg Hi Dan, No one has ever reported anything like this before as far as I know. Could you try running a simple test script with a different GUI backend, eg tkagg or gtkagg python simple_plot.py -dTkAgg #or GTKAgg I assume this is a qt4 problem, but I'd just like to confirm before we proceed. Do you see it with qtagg or just qt4agg? - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] rectangular bracket in mathtext
You need to escape the [: mpl_pp.xlabel(r$\[$) [] and {} have special meanings in math syntax, so to use them literally, they need to be escaped. Cheers, Mike Matthias Michler wrote: Hello list, the little example below leads to an error on my system (output is attached). I used this some time ago and it worked. Now I'm using the release 0.91.2. Is there a reason to use rectangular brackets not in mathtext? (same problem occur with '{' for me.) best regards and thanks in advance for any help, Matthias - import matplotlib.pyplot as mpl_pp mpl_pp.axes() mpl_pp.xlabel($[$) mpl_pp.show() - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] (no subject)
I've committed these changes to matplotlib SVN, and it should make it into the next release of 0.91.x, if we decide to make one. You may be right that Qt's SVG support is iffy (I don't know enough about the spec to be sure, so I'm not conceding that), but either way it doesn't bother me to make changes that help SVG work in more places. It's like all those pragmatic web developers who have to make things work with IE... Thanks for your help. I'll try to get the Qt SVG demo installed here so I can test with that the next time our SVG code changes. Cheers, Mike Christiaan Putter wrote: Hi Michael, Sorry for getting back to you only now, and thanks for the help. If you have Qt installed there should be an sample Svg viewer app in the examples somewhere. If you'd like I can send it to you somehow, just let me know. I tested the new .svg you sent me it's rendering the same in Firefox and Qt. So it works. Once again thanks for your help and let me know if I can send you something to help with testing in Qt. Personally I think Qt's support for svg is still a bit iffy. Have a nice, Christiaan On 04/01/2008, *Michael Droettboom* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Can you please test the attached SVG file? Cheers, Mike Michael Droettboom wrote: Between 0.90 and 0.91, the SVG backend was changed to store the glyph outlines of the characters in the SVG file itself. (This is on by default, but can be turned off with the rc parameter svg.embed_char_paths). This helps make the SVG files much more portable, as the need to install the math fonts has long been a FAQ on this list. I've been doing all my testing with Firefox and Inkscape. Is there a simple Qt-based SVG viewer I could add to my testing regimen? I won't pretend to be an expert on the SVG spec, but it does say this: http://www.w3.org/TR/SVG/struct.html#Head To provide some SVG user agents with an opportunity to implement efficient implementations in streaming environments, creators of SVG content are encouraged to place all elements which are targets of local URI references within a 'defs' element which is a direct child of one of the ancestors of the referencing element. For example: ?xml version=1.0 standalone=no? !DOCTYPE svg PUBLIC -//W3C//DTD SVG 1.1//EN http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd; svg width=8cm height=3cm xmlns=http://www.w3.org/2000/svg; descLocal URI references within ancestor's 'defs' element./desc defs linearGradient id=Gradient01 stop offset=20% stop-color=#39F / stop offset=90% stop-color=#F3F / /linearGradient /defs rect x=1cm y=1cm width=6cm height=1cm fill=url(#Gradient01) / !-- Show outline of canvas using 'rect' element -- rect x=.01cm y=.01cm width=7.98cm height= 2.98cm fill=none stroke=blue stroke-width=.02cm / /svg View this example as SVG (SVG-enabled browsers only) In the document above, the linear gradient is defined within a 'defs' element which is the direct child of the 'svg' element, which in turn is an ancestor of the 'rect' element which references the linear gradient. Thus, the above document conforms to the guideline. So we are complying to that part of the spec. The spec doesn't seem to say anything about whether the defs must appear before or after their use -- but maybe I just can't find the relevant paragraph. In any case, this should be easy enough to fix on matplotlib's end, and certainly won't break compliance with the spec. I'll have a look, and may come back to you for help with testing with Qt if you don't mind. Cheers, Mike Christiaan Putter wrote: Hi there, Just an update regarding the svg problem I was having: I simply went back to 0.90 and that's working now. Would still be nice to know if the svg output from matplotlib complies with the standard or whether it's Qt that's messing things up. Merry x-mass! cputter On 21/12/2007, *Christiaan Putter* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi guys and girls, Quick question regarding matplotlib's svg backend... I've embeded pyhton into c++ and Qt's (4.3.3) svg support is having some problems with .svg files created by matplotlib. Text
Re: [Matplotlib-users] re sizing behaviour like in Mircrocal Origin
DaFudl wrote: I integrated mpl into my wxPython application for plotting simple lines. I would like my canvas to behave differently when the containing window is being resized. At the moment all text, all lines, all markers, the legend... remain in the same state (same size and thickness) regardless whether the plot is small or big. As a result the plot looks fine at one size only. I need all elements to be resized with the window just like it happens in Microcal's scientific plotting software origin. Everything should resize as a whole. I think what you're asking for would require a pretty major overhaul of matplotlib. The fact that all the text etc. remains the same size is a deliberate design decision, and actually requires a lot more work to make fast enough, since a lot more must be recalculated with each redraw, rather than just multiplying everything by a scale factor. All that said, you could experiment with rendering to a vector format (e.g. Pdf or Svg) and then have wxPython render it directly with each window resize. (This would be much the same way that resizing a PDF generated by matplotlib in Acrobat Reader scales everything as a whole). Alternatively, you could try using a backend (e.g. Cairo) that allows you to push a global affine transformation onto the transformation stack. (At present, the Agg backends don't have that functionality -- but it could be added, especially since the recent overhaul of transformations in general in matplotlib.) That way, you could tell the underlying rendering engine (below matplotlib) to scale everything up and down for any subsequent commands it receives from matplotlib. But, anyway you slice it, I think you're looking at getting your hands dirty in some matplotlib internals. I'm happy to help if you want to work through it, but I don't think I would have time myself. Also, it would be great to keep the aspect ratio of the plot when resizing and zooming. I could not figure out how to do that. Using methods like apply_aspect and set_adjustable is not enough. That seems to be easy enough to do in the window resize callback -- just programmatically force-resize the window to the desired aspect ratio. Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] re sizing behaviour like in Mircrocal Origin
Doh! Why didn't I think of that? Mike John Hunter wrote: On Jan 14, 2008 3:55 PM, Michael Droettboom [EMAIL PROTECTED] wrote: I think what you're asking for would require a pretty major overhaul of matplotlib. The fact that all the text etc. remains the same size is a matplotlib is designed to scale in the way Jurgen requests with DPI (eg fonts, line thicknesses and the like scale with DPI). In [65]: fig = figure() In [66]: plot([1,2,3]) Out[66]: [matplotlib.lines.Line2D instance at 0xbf965ec] In [67]: fig.dpi.set(200) In [68]: fig.canvas.draw() with a little work, one could hook into the resize mechanism to increase the dpi to create the desired effect w/o a major overhaul. By default what happens is the width and height in inches are changed with a resize but the dpi is held constant. One could trick matplotlib by computing a new width, height in inches, and a new dpi so that the resized canvas width in pixels is the requested size based on the resize event but the dpi is increased to create the microcal effect JDH -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Is Gtk draw() slow?
In my own tests, using the built-in GUI windows I get the following numbers on the simple_plot_fps.py speed test (which essentially tests redrawing speed, which is pretty GUI-backend dependent, as opposed to the first drawing operation which involves more common code): GtkAgg: wallclock: 3.73636507988 user: 2.9 fps: 26.7639799276 Gtk: wallclock: 1.99883008003 user: 1.99 fps: 50.0292651181 TkAgg: wallclock: 4.55140709877 user: 4.41 fps: 21.9712273216 So you can see that GtkAgg is actually slightly faster than TkAgg, and Gtk (if you can accept the lower rendering quality), is almost 2x as fast. So, if you're certain the same amount of data is being plotted in the default Tk window and your custom Gtk window, it seems to suggest that the slowdown is probably something in how you're embedding it. (Obviously the number of data points as a significant impact on speed regardless of backend.) I'm not enough of a Gtk expert that anything in what you're doing jumps out at me. What triggers the call to plotFrictionProfile? Is that possible that is getting called more times than you expect? Cheers, Mike steve george wrote: Hi, I don't have conclusive proof, .. but I suspect that the draw() of a graph in a pyGTK application is order of magnitudes slower than I can plot the same data in the default Tk graphing widget. i.e. 5 sec in tk, ... and 1 minute in gtk Obvious question, ... is this a know issue? Is there any tricks in gtk to speed up the draw() Attached is a heavily snipped example of bits and pieces of my code, maybe I have structured my program incorrectly? Thanks for any comments Steve - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Missing data in a date graph
You can use a numpy masked array, and mask the values that you don't want to plot. Or you can use a normal numpy array and set the missing values to numpy.nan. (There seem to be a few side cases where the second option doesn't do what you would expect in 0.91.2, but AFAIK it works in recent revisions of the SVN trunk.) In either case, you will still need to assign dates to correspond to those missing values. See masked_demo.py for an example (which doesn't use dates, but the concepts are the same). Cheers, Mike Lucas Di Pentima wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi all, I'm starting with matplotlib, using it to build a performance monitor web application. The plots I'm using mostly are date based graphs, what's the best way to go when I have to plot some data that have gaps inside the date ranges? The default behaviour is to just connect the last known value with the first one after the gap and I would prefer that the graph simply don't graph anything in that range. Thanks in advance - -- Lucas Di Pentima - http://lucas.di-pentima.com.ar GnuPG Public Key: http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x6AA54FC9 Key fingerprint = BD3B 08C4 661A 8C3B 1855 740C 8F98 3FCF 6AA5 4FC9 -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFHjKg4j5g/z2qlT8kRAtc7AKCORvzHbT8vy5os2TfzgttzrgIycACdE2dH Rj0iCiSnVZMB3rdnFMWbBcQ= =0v0+ -END PGP SIGNATURE- - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Is Gtk draw() slow?
Ah -- just thought of something else. If I adjust simple_plot_fps.py to have 100,000 data points rather than 1,000 I see something that starts to match with what you're seeing: GtkAgg: wallclock: 4.23297405243 user: 3.33 fps: 23.6240522057 Gtk: wallclock: 15.0203828812 user: 14.92 fps: 6.65761990165 TkAgg: wallclock: 4.8252530098 user: 4.67 fps: 20.7243018754 You can see that the Gtk time is starting to explode. If I go to 1,000,000 points, Gtk runs out of memory before the first plot, whereas the other two continue to chug along at a reasonable pace. From looking at the code, I suspect the crucial difference is that the Gdk backend uses the Python sequence API (rather slow) to access the data as it gets rendered, whereas GtkAgg uses the numpy array interface which is essentially raw access to a C array. So -- try using GtkAgg if you can get away with it. The only real advantage of the raw Gtk (Gdk specifically) backend is when running over a remote X connection. If that's not an option for you, I don't have any easy solution that comes to mind. It's sort of a pygtk issue -- it would have to be rewritten to take numpy arrays which is probably unlikely to happen in the official codebase. Matplotlib has a little more control over what happens in the Agg backend, since the Python wrapper is included in matplotlib. Hope that information helps. Cheers, Mike Michael Droettboom wrote: In my own tests, using the built-in GUI windows I get the following numbers on the simple_plot_fps.py speed test (which essentially tests redrawing speed, which is pretty GUI-backend dependent, as opposed to the first drawing operation which involves more common code): GtkAgg: wallclock: 3.73636507988 user: 2.9 fps: 26.7639799276 Gtk: wallclock: 1.99883008003 user: 1.99 fps: 50.0292651181 TkAgg: wallclock: 4.55140709877 user: 4.41 fps: 21.9712273216 So you can see that GtkAgg is actually slightly faster than TkAgg, and Gtk (if you can accept the lower rendering quality), is almost 2x as fast. So, if you're certain the same amount of data is being plotted in the default Tk window and your custom Gtk window, it seems to suggest that the slowdown is probably something in how you're embedding it. (Obviously the number of data points as a significant impact on speed regardless of backend.) I'm not enough of a Gtk expert that anything in what you're doing jumps out at me. What triggers the call to plotFrictionProfile? Is that possible that is getting called more times than you expect? Cheers, Mike steve george wrote: Hi, I don't have conclusive proof, .. but I suspect that the draw() of a graph in a pyGTK application is order of magnitudes slower than I can plot the same data in the default Tk graphing widget. i.e. 5 sec in tk, ... and 1 minute in gtk Obvious question, ... is this a know issue? Is there any tricks in gtk to speed up the draw() Attached is a heavily snipped example of bits and pieces of my code, maybe I have structured my program incorrectly? Thanks for any comments Steve - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] usetex=True
It's a bug. It's now possible for rgba colors to make their way all the way down to that level, so the code needs to truncate that to rgb (Ps can't handle alpha anyway). This is committed in SVN r4869. Cheers, Mike Paul Novak wrote: Hello, I am trying to use the PS backend to make some simple line plots, using the following script, but I get the error messages included below when I try to plot with usetex=True. I have also included the output from --verbose=helpful. I am using the current SVN, and I don't recall having this problem when using 0.91.1. Thanks, Paul --- #!/usr/bin/env python import matplotlib matplotlib.use('PS') matplotlib.rc('text', usetex = 'True') from pylab import * x = arange(0,5) y = 2 * x figure(1) plot(x, y) savefig('psfig') show() --- $HOME=/home/pnovak CONFIGDIR=/home/pnovak/.matplotlib matplotlib data path /usr/lib/python2.5/site-packages/matplotlib/mpl-data loaded rc file /home/pnovak/.matplotlib/matplotlibrc matplotlib version 0.98pre verbose.level helpful interactive is False units is False platform is linux2 numerix numpy 1.0.3.1 Using fontManager instance from /home/pnovak/.matplotlib/fontManager.cache backend PS version Level II Found dvipng version 1.5 Traceback (most recent call last): File junk.py, line 15, in module savefig('psfig') File /usr/lib/python2.5/site-packages/matplotlib/pyplot.py, line 271, in savefig return fig.savefig(*args, **kwargs) File /usr/lib/python2.5/site-packages/matplotlib/figure.py, line 854, in savefig self.canvas.print_figure(*args, **kwargs) File /usr/lib/python2.5/site-packages/matplotlib/backend_bases.py, line 1085, in print_figure **kwargs) File /usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py, line 837, in print_ps return self._print_ps(outfile, 'ps', *args, **kwargs) File /usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py, line 863, in _print_ps orientation, isLandscape, papertype) File /usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py, line 1051, in _print_figure_tex self.figure.draw(renderer) File /usr/lib/python2.5/site-packages/matplotlib/figure.py, line 698, in draw for a in self.axes: a.draw(renderer) File /usr/lib/python2.5/site-packages/matplotlib/axes.py, line 1397, in draw a.draw(renderer) File /usr/lib/python2.5/site-packages/matplotlib/axis.py, line 680, in draw tick.draw(renderer) File /usr/lib/python2.5/site-packages/matplotlib/axis.py, line 179, in draw self.label1.draw(renderer) File /usr/lib/python2.5/site-packages/matplotlib/text.py, line 761, in draw Text.draw(self, renderer) File /usr/lib/python2.5/site-packages/matplotlib/text.py, line 309, in draw self._fontproperties, angle) File /usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py, line 544, in draw_tex color = '%1.3f,%1.3f,%1.3f'% gc.get_rgb() TypeError: not all arguments converted during string formatting - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] usetex=True
Thanks for pointing that out -- I didn't even notice. There was an ordering problem in how colors were being set. This should be fixed in r4870. Cheers, Mike Paul Novak wrote: I have another problem after updating to SVN r4869. The ticks take the color of the plotted line without regard to the default. For example, matplotlib.rc('xtick', color='black') matplotlib.rc('ytick', color='black') plot(x, y, 'red') will give red ticks. Paul Michael Droettboom wrote: It's a bug. It's now possible for rgba colors to make their way all the way down to that level, so the code needs to truncate that to rgb (Ps can't handle alpha anyway). This is committed in SVN r4869. Cheers, Mike Paul Novak wrote: Hello, I am trying to use the PS backend to make some simple line plots, using the following script, but I get the error messages included below when I try to plot with usetex=True. I have also included the output from --verbose=helpful. I am using the current SVN, and I don't recall having this problem when using 0.91.1. Thanks, Paul --- #!/usr/bin/env python import matplotlib matplotlib.use('PS') matplotlib.rc('text', usetex = 'True') from pylab import * x = arange(0,5) y = 2 * x figure(1) plot(x, y) savefig('psfig') show() --- $HOME=/home/pnovak CONFIGDIR=/home/pnovak/.matplotlib matplotlib data path /usr/lib/python2.5/site-packages/matplotlib/mpl-data loaded rc file /home/pnovak/.matplotlib/matplotlibrc matplotlib version 0.98pre verbose.level helpful interactive is False units is False platform is linux2 numerix numpy 1.0.3.1 Using fontManager instance from /home/pnovak/.matplotlib/fontManager.cache backend PS version Level II Found dvipng version 1.5 Traceback (most recent call last): File junk.py, line 15, in module savefig('psfig') File /usr/lib/python2.5/site-packages/matplotlib/pyplot.py, line 271, in savefig return fig.savefig(*args, **kwargs) File /usr/lib/python2.5/site-packages/matplotlib/figure.py, line 854, in savefig self.canvas.print_figure(*args, **kwargs) File /usr/lib/python2.5/site-packages/matplotlib/backend_bases.py, line 1085, in print_figure **kwargs) File /usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py, line 837, in print_ps return self._print_ps(outfile, 'ps', *args, **kwargs) File /usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py, line 863, in _print_ps orientation, isLandscape, papertype) File /usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py, line 1051, in _print_figure_tex self.figure.draw(renderer) File /usr/lib/python2.5/site-packages/matplotlib/figure.py, line 698, in draw for a in self.axes: a.draw(renderer) File /usr/lib/python2.5/site-packages/matplotlib/axes.py, line 1397, in draw a.draw(renderer) File /usr/lib/python2.5/site-packages/matplotlib/axis.py, line 680, in draw tick.draw(renderer) File /usr/lib/python2.5/site-packages/matplotlib/axis.py, line 179, in draw self.label1.draw(renderer) File /usr/lib/python2.5/site-packages/matplotlib/text.py, line 761, in draw Text.draw(self, renderer) File /usr/lib/python2.5/site-packages/matplotlib/text.py, line 309, in draw self._fontproperties, angle) File /usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py, line 544, in draw_tex color = '%1.3f,%1.3f,%1.3f'% gc.get_rgb() TypeError: not all arguments converted during string formatting - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] usetex=True
, ) Michael Droettboom wrote: Thanks for pointing that out -- I didn't even notice. There was an ordering problem in how colors were being set. This should be fixed in r4870. Cheers, Mike Paul Novak wrote: I have another problem after updating to SVN r4869. The ticks take the color of the plotted line without regard to the default. For example, matplotlib.rc('xtick', color='black') matplotlib.rc('ytick', color='black') plot(x, y, 'red') will give red ticks. Paul Michael Droettboom wrote: It's a bug. It's now possible for rgba colors to make their way all the way down to that level, so the code needs to truncate that to rgb (Ps can't handle alpha anyway). This is committed in SVN r4869. Cheers, Mike Paul Novak wrote: Hello, I am trying to use the PS backend to make some simple line plots, using the following script, but I get the error messages included below when I try to plot with usetex=True. I have also included the output from --verbose=helpful. I am using the current SVN, and I don't recall having this problem when using 0.91.1. Thanks, Paul --- #!/usr/bin/env python import matplotlib matplotlib.use('PS') matplotlib.rc('text', usetex = 'True') from pylab import * x = arange(0,5) y = 2 * x figure(1) plot(x, y) savefig('psfig') show() --- $HOME=/home/pnovak CONFIGDIR=/home/pnovak/.matplotlib matplotlib data path /usr/lib/python2.5/site-packages/matplotlib/mpl-data loaded rc file /home/pnovak/.matplotlib/matplotlibrc matplotlib version 0.98pre verbose.level helpful interactive is False units is False platform is linux2 numerix numpy 1.0.3.1 Using fontManager instance from /home/pnovak/.matplotlib/fontManager.cache backend PS version Level II Found dvipng version 1.5 Traceback (most recent call last): File junk.py, line 15, in module savefig('psfig') File /usr/lib/python2.5/site-packages/matplotlib/pyplot.py, line 271, in savefig return fig.savefig(*args, **kwargs) File /usr/lib/python2.5/site-packages/matplotlib/figure.py, line 854, in savefig self.canvas.print_figure(*args, **kwargs) File /usr/lib/python2.5/site-packages/matplotlib/backend_bases.py, line 1085, in print_figure **kwargs) File /usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py, line 837, in print_ps return self._print_ps(outfile, 'ps', *args, **kwargs) File /usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py, line 863, in _print_ps orientation, isLandscape, papertype) File /usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py, line 1051, in _print_figure_tex self.figure.draw(renderer) File /usr/lib/python2.5/site-packages/matplotlib/figure.py, line 698, in draw for a in self.axes: a.draw(renderer) File /usr/lib/python2.5/site-packages/matplotlib/axes.py, line 1397, in draw a.draw(renderer) File /usr/lib/python2.5/site-packages/matplotlib/axis.py, line 680, in draw tick.draw(renderer) File /usr/lib/python2.5/site-packages/matplotlib/axis.py, line 179, in draw self.label1.draw(renderer) File /usr/lib/python2.5/site-packages/matplotlib/text.py, line 761, in draw Text.draw(self, renderer) File /usr/lib/python2.5/site-packages/matplotlib/text.py, line 309, in draw self._fontproperties, angle) File /usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py, line 544, in draw_tex color = '%1.3f,%1.3f,%1.3f'% gc.get_rgb() TypeError: not all arguments converted during string formatting - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] usetex=True
Thanks. I think that's actually unrelated to your patch -- but is new since 0.91.2. Fixed in SVN r4872. Thanks for your help, Mike Paul Novak wrote: The patch for legends works except for LineCollection. For any call to legend(), I get the errors below, Paul Traceback (most recent call last): File /usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtk.py, line 331, in expose_event self._render_figure(self._pixmap, w, h) File /usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtkagg.py, line 75, in _render_figure FigureCanvasAgg.draw(self) File /usr/lib/python2.5/site-packages/matplotlib/backends/backend_agg.py, line 257, in draw self.figure.draw(self.renderer) File /usr/lib/python2.5/site-packages/matplotlib/figure.py, line 698, in draw for a in self.axes: a.draw(renderer) File /usr/lib/python2.5/site-packages/matplotlib/axes.py, line 1397, in draw a.draw(renderer) File /usr/lib/python2.5/site-packages/matplotlib/legend.py, line 206, in draw h.draw(renderer) File /usr/lib/python2.5/site-packages/matplotlib/lines.py, line 480, in draw lineFunc(renderer, gc, tpath, affine.frozen()) File /usr/lib/python2.5/site-packages/matplotlib/lines.py, line 740, in _draw_dashed renderer.draw_path(gc, path, trans) ValueError: Dash sequence must be an even length sequence; found 1 Traceback (most recent call last): File /usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtk.py, line 331, in expose_event self._render_figure(self._pixmap, w, h) File /usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtkagg.py, line 75, in _render_figure FigureCanvasAgg.draw(self) File /usr/lib/python2.5/site-packages/matplotlib/backends/backend_agg.py, line 257, in draw self.figure.draw(self.renderer) File /usr/lib/python2.5/site-packages/matplotlib/figure.py, line 698, in draw for a in self.axes: a.draw(renderer) File /usr/lib/python2.5/site-packages/matplotlib/axes.py, line 1397, in draw a.draw(renderer) File /usr/lib/python2.5/site-packages/matplotlib/legend.py, line 206, in draw h.draw(renderer) File /usr/lib/python2.5/site-packages/matplotlib/lines.py, line 480, in draw lineFunc(renderer, gc, tpath, affine.frozen()) File /usr/lib/python2.5/site-packages/matplotlib/lines.py, line 740, in _draw_dashed renderer.draw_path(gc, path, trans) ValueError: Dash sequence must be an even length sequence; found 1 Traceback (most recent call last): File /usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtk.py, line 331, in expose_event self._render_figure(self._pixmap, w, h) File /usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtkagg.py, line 75, in _render_figure FigureCanvasAgg.draw(self) File /usr/lib/python2.5/site-packages/matplotlib/backends/backend_agg.py, line 257, in draw self.figure.draw(self.renderer) File /usr/lib/python2.5/site-packages/matplotlib/figure.py, line 698, in draw for a in self.axes: a.draw(renderer) File /usr/lib/python2.5/site-packages/matplotlib/axes.py, line 1397, in draw a.draw(renderer) File /usr/lib/python2.5/site-packages/matplotlib/legend.py, line 206, in draw h.draw(renderer) File /usr/lib/python2.5/site-packages/matplotlib/lines.py, line 480, in draw lineFunc(renderer, gc, tpath, affine.frozen()) File /usr/lib/python2.5/site-packages/matplotlib/lines.py, line 740, in _draw_dashed renderer.draw_path(gc, path, trans) ValueError: Dash sequence must be an even length sequence; found 1 Michael Droettboom wrote: [I'm bringing this back to the list. Hope you don't mind.] I've been doing a lot of non-matplotlib work lately and this fell off my radar. Thanks for the reminder. The patch looks good to me. I'm not concerned about doing all this in _get_handles as opposed to Legend.__init__. I actually think it's better in _get_handles because then it's more connected to the creation of the handles themselves. (And of course _get_handles is only ever called from __init__ anyway, so it really is just an organizational extension of __init__). I moved all references to _xdata to _get_handles to be consistent. The one concern I had is that _xdata is being stored as a member variable, which implicitly assumes that it will be the same for all handles. After your patch, it can be different for each handle -- for instance a line made of markers vs. dashing. So I've just made it a local variable to _get_handles and recreate it separately for each handle. There's no reason to try to share something so small, and it just feels safer (fewer potential side effects) that way. I've committed this in r4871. Please check it out and kick the tires with all the test cases you came up with along the way and let me know how it goes. Cheers, Mike Paul
Re: [Matplotlib-users] Bug in pylab?
I'm having an enormous sense of deja vu... There was a very similar bug filed here, http://sourceforge.net/tracker/index.php?func=detailaid=1757315group_id=80706atid=560720 which I thought I had resolved in revision 4197 (which would have made it into all of the 0.91.x releases). My fix there was just to forcibly set the plot back to linear in cla() -- the idea being that if a new plot is created and hold is False, it is forcibly set back to linear (i.e. pristine state) by calling set_xscale('linear') and set_yscale('linear), which resets both the transform and the locators/formatters etc. This fix works whether you use loglog() to create the plot, or plot() followed by set_?scale(). But reading Darren's new bug report makes me wonder if my fix was correct. To be honest, I'm a little confused by the bug report, not out of any lack of clarity on Darren's part, but I think due to insufficient understanding of the problem. As assumption about the purpose of cla is that is should return the plot to a pristine state -- and in this case that means linear axes. But are you suggesting that sometimes that is not the case? Just so we're on the page, does this bug still occur post r4197 and with 0.91.x, or is this a 0.90.1 issue? Cheers, Mike Darren Dale wrote: Hi Lorenzo, On Tuesday 15 January 2008 4:14:24 pm Lorenzo Isella wrote: Dear All, I am sending this email out of frustration, but I hope that someone will be able to tell me what is going on. I am using pylab on a Debian testing box. I have the feeling that there is some problem with pylab when I alternate, as I am doing now, many linear and log-log plots. Very often, pylab complains about the fact that I cannot take the log of a negative number even if all the quantities are positive or even if I have replaced the loglog with a linear plot... An example (sorry but there are long arrays involved and I cannot reproduce all my code here): #! /usr/bin/env python import scipy as s import numpy as n import pylab as p #from rpy import r #import distance_calc as d_calc # now I try performing a least-square fitting import scipy.optimize as sopt #do my stuff here print my_n_clus_fit is, , my_n_clus_fit print my_r_sq_fit,my_r_sq_fit print n_clu_rep2 is, , n_clu_rep2 print R_sq is, R_sq p.plot(n_clu_rep2,R_sq,bo,my_n_clus_fit,my_r_sq_fit, ro) p.xlabel('particles in cluster') p.ylabel('R square') #p.legend(('beta=1e-2,100 part','beta=1e-1, 100 part', 'beta=1e-1, 200 part')) p.title('Cluster-size vs average radius of gyration') p.grid(True) p.savefig(R_gyr_vs_N_fit.pdf) p.hold(False) and the relevant part of the output is: [...] Traceback (most recent call last): File ./r_gyr.py, line 322, in ? p.plot(n_clu_rep2,R_sq,bo,my_n_clus_fit,my_r_sq_fit, ro) File /usr/lib/python2.4/site-packages/matplotlib/pylab.py, line 2028, in plot ret = gca().plot(*args, **kwargs) File /usr/lib/python2.4/site-packages/matplotlib/axes.py, line 2540, in plot self.autoscale_view(scalex=scalex, scaley=scaley) File /usr/lib/python2.4/site-packages/matplotlib/axes.py, line 1207, in autoscale_view self.set_xlim(XL) File /usr/lib/python2.4/site-packages/matplotlib/axes.py, line 1493, in set_xlim raise ValueError('Cannot set nonpositive limits with log transform') ValueError: Cannot set nonpositive limits with log transform I think this is a bug. It sounds like the same issue I reported a while back: http://www.nabble.com/Cannot-set-nonpositive-limits-with-log-transform-to12154187.html I havent had a chance to look into a solution. I filed a bug report at sourceforge (1872462). I'm worried the fix will be disruptive, but several people have run into this. I'm sorry you got bit as well. Darren - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Is Gtk draw() slow?
John Hunter wrote: On Jan 15, 2008 7:46 AM, Michael Droettboom [EMAIL PROTECTED] wrote: Ah -- just thought of something else. If I adjust simple_plot_fps.py to have 100,000 data points rather than 1,000 I see something that starts to match with what you're seeing: GtkAgg: wallclock: 4.23297405243 user: 3.33 fps: 23.6240522057 Gtk: wallclock: 15.0203828812 user: 14.92 fps: 6.65761990165 TkAgg: wallclock: 4.8252530098 user: 4.67 fps: 20.7243018754 You can see that the Gtk time is starting to explode. If I go to 1,000,000 points, Gtk runs out of memory before the first plot, whereas the other two continue to chug along at a reasonable pace. From looking at the code, I suspect the crucial difference is that the Gdk backend uses the Python sequence API (rather slow) to access the data as it gets rendered, whereas GtkAgg uses the numpy array interface which is essentially raw access to a C array. This is not likely to be the culprit -- for drawing markers, the old matplotlib API made a separate call to draw_polygon for every marker, with a new gc each time. Many moons ago, we implemented draw_markers as a renderer method to avoid this problem. For hundreds of thousands of markers, we saw performance benefits of 25x to 100x. The backends which implement draw_markers (Agg and PS) get the benefits, but the other backends which did not are still slow. Basically it is a problem with a lot of redundant function call overhead. The backend_bases renderer method _draw_markers discusses this a little bit (it is underscore hidden). Markers are not the issue here. These benchmarks were done with lines. There are markers for the ticks, of course, but the number of those are fixed. I agree it's function call overhead, but I believe it's in the overhead of PySequence_GetItem vs. array[index]. In both cases, the line is still getting drawn with a single Python - C function call. My guess is this difference will not be so pronounced on the trunk. Actually, I'm getting surprising results there. Numbers are in fps. Gtk GtkAgg 0.91.2, 1000 points 50 26 0.91.2, 1 points6 23 trunk, 1000 points 38 31 trunk, 1 points 3 9 So, yes, the ratio between Gtk and GtkAgg on the trunk is not as pronounced. I'm a little disappointed by the timings on the trunk -- while one could say that Agg is a little better on the trunk with 1000 points, it doesn't scale nearly as well. That's certainly something to look into -- and I don't have any thoughts offhand. I would expect the trunk to do better since it doesn't perform a memory copy on the data with each call to draw_line/draw_path. Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Is Gtk draw() slow?
Christopher Barker wrote: Michael Droettboom wrote: It's sort of a pygtk issue -- it would have to be rewritten to take numpy arrays not quite -- it would have to be re-written to use the array interface, which is different, as that can be done without requiring numpy, or its headers. Of course, that's what I meant. It is passed numpy arrays now -- but they are accessed with all of the function call overhead of the Python sequence API, rather than the numpy array interface. which is probably unlikely to happen in the official codebase. That was true before the array interface, when supporting arrays essentially meant a dependency on numpy. That's not longer true, so it's quite likely that the pygtk folks would accept a patch -- someone still would need to write that patch, though! Unless I misunderstand, I thought that functionality was slated for inclusion in Python 3.0 -- still a long ways off in terms of adoption rate. That patch would only make sense on a pygtk branch specifically intended for Python 3.0. Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] multiline math text
The subject line intrigues me, and hopefully I can help. For whatever reason, the body of your message didn't make it to the mailing list. Can you please resend? Cheers, Mike BL wrote: - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] TrueType font embedding in eps problem.
There was a change between 0.90 to 0.91 as to how the TrueType to Type 42 (which is essentially a thin wrapper around a TrueType font) conversion is done. In 0.90 it was done in Python -- in 0.91 when font subsetting was added, this conversion is done in some borrowed C code called ttconv. That's just a guess as to what may be the specific cause. I don't have a copy of Illustrator, so I haven't done any testing with that. I'm happy to hear of a positive report from Rob. Perhaps you both (Rob and Jordan) are using different versions of Illustrator? Note that ps.useafm essentially overrides the ps.fonttype setting. If ps.useafm is True, you will always only get one of the 14 builtin Postscript fonts, which are not embedded in the file because all Postscript interpreters are required to support them. If ps.useafm is False, then the other setting kicks in. Type 42 essentially includes the whole Truetype font somewhat verbatim in the Ps file. Type 3 will include only the used characters, using a format that is more native to Postscript. All of them *should* be able to be editable on a purely theoretical level, though I would imagine Type 3 to be broken if you try to add a character that wasn't embedded in the file. (This is different from how matplotlib does SVG font embedding where the original text really is lost). But I don't really know what Illustrator's abilities and limitations are in that regard. Hopefully Rob's suggestions will work for you. Otherwise, I may want to revisit pulling the old Type 42 code back out of SVN to see if that solves your problem. A good place to start might be if you could send me (off list) two eps files of the same plot -- one created with 0.90.1, and one with 0.91.2. Cheers, Mike Rob Hetland wrote: There have been quite a few changes to fonts in MPL since 8.x. Perhaps one of the biggest is mathtext. Real unicode fonts with mathematics. Since you do what I do, sort of, I am guessing that you might be happy with the same configuration I use. I looks great, and can be edited in Illustrator (et al.). I really like Arev Sans, but others like the new STIX fonts. This setup is for Arev Sans. The important stuff is what begins with mathtext. If you want serif fonts, this should be enough to get you started on customizing. Just make sure whatever fontset you pick has all of the math symbols built in, or change fallback_to_cm to True. -Rob font.family : sans-serif font.style : normal font.variant: normal font.weight : medium font.stretch: normal font.size : 12.0 font.serif : STIX, Bitstream Vera Serif, New Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif font.sans-serif : Arev Sans font.cursive: Zapfino, Apple Chancery, Textile, Sand, cursive font.fantasy: Chicago, Comic Sans MS, Charcoal, Impact, Western, fantasy font.monospace : Bitstream Vera Sans Mono, Andale Mono, Nimbus Mono L, Courier New, Courier, Fixed, Terminal, monospace text.color : black text.usetex : False text.dvipnghack : True mathtext.fallback_to_cm : False mathtext.fontset : custom mathtext.cal : Arev Sans:oblique mathtext.it : Arev Sans:oblique mathtext.rm : Arev Sans mathtext.bf : Arev Sans:bold mathtext.sf : Arev Sans pdf.fonttype : 42 On Jan 16, 2008, at 10:13 PM, Jordan Dawe wrote: Setting ps.useafm = True while ps.fonttype = 42 allows illustrator to open the eps files again and gives me back text editing capability, but I don't have any control over the typeface anymore, it just defaults to Helvetica. Jordan -- --- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users Rob Hetland, Associate Professor Dept. of Oceanography, Texas AM University http://pong.tamu.edu/~rob phone: 979-458-0096, fax: 979-845-6331 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA
Re: [Matplotlib-users] Bug in pylab?
Darren Dale wrote: On Wednesday 16 January 2008 08:22:45 am Michael Droettboom wrote: But reading Darren's new bug report makes me wonder if my fix was correct. To be honest, I'm a little confused by the bug report, not out of any lack of clarity on Darren's part, but I think due to insufficient understanding of the problem. As assumption about the purpose of cla is that is should return the plot to a pristine state -- and in this case that means linear axes. But are you suggesting that sometimes that is not the case? If you have hold=True, and the x or y scale is log, repeated calls to plot() will add new lines to the plot without changing the scaling. If hold is instead False, one might reasonably expect that future calls to plot would replace the old line with the new one, again without changing the scaling. That would be consistent. Instead, the scaling changes. That indeed is a problem. I suspect it has something to do with the extra step that log scales do to round to the nearest decade. I can have a look when I get a chance, or let me know if you'd like to tackle it, Darren. Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] multiline mlath text
There is no way to insert newlines in the mathtext part of the string (by that I mean between the '$'). However, you can put newline characters outside of '$'. It gets a bit hairy because of Python's string escaping rules, but you could do something like: $\\alpha=%G$\n$\\beta=%G$ Note the double \\ where we really want a backslash, since we can't use raw string literals and write a newline character. One other caveat: The spacing of the lines doesn't take into account the height of the math expression, so you can really only do simple one-liners (i.e. no fractions or exponents) in the math expression. Your example looks like it will work though. This is really sort of unsupported and my example works only by accident... it's something I didn't think about while re-writing mathtext recently. Hopefully this can be improved in a future version -- I can see it as being generally useful. Also -- for others on the list: Is there a TeX or LaTeX standard for putting newlines in the middle of a math expression that perhaps we should support? All the Googling I've been able to do basically assumes that layout such as that would occur in a layer outside of the math expression (with the exception of typesetting things like matrices). Cheers, Mike BL wrote: Hi, I want to display the values of some variable (namely, alpha, beta, gamma, delta) on a plot, and making a legend like $ \alpha=%G, \ \bet=%G, \ \gamma=%G, \ \delta=%G $ % values is not very readable. Is there away to make multiline mathtext ? thanks BL - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Cross hair and polygon drawing tools.
John Hunter wrote: On Jan 4, 2008 4:33 PM, Mephisto [EMAIL PROTECTED] wrote: For some simple but effective Python code you can use to create a mask similar to that provided by the Matlab roipoly function, see http://www.ariel.com.au/a/python-point-int-poly.html http://www.ariel.com.au/a/python-point-int-poly.html . The code seems to be quite effective. matplotlib implements these algorithms in C -- see matplotlib.nxutils.pnpoly for a testing inclusion of a single point, and matplotlib.nxutils.points_inside_poly for testing multiple points. There is some example code using the latter function at http://matplotlib.sf.net/examples/lasso_demo.py. Not sure why this example is not working for Venkat. This is probably not the reason for Venkat (I think he said he was using 0.87)... but lasso_demo.py is currently broken on the trunk, and working for me in 0.91.2. I'm looking into it. Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] formatting axis to percent notation
John Hunter wrote: On Jan 16, 2008 1:03 PM, Kevin Christman [EMAIL PROTECTED] wrote: def myfunc(x, pos=0): return '%1.2f''%(100*x) And you may want to try: def myfunc(x, pos=0): return '%1.2f%%''%(100*x) to get a percent sign after each value. (I mention it only because the double percent trick is non-obvious to many newcomers to Python's string formatting syntax.) Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Is Gtk draw() slow?
All very helpful information. Thanks. This is probably something to move to the pygtk list. Personally, I don't consider it a high priority since the Gdk backend is limited in a number of other ways. Maybe someone more motivated (who uses X remotely, for instance) wants to take the charge. It would probably benefit more than just mpl. Cheers, Mike - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] TrueType font embedding in eps problem.
I suspect an explicit conversion to str may be required on your configuration/platform. (I think you mentioned you were using Windows). Can you change line 592 of mathtext.py to read: font = FT2Font(str(basename)) and let me know if that fixes your problem? If so, I'll commit this to SVN. Note that you may also have problems if there are any non-ascii characters (with accents etc.) anywhere in the path to mpl's fonts. In general mpl doesn't really handle Unicode paths correctly wherever C/C++ code is involved. Hopefully that can be resolved in a future version. Cheers, Mike Jordan Dawe wrote: Rob Hetland wrote: I really like Arev Sans, but others like the new STIX fonts. This setup is for Arev Sans. The important stuff is what begins with mathtext. If you want serif fonts, this should be enough to get you started on customizing. Just make sure whatever fontset you pick has all of the math symbols built in, or change fallback_to_cm to True. When I converted my matplotlibrc to the settings you listed, the result was pages and pages of exception tracebacks ending in: C:\Python25\Lib\site-packages\matplotlib\mathtext.py in _get_font(self, font) 590 cached_font = self._fonts.get(basename) 591 if cached_font is None: -- 592font = FT2Font(basename) 593cached_font = self.CachedFont(font) 594self._fonts[basename] = cached_font If I remove all the LaTeX from my expressions, this error goes away. Jordan TypeError: cannot return std::string from Unicode object - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] help?
What version of matplotlib are you using? Unfortunately, I think this is a known issue in 0.90.1 that manifests itself most severely on Windows. If you still see it with 0.91.2, let us know and I'll probably want some more information from you. Cheers, Mike Jack Sankey wrote: Hello, I wrote a script that loops over some files, plotting them individually with imshow(). In between each file, the program waits for user input and then clears/closes the current figure before making a new one. Roughly 5-10 files into the loop, the script dies, outputting a loop of stuff like this until I close the figure: File C:\Python25\Lib\site-packages\matplotlib\pyplot.py, line 201, in gcf File C:\Python25\Lib\site-packages\matplotlib\pyplot.py, line 187, in figure File C:\Python25\Lib\site-packages\matplotlib\backends\backend_wxagg.py, line 120, in new_figure_manager File C:\Python25\Lib\site-packages\matplotlib\backends\backend_wx.py, line 1302, in __init__ File C:\Python25\Lib\site-packages\matplotlib\backends\backend_wxagg.py, line 39, in _get_toolbar File C:\Python25\Lib\site-packages\matplotlib\backends\backend_wx.py, line 1593, in __init__ File C:\Python25\Lib\site-packages\matplotlib\backend_bases.py, line 1391, in __init__ File C:\Python25\Lib\site-packages\matplotlib\backends\backend_wx.py, line 1615, in _init_toolbar File C:\Python25\Lib\site-packages\matplotlib\backends\backend_wx.py, line 1452, in _load_bitmap File C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_gdi.py, line 530, in __init__ PyAssertionError: C++ assertion IsOpened() failed at ..\..\src\common\ffile.cpp(187) in wxFFile::Seek(): can't seek on closed file Alternatively, it occasionally will tell me there are too many files open. I have checked and all my file operations include a close(). Any thoughts? I am using wxpython and wxAgg as my backend, with pycrust (pyshell) on windows XP. Thanks, Jack - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Cross hair and polygon drawing tools.
It looks as if poly_editor is broken in 0.91.2 and the trunk. Is that your observation as well? This has been fixed in SVN (on both the trunk and the 0.91.x branch). On both versions, the line (that makes up the draggable markers) was never added to the axes, so it doesn't get a transform, and all the markers are drawn in the lower left. For the trunk, there were a couple updates to use the new transforms methods. Also, numpy arrays (which are now used for the polygon data) do not support insertion, so the call to insert had to be rewritten as creating a new array. See r4878 (trunk) and r4879 (0.91.x maintenance). Cheers, Mike Rob Hetland wrote: I do this sort of stuff all of the time. I have a tool that is interactive, making a polygon that you can edit (similar to poly_editor in the examples), that is linked to the polygeom class below, but it is broken in the new transforms release of the code. poly_editor is also broken, by the way. You can't insert a point anymore. For now, you can use these simpler tools: Good luck, -Rob On Dec 6, 2007, at 8:39 PM, Venkat Ramanan wrote: Hi, I'm looking for something analogous to Matlab's ginput() and roipoly(). ginput() basically displays a crosshair on the current figure and allows us to select points by clicking on it. It returns the x,y coordinates of the points. roipoly() allows us to define a polygon by clicking on the figure and returns a logical matrix, where ones represent the insides of the polygon and zeros outside. Any pointers are appreciated. I recently found matplotlib and started porting some of my Matlab scripts to it. Ubuntu feisty (7.04), matplotlib 0.87.7. I can upgrade though. Thanks, Venkat. - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users Rob Hetland, Associate Professor Dept. of Oceanography, Texas AM University http://pong.tamu.edu/~rob phone: 979-458-0096, fax: 979-845-6331 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Cross hair and polygon drawing tools.
Rob Hetland wrote: On Jan 18, 2008, at 7:00 PM, Michael Droettboom wrote: It looks as if poly_editor is broken in 0.91.2 and the trunk. Is that your observation as well? Yes. This has been fixed in SVN (on both the trunk and the 0.91.x branch). On both versions, the line (that makes up the draggable markers) was never added to the axes, so it doesn't get a transform, and all the markers are drawn in the lower left. For the trunk, there were a couple updates to use the new transforms methods. Also, numpy arrays (which are now used for the polygon data) do not support insertion, so the call to insert had to be rewritten as creating a new array. Yes, I think this is part of the problem, but have not had the time to dig into it yet. But your description of the problem matches the error messages I was getting. Also, I find this such a useful tool, I wonder if it would be worthwhile putting it somewhere in the matplotlib tree explicitly? Even better as a class that could be subclassed.. I think that would be worthwhile just to avoid (well, reduce) these problems when interface changes occur in the future. Since you were forced to copy-and-paste poly_editor as a starting point, rather than inheriting from it, there's little you can do to move forward now other than to manually update your own code. I'm not opposed to the idea, but maybe we should take a survey of how it's being used now to make sure whatever it ends up looking like is sufficient. Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Cross hair and polygon drawing tools.
lasso_demo.py is working again on the trunk. The problem was not transforms related. The problem is in the way the colors were being updated after the markers were selected. On the trunk, the set of facecolors in a collection is stored as a numpy array for efficiency. This meant that the facecolor Python list that lasso_demo.py was updating was no longer the same object as the facecolor Numpy array that was actually used for drawing. I added a get_facecolors() method to Collection, and that is now used to update the colors in the collection. See r4877 for a set of changes. http://matplotlib.svn.sourceforge.net/viewvc/matplotlib?view=revrevision=4877 Cheers, Mike Michael Droettboom wrote: John Hunter wrote: On Jan 4, 2008 4:33 PM, Mephisto [EMAIL PROTECTED] wrote: For some simple but effective Python code you can use to create a mask similar to that provided by the Matlab roipoly function, see http://www.ariel.com.au/a/python-point-int-poly.html http://www.ariel.com.au/a/python-point-int-poly.html . The code seems to be quite effective. matplotlib implements these algorithms in C -- see matplotlib.nxutils.pnpoly for a testing inclusion of a single point, and matplotlib.nxutils.points_inside_poly for testing multiple points. There is some example code using the latter function at http://matplotlib.sf.net/examples/lasso_demo.py. Not sure why this example is not working for Venkat. This is probably not the reason for Venkat (I think he said he was using 0.87)... but lasso_demo.py is currently broken on the trunk, and working for me in 0.91.2. I'm looking into it. Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] TrueType font embedding in eps problem.
Jordan Dawe wrote: Michael Droettboom wrote: This is going to be a tricky one, particularly since I don't have access to Illustrator. All I know is the eps and pdf output of simple_plot.py looks fine for me in ghostscript, acroread, xpdf and evince. Even text select copy and paste works fine in acroread (with both Type 3 and 42 fonts). So my guess is that unfortunately Illustrator is not fully covering the spec, and we've inadvertently moved to using a feature it doesn't like. Just to be clear: Type 3 font output opens fine in illustrator for both pdf and eps output. Type 42 pdf output opens in illustrator but eps gives an error. The type 42 eps output opens fine for me in ghostscript and in Scribus for windows (which probaby is just using gs anyways...?) Illustrator definitely looks like the picky one here, but it seems strange to me... isn't eps Adobe's format? Sure, but these formats are complex enough I'm not terribly surprised there's problems. I'm not necessarily blaming Illustrator here, either. Now if this really did work in Illustrator in 0.90.x and not now, one could start to compare the output by hand and see what the root cause may be. If you set pdf.compression to 0, the Pdf file becomes vaguely readable, and tools such as diff can help to locate differences. I would take the output of 0.90.1 and 0.91.2 and compare (the SVN trunk will be too different to be useful), and then start moving things over piece by piece until it works again. I'm afraid that without Illustrator, it will be hard for me to do that. It was definitely working in illustrator before, and isn't working now. If there's anything I can do to help, please let me know. Want a type 42 and type 3 version of my eps output? Maybe it makes sense to work on what causes errors first, and worry about the editing problems second. So, that would probably mean comparing eps with Type 42 from mpl 0.90.1 and 0.91.2. I'll try and get these going and might ask you to try some hacked up files in Illustrator for me as I try to narrow down the real cause. Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Using non ascii characters
This probably depends on the backend you are using. Which backend and on which platform are you having trouble with? 0.90.1 had a number of Unicode and non-ascii problems that 0.91.2 resolves. You may want to try that. Failing that, can you attach a small script that exhibits the problem? There may be all kinds of things going wrong, from the encoding of the source file, to an incorrect font etc. and an example would help us narrow it down. Cheers, Mike BL wrote: Hi, I would like to use non ascii characters in title and label but with my current intallation it does not work properly. There's no warning or error messages when I set a title with some non ascii characters (I use iso-88599-1 characters, like é or à), but I get a empty square instead of theses characters in the figure. I'm using matplotlib-0.90.1. Is there anything to configure to handle non ascii characters ? Regards, -- BL - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] build matplotlib including backend wxPython
/core/include/numpy/__multiarray_api.h:943: warning: 'int _import_array()' defined but not used cc1plus: warning: command line option -Wstrict-prototypes is valid for Ada/C/ObjC but not for C++ In file included from /usr/include/python2.4/Python.h:8, from ./CXX/WrapPython.h:47, from ./CXX/Extensions.hxx:48, from src/_backend_agg.h:8, from src/_wxagg.cpp:48: /usr/include/python2.4/pyconfig.h:851:1: warning: _POSIX_C_SOURCE redefined In file included from /usr/include/string.h:26, from /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/cstring:52, from src/_wxagg.cpp:38: /usr/include/features.h:150:1: warning: this is the location of the previous definition src/_wxagg.cpp:55:34: error: wx/wxPython/wxPython.h: No such file or directory src/_wxagg.cpp: In member function 'Py::Object _wxagg_module::convert_agg_to_wx_image(const Py::Tuple)': src/_wxagg.cpp:103: error: 'wxPyConstructObject' was not declared in this scope src/_wxagg.cpp: In member function 'Py::Object _wxagg_module::convert_agg_to_wx_bitmap(const Py::Tuple)': src/_wxagg.cpp:125: error: 'wxPyConstructObject' was not declared in this scope src/_wxagg.cpp: In function 'void init_wxagg()': src/_wxagg.cpp:253: error: 'wxPyCoreAPI_IMPORT' was not declared in this scope /var/lib/python-support/python2.4/numpy/core/include/numpy/__multiarray_api.h: At global scope: /var/lib/python-support/python2.4/numpy/core/include/numpy/__multiarray_api.h:943: warning: 'int _import_array()' defined but not used error: Command gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O2 -Wall -Wstrict-prototypes -fPIC -DGTK_NO_CHECK_CASTS -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D_LARGEFILE_SOURCE=1 -DNO_GCC_PRAGMA -I/usr/include/libpng12 -I/usr/local/include -I/usr/include -I. -I/var/lib/python-support/python2.4/numpy/core/include -Isrc -Iagg24/include -I. -I/usr/include/freetype2 -I/usr/local/include -I/usr/include -I. -I/usr/lib/wx/include/gtk2-unicode-release-2.6 -I/usr/include/wx-2.6 -I/usr/include/python2.4 -c src/_wxagg.cpp -o build/temp.linux-i686-2.4/src/_wxagg.o failed with exit status 1 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plotting a series of 3D points and, picker=True and 3D
The axes3d stuff is not currently working on the SVN trunk. You probably want to use 0.91.2 or the v0_91_maint branch in SVN instead. Cheers, Mike Johann Cohen-Tanugi wrote: hello, thanks for answering. I actually fail with the import : In [1]: from matplotlib import axes3d --- ImportError Traceback (most recent call last) /home/cohen/bstw/ipython console in module() /usr/lib/python2.5/site-packages/matplotlib/axes3d.py in module() 14 from axes import Axes 15 import cbook --- 16 from transforms import unit_bbox 17 18 import numpy as npy ImportError: cannot import name unit_bbox any idea? -- Message: 1 Date: Sun, 27 Jan 2008 22:18:00 + From: Neil Crighton [EMAIL PROTECTED] Subject: Re: [Matplotlib-users] plotting a series of 3D points and picker=True and 3D To: matplotlib-users@lists.sourceforge.net Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=ISO-8859-1 I think scatter3D does what you want: from matplotlib import axes3d import pylab as pl fig = pl.figure() ax = axes3d.Axes3D(fig) ax.scatter3D(data[:,0],data[:,1],data[:,2]) ax.set_xlabel('X value') ax.set_ylabel('Y value') ax.set_zlabel('Z value') pl.show() You could also change the colour and size of each point based on other array values: col = ax.scatter3D(data[:,0], data[:,1], data[:,2], c=data[:,3], cmap=pl.cm.jet, s=data[:,4]) cbar = fig.colorbar(col,shrink=0.9,extend='both') cbar.ax.set_ylabel('axis 3 data values') Pretty nifty. Neil - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] stix fonts don't work with ghostscript
Bernhard Voigt wrote: I've been trying to use the STIXGeneral font that comes with matplotlib (my version is 0.91.1). It's rendered ok on the screen, however, when saving the fig as an eps file my postscript processor (ghostscript) can't read the font information included in the eps file (ps.fonttype 42 in config file). I can reproduce that problem here. As a workaround, however, ps.fonttype 3 seems to work for me, plus has the advantage of a much smaller eps file. I wonder if it's a bug in the conversion to ttf, that has been applied to the STIX font. Possibly. It could also be a buffer overflow, since that font is on the large side. I'll have to look into that. Saving to pdf format works, but the ticklabels are not rendered correctly, there's too much space between the glyphs and they are overlapping with the axes. The title looks good, though. The PDF from mathtext_demo.py looks fine to me. Can you send a short plot that exhibits this behavior? Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Error importing matplotlib.font_manager
It also may be of interest which version of freetype you have installed. Michael Droettboom wrote: Another user reported this bug, which I still have been unable to reproduce -- http://sourceforge.net/mailarchive/message.php?msg_id=4794E454.4070700%40bostream.nu Jorgen tracked it down to a specific font on his system that he was able to delete and then things worked. Unfortunately, when I tried the same font on my system, I could not reproduce the error. Perhaps this issue has to do with the *number* of fonts. Do you have an unusually large amount of fonts? Cheers, Mike Tiago de Paula Peixoto wrote: Hi there. I'm encountering the following error when importing matplotlib.font_manager: $ python Python 2.5.1 (r251:54863, Jan 7 2008, 22:53:42) [GCC 4.2.2 (Gentoo 4.2.2 p1.0)] on linux2 Type help, copyright, credits or license for more information. import matplotlib.font_manager python: CXX/cxx_extensions.cxx:1128: virtual Py::PythonExtensionBase::~PythonExtensionBase(): Assertion `ob_refcnt == 0' failed. Aborted I wasn't able to figure out where the problem might be. Could anybody help? My (gentoo) system is the following: matplotlib 0.91.2 python 2.5.1 GCC 4.2.2 Cheers, Tiago -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Error importing matplotlib.font_manager
Another user reported this bug, which I still have been unable to reproduce -- http://sourceforge.net/mailarchive/message.php?msg_id=4794E454.4070700%40bostream.nu Jorgen tracked it down to a specific font on his system that he was able to delete and then things worked. Unfortunately, when I tried the same font on my system, I could not reproduce the error. Perhaps this issue has to do with the *number* of fonts. Do you have an unusually large amount of fonts? Cheers, Mike Tiago de Paula Peixoto wrote: Hi there. I'm encountering the following error when importing matplotlib.font_manager: $ python Python 2.5.1 (r251:54863, Jan 7 2008, 22:53:42) [GCC 4.2.2 (Gentoo 4.2.2 p1.0)] on linux2 Type help, copyright, credits or license for more information. import matplotlib.font_manager python: CXX/cxx_extensions.cxx:1128: virtual Py::PythonExtensionBase::~PythonExtensionBase(): Assertion `ob_refcnt == 0' failed. Aborted I wasn't able to figure out where the problem might be. Could anybody help? My (gentoo) system is the following: matplotlib 0.91.2 python 2.5.1 GCC 4.2.2 Cheers, Tiago -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Error importing matplotlib.font_manager
I'll also give a blanket answer to these sorts of gremlins: Remove the build directory in the source tree Remove site-packages/matplotlib (usually in /usr/lib/python2.5/site-packages) Rebuild everything Cheers, Mike Michael Droettboom wrote: It also may be of interest which version of freetype you have installed. Michael Droettboom wrote: Another user reported this bug, which I still have been unable to reproduce -- http://sourceforge.net/mailarchive/message.php?msg_id=4794E454.4070700%40bostream.nu Jorgen tracked it down to a specific font on his system that he was able to delete and then things worked. Unfortunately, when I tried the same font on my system, I could not reproduce the error. Perhaps this issue has to do with the *number* of fonts. Do you have an unusually large amount of fonts? Cheers, Mike Tiago de Paula Peixoto wrote: Hi there. I'm encountering the following error when importing matplotlib.font_manager: $ python Python 2.5.1 (r251:54863, Jan 7 2008, 22:53:42) [GCC 4.2.2 (Gentoo 4.2.2 p1.0)] on linux2 Type help, copyright, credits or license for more information. import matplotlib.font_manager python: CXX/cxx_extensions.cxx:1128: virtual Py::PythonExtensionBase::~PythonExtensionBase(): Assertion `ob_refcnt == 0' failed. Aborted I wasn't able to figure out where the problem might be. Could anybody help? My (gentoo) system is the following: matplotlib 0.91.2 python 2.5.1 GCC 4.2.2 Cheers, Tiago -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Error importing matplotlib.font_manager
More information: this problem reared its ugly head way back in 2005 and the same font (orlando.ttf) was the culprit then! ;) http://sourceforge.net/mailarchive/message.php?msg_id=42E69B61.4060008%40caltech.edu Also, is it possible you have PyCXX installed in a system-wide location, such as /usr/include/CXX or /usr/include/python2.5/CXX ? If so, the compiler might be included those headers, but building with the matplotlib-included ones, causing all kinds of craziness. Try uninstalling pycxx and rebuilding matplotlib and see if that solves things. Cheers, Mike Michael Droettboom wrote: I'll also give a blanket answer to these sorts of gremlins: Remove the build directory in the source tree Remove site-packages/matplotlib (usually in /usr/lib/python2.5/site-packages) Rebuild everything Cheers, Mike Michael Droettboom wrote: It also may be of interest which version of freetype you have installed. Michael Droettboom wrote: Another user reported this bug, which I still have been unable to reproduce -- http://sourceforge.net/mailarchive/message.php?msg_id=4794E454.4070700%40bostream.nu Jorgen tracked it down to a specific font on his system that he was able to delete and then things worked. Unfortunately, when I tried the same font on my system, I could not reproduce the error. Perhaps this issue has to do with the *number* of fonts. Do you have an unusually large amount of fonts? Cheers, Mike Tiago de Paula Peixoto wrote: Hi there. I'm encountering the following error when importing matplotlib.font_manager: $ python Python 2.5.1 (r251:54863, Jan 7 2008, 22:53:42) [GCC 4.2.2 (Gentoo 4.2.2 p1.0)] on linux2 Type help, copyright, credits or license for more information. import matplotlib.font_manager python: CXX/cxx_extensions.cxx:1128: virtual Py::PythonExtensionBase::~PythonExtensionBase(): Assertion `ob_refcnt == 0' failed. Aborted I wasn't able to figure out where the problem might be. Could anybody help? My (gentoo) system is the following: matplotlib 0.91.2 python 2.5.1 GCC 4.2.2 Cheers, Tiago -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] stix fonts don't work with ghostscript
Bernhard Voigt wrote: Hi Michael, attatched is my matplotlibrc file. The plot was from some data, but i principle it was crated like that: import pylab as p import numpy as n p.hist(-1 * n.log10(n.random.uniform(size=1)), 40) p.xlabel('$\mathrm{log_{10}(E/GeV)}$') p.ylabel('counts') p.title('energy spectrum') p.savefig('foo.pdf') p.savefig('foo.eps') I can report that the rendering of the pdf file is correct, when I set the pdf.fonttype to 3. Than everything looks good :-) Well, I was able to fix the spacing problem with PDF+Type42. That has now been fixed in SVN r4915 (and on the maintenance branch). It's a simple patch that I'll forward to you. At home, using another gs version (8.15.0, instead of 8.15.2) also the eps is ok with ps.fonttype 3, though the one with fonttype 42 is still erroneous. It's always fun when an external dependency breaks something... ;) I only have the fairly old gs 7.07, and it seems to always work with type 3, and sometimes break with type 42. Can you do me a favor to save me the trouble of having to install a bunch of versions of ghostscript? Can you send me an eps of the same plot produced through gs 8.15.0 and 8.15.2? I hope that by examining the differences there will be some clue as to the breakage. Thanks, Mike Thanks! Bernhard On Jan 31, 2008 4:45 PM, Michael Droettboom [EMAIL PROTECTED] wrote: Can you send the source of your plot, and also your matplotlibrc file? Bernhard Voigt wrote: -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Possible memory-leak while plotting in a loop
Aaron Botnick wrote: I'm using MPL to plot a 6 panel figure of 2d data using pcolormesh. I started this script last night, and found it consuming over 3GB of memory when I got in this morning. Another one... ;) After reading through old posts to this list, I came across this suggestion: http://sourceforge.net/mailarchive/forum.php?thread_name=47558A63.8050307%40cornell.eduforum_name=matplotlib-users ...to use gc.collect(), unfortunately this does not solve my problem...after implementing it, my script is now at nearly 800MB within 15 minutes of running. I am looping this over several thousand data files. I am using MPL - 0.92.2, I assume you mean 0.91.2? numpy - 1.0.1, and the Agg backend, and running in non-interactive mode on a Fedora Linux box with Python 2.4. MPL and numpy were installed from source rather than the distribution. Following the suggestion to track down memory-leaks, the cbook.print_cycles(gc.garbage) call returns None at every iteration of the loop. That function doesn't return anything -- it prints to the console. Is it producing any console output? However, using the comparison of original objects ( gc.get_objects() ) to new objects created after the first loop iteration, there are a lot of new objects present. Do you know what type those objects are? I've included a copy of the script in an attachment (slicer.py). Would it be possible to get a revised version of the script that doesn't require the data files, i.e. just random data that closely resembles what's in the files, and reduced to the bare minimum that reproduces the leak? I could hack at it myself for a while, but if I can't reproduce the leak, I wouldn't know if it's because I removed something critical or the leak is somehow platform-dependent. Cheers, Mike Any help would be great, thanks! -- Aaron Botnick - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Possible memory-leak while plotting in a loop
Also, if you're adventurous, try installing valgrind and running: valgrind --tool=massif python slicer.py valgrind --tool=memcheck --leak-check=yes --log-file=slicer_leak python slicer.py and send me the output -- (probably off list because they will be large files). Cheers, Mike Aaron Botnick wrote: Hi all, I'm using MPL to plot a 6 panel figure of 2d data using pcolormesh. I started this script last night, and found it consuming over 3GB of memory when I got in this morning. After reading through old posts to this list, I came across this suggestion: http://sourceforge.net/mailarchive/forum.php?thread_name=47558A63.8050307%40cornell.eduforum_name=matplotlib-users http://sourceforge.net/mailarchive/forum.php?thread_name=47558A63.8050307%40cornell.eduforum_name=matplotlib-users ...to use gc.collect(), unfortunately this does not solve my problem...after implementing it, my script is now at nearly 800MB within 15 minutes of running. I am looping this over several thousand data files. I am using MPL - 0.92.2, numpy - 1.0.1, and the Agg backend, and running in non-interactive mode on a Fedora Linux box with Python 2.4. MPL and numpy were installed from source rather than the distribution. Following the suggestion to track down memory-leaks, the cbook.print_cycles(gc.garbage) call returns None at every iteration of the loop. However, using the comparison of original objects ( gc.get_objects() ) to new objects created after the first loop iteration, there are a lot of new objects present. I've included a copy of the script in an attachment (slicer.py). Any help would be great, thanks! -- Aaron Botnick - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Exporting accents in EPS
Unicode in Python is tricky. It is explained in gory detail here: http://www.amk.ca/python/howto/unicode But to save you the trouble of reading the whole thing, unless you're an i18n geek like me, here's my list of recommendations to (somewhat) reliably get non-ASCII characters to work in Python. There are other ways, (and people tend to have their own opinions about this, mostly based on the capabilities of their editors). 1. Non-ASCII means any codepoint that is greater than 127. Your local encoding may have characters with accents in the range 128-255, but that is *not* ASCII. 2. Always use Unicode literals for anything that contains non-ASCII characters (by prefixing the literal with a 'u'). It is never a good idea to put non-ASCII characters in a regular 8-bit Python string -- they do not remember their encoding, and the application has no way to know how to interpret it. 3. Always declare an encoding at the top of the file, e.g.: # -*- coding: utf-8 -*- (I like utf-8 for generality, but you could use any of the encodings that Python understands, see here: http://docs.python.org/lib/standard-encodings.html) 4. Make sure your editor is correctly saving the file in that specified encoding. This is perhaps the hardest step because editors all handle it a little differently. Some editors have an option somewhere to set the encoding that files are saved in. Others may automatically understand the coding comment line in the file. (Same goes for any terminal emulator you may be using for interactive plotting.) If you can't get step 4 to work successfully, you can write Unicode strings in Python using only ASCII characters using the \u escape sequence. uFlamb\u00e9e (Here, the Unicode code point for e with accent-aigu is 00E9). So, following all of the above, the attached works fine for me with .eps output on 0.91.2. (There were various Unicode issues in 0.90.x that were fixed.) If it still doesn't work for you, please let us know. Cheers, Mike Matthieu Brucher wrote: No problem with the png backend. I tried with Latex for the accent, but it didn't work : Traceback (most recent call last): File input, line 1, in module File /home/brucher/local//lib/python2.5/site-packages/matplotlib/pyplot.py, line 265, in draw get_current_fig_manager().canvas.draw() File /home/brucher/local//lib/python2.5/site-packages/matplotlib/backends/backend_wx.py, line 953, in draw self.figure.draw(self.renderer) File /home/brucher/local//lib/python2.5/site-packages/matplotlib/figure.py, line 612, in draw for a in self.axes: a.draw(renderer) File /home/brucher/local//lib/python2.5/site-packages/matplotlib/axes.py, line 1342, in draw a.draw(renderer) File /home/brucher/local//lib/python2.5/site-packages/matplotlib/axis.py, line 593, in draw tick.draw(renderer) File /home/brucher/local//lib/python2.5/site-packages/matplotlib/axis.py, line 170, in draw if self.label1On: self.label1.draw(renderer) File /home/brucher/local//lib/python2.5/site-packages/matplotlib/text.py, line 775, in draw Text.draw(self, renderer) File /home/brucher/local//lib/python2.5/site-packages/matplotlib/text.py, line 327, in draw self._fontproperties, angle) File /home/brucher/local//lib/python2.5/site-packages/matplotlib/backend_bases.py, line 383, in draw_tex raise NotImplementedError I just did : import pylab as pl pl.plot([1, 2, 3], [1, 2, 3]) pl.xlabel('éè') pl.show() and the ps file is corrupted :( Matthieu 2008/2/1, Michael Droettboom [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]: Can you provide an example of your code? Often, it is a matter of configuring/using Python correctly to indicate accents. Is the problem only with EPS or other backends as well? Cheers, Mike Matthieu Brucher wrote: Hi, I'm trying to export a MAtplotlib figure which has some axes labels, such as 'coût'. The problème is that the generated eps is corrupted because of these accents. Is there a way to generate an acceptable eps file ? Matthieu -- French PhD student Website : http://matthieu-brucher.developpez.com/ Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92 LinkedIn : http://www.linkedin.com/in/matthieubrucher - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users
Re: [Matplotlib-users] Exporting accents in EPS
Can you provide an example of your code? Often, it is a matter of configuring/using Python correctly to indicate accents. Is the problem only with EPS or other backends as well? Cheers, Mike Matthieu Brucher wrote: Hi, I'm trying to export a MAtplotlib figure which has some axes labels, such as 'coût'. The problème is that the generated eps is corrupted because of these accents. Is there a way to generate an acceptable eps file ? Matthieu -- French PhD student Website : http://matthieu-brucher.developpez.com/ Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92 LinkedIn : http://www.linkedin.com/in/matthieubrucher - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] STIX fonts outside of mathtext
In your matplotlibrc file, you can set the following: font.family : serif font.serif : STIXGeneral Also note the numerals and Latin characters are extremely similar if not identical to Times (or Times New Roman), so you could also use that for titles/labels etc., but it doesn't really matter. Cheers, Mike John Travers wrote: Hello, I'm very pleased with the STIX fonts support in mathtext. Thanks for getting this working! However, I would like to use the same font in labels which do not contain mathtext, for consistency. I cannot work out how to do this. Can anyone help with this? Thanks, John - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] STIX fonts outside of mathtext
John Travers wrote: On Mon, Feb 04, 2008 at 08:22:57AM -0500, Michael Droettboom wrote: In your matplotlibrc file, you can set the following: font.family : serif font.serif : STIXGeneral Also note the numerals and Latin characters are extremely similar if not identical to Times (or Times New Roman), so you could also use that for titles/labels etc., but it doesn't really matter. Cheers, Mike John Travers wrote: Hello, I'm very pleased with the STIX fonts support in mathtext. Thanks for getting this working! However, I would like to use the same font in labels which do not contain mathtext, for consistency. I cannot work out how to do this. Can anyone help with this? Thanks, John Thanks for the quick response. I'm using the stixsans font for mathtext, so I need sans-serif fonts for the rest of the text. STIXGeneral appears to be serif only (changing the rc options to sans-serif etc. does not work). Should I use Vera instead? Or have I miss understood something (I'm not particularly informed about fonts)? I just assumed you were using the STIX serif mode. Unfortunately, the sans-serif stuff in the STIX fonts are at math-specific code points in the same font file, so you can't just tell matplotlib to use it and have it work, unfortunately. Support specifically for that could be added to matplotlib, but it's not straightforward. You could use another sans-serif font, but I'm not sure specifically which one STIX is based on (the information is pretty thin on the STIX website). It's definitely not Helvetica/Arial etc. Does anyone else know? And slightly OT -- if there's any other font geeks out there. I just found the identifont website which asks a series of questions about a font you want to identify and then presents a list of fonts that meet that criteria. It failed to identify the STIX sans-serif characters -- I suppose its database isn't big enough. But still an interesting solution to the problem nonetheless. Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] PS backend does not respect kwargs
This should be fixed now in SVN r4938. The graphics context was sticking. Cheers, Mike [EMAIL PROTECTED] wrote: When using the PostScript backend, and plotting several lines with the same call to plot (or when plotting a LineCollection), kwargs are applied to the first line only, and not to every line. Included is a minimal script that exhibits this problem. The saved figure shows only one thick red line where we would expect two such lines. Paul Novak #!/usr/bin/env python import matplotlib matplotlib.use('PS') from pylab import * x = arange(0.0, 5.0) y = 2 * x plot(x, x, x, y, color='red', linewidth = 5) savefig('image') show() - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] font
You shouldn't edit rcsetup.py directly -- that is part of the matplotlib source code. Instead, you should edit the matplotlibrc settings file. In there, you'll actually want to change two settings: 1) Add Cambria to the front of the font.serif list 2) Set font.family to serif, so that mpl will use that list. Hope this helps, Mike [EMAIL PROTECTED] wrote: I would like to be able to use Cambria font (http://en.wikipedia.org/wiki/Cambria_(typeface)) for all text on my charts. I am adding these charts to a MS Word 2007 document written in the same font. I tried to add Cambria as the fist string in rcsetup.py | defaultParams | 'font.serif'. That didn't work. Can I use this font for the charts? - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] aspect_ratio in combination with sharex
Before I look into this further: what version of mpl are you using? Mark Bakker wrote: I seem to have tracked down the problem. After calling the aspect_ratio function, the data limits don't get set. When a new axis with sharex is called, it gets the old data limits. After I call draw() or ax.draw() the datalimit gets set correctly. And creating a subplot with sharex works fine. Maybe the datalimit needs to be set at the end of the aspect_ratio function? (I presume that is part of the draw() command) Mark from pylab import * x,y = meshgrid(linspace(0,5,5),linspace(0,5,5)) figure() ax = subplot(211) ax.contour(x,y,x) ax.set_aspect('equal',adjustable='datalim') print ax.get_xlim() # Prints 0 to 5 while datalimit is much larger draw() print ax.get_xlim() # Now datalimit is correct and sharex works ax2 = subplot(212,sharex=ax) draw() On Feb 11, 2008 9:56 AM, Mark Bakker [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hello - I have a hard time getting aspect_ratio to work correctly with sharex. This used to work quite a while ago, and has been broken for a long time (or at least I don't know how to get it to work) But I finally found the time to put a simple example together to determine if I do something wrong, or whether this can be fixed easily. When I make a small contour plot setting the aspect ratio equal works fine: from pylab import * x,y = meshgrid(linspace(0,5,5),linspace(0,5,5)) figure() ax = subplot(211) ax.contour(x,y,x) ax.set_aspect('equal',adjustable='datalim') draw() Note that the datalim on the x-axis is expanded, as the data limit on the y-axis is the determining factor. If I now try to do the same thing while linking the x-axis of a second subplot to the first one, then the same call to set_aspect changes the data limit on the y-axis while keeping the x-axis fixed. That seems inconsistent and is not the behavior I want: figure() ax = subplot(211) ax.contour(x,y,x) ax2 = subplot(212,sharex=ax) ax.set_aspect('equal',adjustable='datalim') draw() Any idea what I am doing wrong? Thanks, Mark - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Fail to allocate bitmap, Unable to free colormap, palette is still selected.
Chris Kennedy wrote: hi Mike, I was able to get it to work using: reload(matplotlib) matplotlib.use('Agg') That suggests that the bug is somehow related to GUI code. As John pointed out, we'll want to very exactly which GUI backend is being used. I'll have to beat on it some more to see if this is robust. I saw the error message in this code: http://search.cpan.org/src/NI-S/Tk-804.027/pTk/mTk/win/tkWinDraw.c if(!bitmap) { panic(Fail to allocate bitmap\n); DeleteDC(dcMem); TkWinReleaseDrawableDC(d, dc, state); return; } That seems to suggest that the TkAgg backend (or Tkinter itself) is somehow the problem, assuming Gtk doesn't issue the same message (unlikely). Thanks. Please let us know what other clues you can collect. Cheers, Mike Michael Droettboom wrote: Can you provide the full traceback for the error? Are there no Python line numbers etc.? I don't see the string Fail to allocate bitmap or Unable to free colormap... anywhere in the matplotlib source, so it's hard to say where it's coming from. I suspect they are coming from the GUI framework you are using... If you put your simple example inside of a loop, does the error eventually occur -- or only within the context of your app? If the latter, we'll need to somehow narrow it down to a specific setting or method that causes the problem. Also, what backend are you using when it breaks? Just Agg, or one of the Gui+Agg backends? Cheers, Mike Chris Kennedy wrote: hi, I get this error when I'm generating numerous .png files using matplotlib 0.9.2 in py2.4 on WinXP - Fail to allocate bitmap This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. Unable to free colormap, palette is still selected. This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. - The code is simple: import matplotlib import matplotlib.pyplot as pylab pylabFigure = pylab.figure() pylabFigure.clf() pylab.rcdefaults() pylab.plot(p[0::2], p[1::2], 'b-', linewidth=3) pylab.title('Endpointing Plot for '+StepMillName) pylab.xlabel('Mill Distance ('+m_unit+')') pylab.ylabel('~ Electron response ~' ) pylab.grid(True) pylabFigure.savefig('EPP_'+StepMillName+'.png', facecolor='lightgrey', edgecolor='w') pylab.close('all') pylabFigure = None I can put this code in a simple program and generate many images without seeing the allocate bitmap error. Perhaps it is colliding with something else in my main app. Is there a command that can clear, flush, or unselect the palette and/or colormap? I don't see the allocate error if I switch the backend to 'SVG', that has it own set of issues though: telling me it can't use, but then generating SVG files anyway. thanks -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] MatPlotLib + Py2exe, backend problems ...
[EMAIL PROTECTED] wrote: What I need is a version of 0.91.2 ver of matplotlib that works with Python 2.3 to see if that works... I might be misremembering, but I thought 0.91.2 worked with Python 2.3. I don't use 2.3 every day, however. Can you send the errors that are produced when you build or run matplotlib 0.91.2 with Python 2.3? Or are you just referring to the fact that there are no Windows binaries provided for Python 2.3? Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] subplots with linked axes
It sounds like what you want is to use the shared axis functionality. See the shared_axis_demo.py http://matplotlib.sourceforge.net/examples/shared_axis_demo.py Cheers, Mike Nick Granger-Brown wrote: I would like to plot two or three graphs as subplots in a figure and control the axes such that when one graph is zoomed the others are adjusted too. I was hoping there would be a notification mechanism which would allow me to catch a rescaling of one subplot and redraw the others in step. Can anyone suggest a method of doing this? *Nick Granger-Brown* // __ This email may contain privileged or confidential information, which should only be used for the purpose for which it was sent by Xyratex. No further rights or licenses are granted to use such information. If you are not the intended recipient of this message, please notify the sender by return and delete it. You may not use, copy, disclose or rely on the information contained in it. Internet email is susceptible to data corruption, interception and unauthorised amendment for which Xyratex does not accept liability. While we have taken reasonable precautions to ensure that this email is free of viruses, Xyratex does not accept liability for the presence of any computer viruses in this email, nor for any losses caused as a result of viruses. Xyratex Technology Limited (03134912), Registered in England Wales, Registered Office, Langstone Road, Havant, Hampshire, PO9 1SA. The Xyratex group of companies also includes, Xyratex Ltd, registered in Bermuda, Xyratex International Inc, registered in California, Xyratex (Malaysia) Sdn Bhd registered in Malaysia, Xyratex Technology (Wuxi) Co Ltd registered in The People's Republic of China and Xyratex Japan Limited registered in Japan. __ - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] problem with modules
Davide Cellai wrote: That answers my questions. Thank you very much, Davide On Thu, Feb 28, 2008 at 8:08 PM, Steve Schmerler [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: On Thu, Feb 28, 2008 at 05:40:00PM +, Davide Cellai wrote: 1. To begin with, I've copied the lines: deb http://anakonda.altervista.org/debian packages/ deb-src http://anakonda.altervista.org/debian sources/ I'm sure matplotlib is in Ubuntu's official repos by now [1]. Same for Debian. 2. When I try to run some examples I have downloaded from the website, the program complains about modules. For example, if I try python hline_demo.py Ubuntu's latest version is 0.90.1. According to [2], the pyplot module was introduced with 0.91.2. Right -- but the examples from 0.90.1 should still work for you if you want to use the 0.90.1 packages in the Ubuntu or Debian repositories. You can download the (older) examples as part of the source distribution from here: http://sourceforge.net/project/showfiles.php?group_id=80706 Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Show shapes on scatterplot legend?
I don't believe there is at present. There was a recent discussion about this on the list, and it's on the radar as something to add for a future release. Cheers, Mike chombee wrote: I'm making some scatter plots which will probably end up getting printed in black and white. I'm actually drawing two scatter plots onto one axes. So to the distinguish between the two plots I've had them use different marker shapes and different shades of grey. The problem is that the legend displays only a rectangular block indicating the color for each plot. Is there a way to get the marker shapes of scatter plots into the legend? Thanks - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] locale and Qt
Can you describe how you are changing the locale? It could be that Qt is reverting it to your system value every time a new figure window is created. Maybe you could set it somehow deeper, like in an environment variable. Cheers, Mike Stephane Raynaud wrote: Hi, when I set the locale to a value (let's say 'en_US.UTF-8' different from my that of environement ('fr_FR'), it is automatically switched back to 'fr_FR.UTF-8' after the first figure is created when the backend is dervied from Qt (no problem with Agg only). Any idea how to prevent from that? -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] bug with wx toolbar
Seems like a reasonable fix to me. I don't think the classic toolbars get as much testing as the new ones, which is probably how this fell through the cracks. I have committed this in SVN r4991. Cheers, Mike Jeff Peery wrote: Hello, I just upgraded to the most recent version of matplotlib. I'm using wxagg backend for a wxapp. after upgrading my toolbar didn't work anymore and I was getting an error in the method 'zoomx' in class NavigationToolbarWx in backend_wx.py. I noticed that zoomx, zoomy, panx, and pany all had the same error. the error is that the axes have no attribute zoomx, zoomy, panx, pany. some quick digging around fixed the problem. it appears this should be as shown below. this seems to work well now. please let me know if this is incorrect.Thanks! def panx(self, direction): DEBUG_MSG(panx(), 1, self) for a in self._active: a.xaxis.pan(direction) self.canvas.draw() self.canvas.Refresh(eraseBackground=False) def pany(self, direction): DEBUG_MSG(pany(), 1, self) for a in self._active: a.yaxis.pan(direction) self.canvas.draw() self.canvas.Refresh(eraseBackground=False) def zoomx(self, in_out): DEBUG_MSG(zoomx(), 1, self) for a in self._active: a.xaxis.zoom(in_out) self.canvas.draw() self.canvas.Refresh(eraseBackground=False) def zoomy(self, in_out): DEBUG_MSG(zoomy(), 1, self) for a in self._active: a.yaxis.zoom(in_out) self.canvas.draw() self.canvas.Refresh(eraseBackground=False) Jeff Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] error in savefig with wxAgg backend
What version of matplotlib are you using? I have a vague recollection that this was fixed at one point. In any case, you should be able to get around this by casting your filename to a string as such: self.figure.savefig(str(image_file)) Hope that works for you, Mike Jeff Peery wrote: Hello, I’m trying to use savefig in my wx app and I’m using wxAgg backend. I’m getting this error: FILE …maplotlib\backends\backend_bases.py, line 397 in print_png Self.get_renderer()._renderer.write_png(filename, self.figure.dpi.dpi.get()) TypeError: cannot return std::string from Unicode object I’m simply calling this: self.figure.savefig(image_file, facecolor='w', edgecolor='w') How do I fix this problem? Thanks. Jeff - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] PNG performance tips
Jesper Larsen wrote: Hi Matplotlib users, I have an application which produces PNG files using the AGG backend. When I profile the application I can see that much of the cpu time is spent in the method write_png called by print_figure in backend_agg.py. I have seen this myself. Keep in mind that timing includes a lot of disk I/O, so if your images are particularly large, or you're saving to a network or external disk, or if another process steps in at that moment and wants to read/write to the disk, that could be the bottleneck, more so than just the CPU time spent doing the PNG compression. On any reasonably modern PC, I suspect that's the case. Does anyone know which backend is the best for producing fast good quality PNG files (with fast being as important as good quality)? They should all be approximately the same wrt actually writing out the file -- they're all using libpng either directly or indirectly. It also means there's not much that matplotlib can do to improve its performance, short of submitting patches to libpng -- but I suspect there isn't a lot of long-hanging fruit left to improve in such a widely-used library. In another thread I read that antialiasing could be disabled for better performance. I tried doing that in each call to contourf and it resulted in a performance improvement. Does anyone have other performance tips with regard to PNG files? Saving to a Python file-like object (if you're doing that) is slower than saving directly to a file path. See the recent thread on Matplotlib performance for a discussion of decimation of data (if your data set is really large). Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] PNG performance tips
David Moore wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Droettboom wrote: Jesper Larsen wrote: Hi Matplotlib users, I have an application which produces PNG files using the AGG backend. When I profile the application I can see that much of the cpu time is spent in the method write_png called by print_figure in backend_agg.py. I have seen this myself. Keep in mind that timing includes a lot of disk I/O, so if your images are particularly large, or you're saving to a network or external disk, or if another process steps in at that moment and wants to read/write to the disk, that could be the bottleneck, more so than just the CPU time spent doing the PNG compression. On any reasonably modern PC, I suspect that's the case. Does anyone know which backend is the best for producing fast good quality PNG files (with fast being as important as good quality)? They should all be approximately the same wrt actually writing out the file -- they're all using libpng either directly or indirectly. It also means there's not much that matplotlib can do to improve its performance, short of submitting patches to libpng -- but I suspect there isn't a lot of long-hanging fruit left to improve in such a widely-used library. In another thread I read that antialiasing could be disabled for better performance. I tried doing that in each call to contourf and it resulted in a performance improvement. Does anyone have other performance tips with regard to PNG files? Saving to a Python file-like object (if you're doing that) is slower than saving directly to a file path. This seems to contradict your previous assertion that the bottleneck is likely to be disk I/O - if you're saving to a Python file-like object, there's no disk I/O. Why is this slower? All things being equal -- if the Python file-like object is saving to an on-disk file -- the Python file-like object will be slower. Sometimes people do this if the want another layer of abstraction (e.g. saving to a gzip file) or to be more general. What I mean is that: savefig(open(filename)) is slower than savefig(filename) because the latter makes a Python function call to save each block of data. Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Using math text!
It looks as if you're using 0.90.1. All of these issues are fixed in 0.91.2. If you can upgrade, that's probably your best bet. Or, if you have all the requirements, you can set text.usetex to True in your matplotlibrc which will use the real TeX on your system to typeset math -- that should support your expression. Ssebuliba, J, Mnr [EMAIL PROTECTED] wrote: Hi all, When I use; text(0.6, 0.6, r'$\mathcal{A}\mathrm{sin}(2 \omega t)$', fontsize=20) I get an error message below; File /usr/lib/python2.5/site-packages/matplotlib/mathtext.py, line 616, in _get_info raise ValueError('unrecognized symbol %s' % sym) ValueError: unrecognized symbol \mathr, unrecognized symbol \mathcal 0.90.1 was much less TeX-like in its mathtext support, and therefore doesn't support \mathrm, \mathcal etc.. You can, however do: text(0.6, 0.6, r'$\cal{A}\rm{sin}(2 \omega t)$', fontsize=20) which works for me. When I replace \mathrm with \mbox or \text, the error message I get is basically the same, only that this time, the last line appears as; unrecognized symbol \mbox, unrecognized symbol \text \mbox and \text aren't supported by the built-in mathtext in any version. Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How do I get Missing Modules?
Like your last question, I think you're using the current release's documentation (0.91.2) with an old release (probably 0.90.1 or earlier). pyplot did not exist in 0.90.1, but I believe everything that is now in pyplot used to be in pylab, so you could just import that instead. Cheers, Mike Ssebuliba, J, Mnr [EMAIL PROTECTED] wrote: Hi there, When I use; import matplotlib.pyplot as p, I get an error message; ImportError: No module named pyplot. So, how am I supposed to get these missing modules? Please note: I am using Linux (Ubuntu-gusty)! Regards, JOE. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Transforms examples
Can you be a bit more specific about what you're trying to do? (Are you working with the latest SVN trunk, or the latest release 0.91.x? The two are considerably different wrt to the transforms framework(s)). Cheers, Mike Chloe Lewis wrote: Any current transforms examples? The transforms docs suggest looking in /units for transforms examples; the current matplotlib examples has /units without transforms. (I want something a bit more detailed than the offset.) If the transforms are currently too much in flux, I'll do something one-off, but I'd like to do it the Right Way if I can. C - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Transforms examples
Am I correct that you would like to add new kinds of plots to matplotlib that transform the raw data in some new way? Though transforms are involved, at the higher level you see this referred to as projections a lot in the mpl code. There are a number of approaches you could take, all of which have different tradeoffs, rather than there being one Right Way. In matplotlib-0.91 (and earlier) there is an underlying framework for doing transformations (in _transforms.cpp). This framework, while its does it job well, is kind of obscure and difficult to extend with new kinds of transformations. But it's certainly doable, and you can look at the code for polar plots (in axes.py) for an example. As a result, the current SVN trunk has been heavily refactored to make adding new kinds of projections easier. I'm biased because I did a lot of that work, so I wouldn't want to claim that it is significantly easier until someone else comes along and uses the new framework to build something new. (I think the soil texture triangle plot you suggest seems like it would be a reasonably good fit, though). If you decide to take this approach, there is documentation for making new projections here: http://matplotlib.svn.sourceforge.net/viewvc/*checkout*/matplotlib/trunk/matplotlib/doc/devel/add_new_projection.rst Again, that documentation has largely gone unused by anyone but myself, so please let me know where it needs improvement. Of course, the downside is that it may be a number of months until the SVN trunk is released as a stable version. Alternatively to all of the above, you could take the approach of basemap (a toolkit extension to matplotlib). It (essentially) does all of the transformation of the data into a given projection internally and then passes that along as a regular Cartesian 2D plot to matplotlib. That approach does work well, and has shown to be rather robust to internal changes in mpl, since it primarily uses the public (and more stable) APIs. Hope that helps. Please ask if you have any more questions as you go. Mike Chloe Lewis wrote: I stick to releases, so, 0.91.2; although if the transforms are about to change a lot, maybe I'll put off the 'right way'. The first thing I'm writing is an easy version of the 'soil texture triangle' -- plotting x+y+z=100, but on an equilateral triangle: http://www.uwsp.edu/geo/faculty/ritter/glossary/s_u/soil_texture_triangle.html Scatters and patches on this are handy. There's another handful of triangular, sort-of-rigorous 3-variable graphs commonly used by ecosystem scientists, which I'd like to extend to. C On Mar 7, 2008, at 7 Mar, 10:30 AM, Michael Droettboom wrote: Can you be a bit more specific about what you're trying to do? (Are you working with the latest SVN trunk, or the latest release 0.91.x? The two are considerably different wrt to the transforms framework(s)). Cheers, Mike Chloe Lewis wrote: Any current transforms examples? The transforms docs suggest looking in /units for transforms examples; the current matplotlib examples has /units without transforms. (I want something a bit more detailed than the offset.) If the transforms are currently too much in flux, I'll do something one-off, but I'd like to do it the Right Way if I can. C - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] wx backend scaling problem
Well, that was a good puzzle! It turns out that in the Wx backends, the figure is created at the correct (requested) size, and then immediately the height is shrunk by 25 pixels (at least on my platform) when the status bar is added to the window. By creating the status bar before the figure canvas I was able to prevent this from happening. This seems like a safe fix to me, but anyone who currently extends the Wx Frame (meaning the whole window etc.) and is unknowingly compensating for this effect may have problems after my change. Committed on the maintenance branch in r4997. http://matplotlib.svn.sourceforge.net/viewvc/matplotlib?view=revrevision=4997 BTW, I also committed the fix for the range of values in figure.subplot.* here: http://www.nabble.com/Re%3A-pylab-axis-query-and-possible-bug-p14459682.html to the maintenance branch (it was previously only made to the trunk.) Cheers, Mike Gary Ruben wrote: Gary Ruben wrote: The attached test.py Oops. Here it is. Gary R. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Major Issue with 0.91.2 and Python-2.5
I suspect there is an .afm font file on your new system that is untested with matplotlib and exhibiting something new. I would first try to track down which font file it is, and then send it to me off list and I'll have a look at what might be tripping up matplotlib. Cheers, Mike Rich Shepard wrote: I upgraded my notebook to Slackware-12.0 (which includes python-2.5) and discovered that the application I'm developing no longer ran. Turns out that matplotlib went missing during the upgrade. So, I just built matplotlib-0.91.2 using the same matplotlib.Slackbuild script I used on my workstation/server, but this time it failed. The font manager seems to be the issue; the error message repeatedly is: Found an unknown keyword in AFM header (was Underline). Specifically, the error is in File /usr/lib/Python2.5/site-packages/matplotlib/afm.py, line 166, in _parse_char_metrics name=vals[2].split()[1] IndexError: List index out of range Is this unique to me? What do I do to fix the problem? TIA, Rich -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] contour question
.get_paths() returns a list of Path objects. (See path.py). For each Path object, you can get an Nx2 array of vertices from its vertices member. You can also use the iter_segments method to iterate through each of its vertices, but that's primarily only useful when there may be bezier curves in the path, which there won't be in the case of contours. Missing docstrings is definitely a problem that will need to be worked on. Cheers, Mike [EMAIL PROTECTED] wrote: Hello, I'm using a svn version of matplotlib and the API changed for contour. I want to have the coordinate of the contour. Before Eric Firing (I think) gave a solution to do it: val = contour(xRange,yRange,delchi2,[1]) t = asarray(val.collections[0].get_verts()) but now get_verts doesn't exist anymore. I tried to do: cs = contour(a) path = cs.collections[0].get_paths() but I don't know how to use it. Basically I think that I have the contour coordinate but I don't know how to recuperate them. I need it to export them in a data file so it's the reason I want to recuperate them. Thank you for any help N. ps: It's a little bit difficult to access to the help for a method now some, perhaps most, of them are missing a docstring. So it's difficult to understand what it is the meaning of each of them. example: col.get_paths? Type: instancemethod Base Class: type 'instancemethod' String Form:bound method LineCollection.get_paths of matplotlib.collections.LineCollection object at 0x9038a4c Namespace: Interactive File: /usr/lib/python2.5/site-packages/matplotlib/collections.py Definition: col.get_paths(self) Docstring: no docstring - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib threadsafe?
At least the Agg backend *looks* to be reasonably threadsafe -- there are no obvious gotchas like global variables etc. Note, though, that multithreading may not gain much in the way of performance since the global interpreter lock is never released around long-running C blocks. However, I can't speak about this from any experience -- so, maybe it needs some trying. Any patches to help with thread safety and performance are of course welcome ;) Cheers, Mike Chris Withers wrote: Hi All, I'm wondering what work people have done with matplotlib in multi-threaded environments such as your average python web framework. Is matplotlib threadsafe? How have people gone about safely using it in a multi-threaded environment? cheers, Chris - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Latex in Figures
Mattias' suggestion is a good one if you have a full TeX environment installed. Otherwise, it looks like you're using some features that are only available in 0.91.x (but not earlier versions), for example \sin. If you can, try upgrading. Cheers, Mike Lorenzo Isella wrote: Dear All, I think the solution to my problem must be a one-liner, but I have been unsuccessful. I am trying to use latex formulas (nothing dramatically complicated) inside a figure. I suppose everything is working correctly on my system. I tried running the example at: http://www.scipy.org/Cookbook/Matplotlib/UsingTex and it works fine. But now have a look at this: #! /usr/bin/env python import scipy as s import numpy as n import pylab as p x=s.linspace(0.,(2.*s.pi),100) y=s.sin(x) z=s.exp(-x) #Now I create my figure fig = p.figure() axes = fig.gca() axes.plot(x,y, bo,label=(r$sin(\tau)$)) axes.plot(x,z,'--r',label=(r$\rm{decay}exp(\tau) $),linewidth=2.) p.xlabel('This is $\tau$') p.ylabel('$N_\infty(\tau)$') axes.legend() p.title('My test functions') p.grid(True) p.savefig(simple_test.pdf) p.clf() The point of the example figure is to try mixing latex formulas and text. Obviously, the result is not satisfactory. If I use \sin for instance, then I get an error message as that is not recognized. I think the fix to this must be rather simple for someone knowledgeable, but so far my attempts to get some decent mixed latex/text output have been unsuccessful. Can anyone help me with this simple example code? Many thanks Lorenzo - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] from pylab import nx?
Eric Firing wrote: Chris Withers wrote: Hi All, A few of the units demos include the lines: from pylab import nx ...but this import errors for me. Why is that? If you are referring to scripts in the matplotlib/examples/ subdirectory then you must have a version in which some of those scripts had not been brought up to date with the rest of matplotlib. (Historically, this has often been the case--only a subset of the examples are maintained. Right now, for example, simple3d.py is broken. 3D plotting is itself unmaintained, so there is little incentive to do anything about the example.) In the svn version there are no lines importing nx. This was an abbreviation for the numerix module, which was a compatibility wrapper for the three different numeric packages (Numeric, numarray, and numpy) until numpy was fully developed, rendering Numeric and numarray obsolete. Slightly OT, but if matplotlib is participating in any sort of internship projects (Google Summer of Code etc.) that would be a great student project -- to clean up all the examples, removing dead ones, editing for consistency etc. Cheers, Mike - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib threadsafe?
Eric Firing wrote: In general, I don't think mpl is threadsafe at all; it uses global variables, such as all the rc parameters, that could easily be modified by one thread while being used by another. I think that great care would be needed if one wanted to have multiple threads making plots. Having one plotting thread and any number of threads doing other things, however, should be OK. Oh yes -- I didn't think of the rcParams. Michael Droettboom wrote: At least the Agg backend *looks* to be reasonably threadsafe -- there are no obvious gotchas like global variables etc. Note, though, that multithreading may not gain much in the way of performance since the global interpreter lock is never released around long-running C blocks. Possibly this could be changed. The danger would be accidentally modifying or deleting an array that is being used by C extension code. Modifying may be problematic, but deleting would not be likely -- the C function holds a reference to each of the arrays as they are using them. However, I can't speak about this from any experience -- so, maybe it needs some trying. Any patches to help with thread safety and performance are of course welcome ;) At the very least, I think we would have to take all the global state information and put it in a class instance, so there could be multiple plotting machines. Pyplot would then instantiate and use one of these; the OO API would allow one to instantiate any number of them. I have not thought about how easy or hard this would be. Ditto that. Having just come back from PyCon, I'll parrot the standard Python answer to this question which is: Don't use threads, use multiple processes, which would seem to solve all these issues -- but, I understand that it not always the best solution. Mike Eric Cheers, Mike Chris Withers wrote: Hi All, I'm wondering what work people have done with matplotlib in multi-threaded environments such as your average python web framework. Is matplotlib threadsafe? How have people gone about safely using it in a multi-threaded environment? cheers, Chris - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Bug exporting mathtext to eps file in 0.91.2 on windows
Unfortunately, I'm still unable to reproduce the problem myself. Have you tried installing the CM fonts (copying them to C:\Windows\Fonts)? Maybe GS is trying to re-embed them and can't find them. Cheers, Mike Mark Bakker wrote: I have confirmed that it is a bug in (at least the windows version) of mpl 0.91.2. When saving eps files, and using mathtext, the cm fonts don't get saved, and the greek symbols (and others I presume) don't show up in the eps file. This works in mpl 0.90.1, where the eps file does store the fonts. %%BeginFont: Cmmi10 When running the same problem with 0.91.2, the fonts are not stored. Either using ps.fonttype 3 or 42. Anybody who can fix this? Thanks, Mark On Wed, Mar 19, 2008 at 11:21 AM, Bernhard Voigt [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi Mark! The problem seems to be that the computer modern font (cm) is not included in the eps file. The snipped of the eps file I sent before defines the font cmmi10: %!PS-Adobe-3.0 Resource-Font %%Title: cmmi10 %%Copyright: Copyright (C) 1994, Basil K. Malyshev. All Rights Reserved.012BaKoMa Fonts Colle ction, Level-B. %%Creator: Converted from TrueType by PPR . /FontName /Cmmi10 def And later, when the \chi glyph should be drawn, the font is changed to: /Cmmi10 findfont 16.0 scalefont setfont 0.00 4.921875 moveto /chi glyphshow Which is the same in your file, but your file only contains the Bitstreem Vera Sans font for the axis ticks. Cmmi10 is missing :-( Your pdf, however, does contain the cmmi10 font, you can check via file-properties-fonts. You should have the following in your matplotlibrc file (well, you said you have it, but let me repeat): mathtext.fontset : cm mathtext.fallback_to_cm : True ps.useafm : False ps.fonttype : 3 Check the settings using the interpreter prompt: In [10]: p.rcParams['mathtext.fontset'] Out[10]: 'cm' etc... Well, if they are all correctly set, it's probably a bug in the ps backend not including the mathtext font. A workaround would be to convert the pdf file to ps (either use command line options of acroread or print to file), edit the ps file to be a eps by changing the header to %!PS-Adobe-2.0 EPSF-2.0 and make sure the bounding box is specified (see http://www.postscript.org/FAQs/language/node82.html for details) Bernhard On Wed, Mar 19, 2008 at 10:22 AM, Mark Bakker [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hello Mike - Thanks for taking a look at this. Easy example: from pylab import * plot([1,2,3]) text(1,1.5,r'$\chi$') savefig('d:/temp/test.eps') There shoud now be a line and the symbol chi. Works great in the pdf file, not in the eps file. Both are attached. Strangely enough at the end of the eps file there are statements: 0.00 3.703125 moveto /chi glyphshow Which looks to me like writing chi. I have now tried this on 4 windows machines, with different installations of gsview, but it doesn't work on any. It works fine under mpl vs. 0.90.1. That has the same statement for chi, but defines chi internally inside the eps file (which is much bigger). Thanks, Mark On Tue, Mar 18, 2008 at 7:09 PM, mdroe [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: It looks like it may be Windows-specific. I can create .eps files with math on mpl-0.91.2, Python 2.5, gs-7.07 on Linux without problems. Someone with a Windows installation may need to look at this. Just so I can have a deeper look -- can you please attach a) the Python source of a minimal plot that causes this problem b) your .eps file output (so I can compare it against mine). Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Bug exporting mathtext to eps file in 0.91.2 on windows
I don't see the character in the plot you sent. So at least that's consistent. ;) However, I still can't get things to break locally (on Linux, at least), with all permutations of ps.fonttype, ps.useafm, ps.distiller, and mathtext.fontset. Can you send your entire matplotlibrc file? Perhaps there is some other obscure setting that's interacting in a negative way. Mike Mark Bakker wrote: Sorry, John, but here is my output, and it still doesn't work. from pylab import * rcParams['mathtext.fontset'] 'cm' rcParams['mathtext.fallback_to_cm'] True rcParams['ps.useafm'] False rcParams['ps.fonttype'] 3 plot([1,2,3]) [matplotlib.lines.Line2D instance at 0x029F0120] text(1,1.5,r'$\chi$') matplotlib.text.Text instance at 0x029F6968 savefig('c:/temp/test.eps') On the same machine, I get the correct eps file with 0.90.1. So it really isn't my installation of GsView. In the eps file created with 0.91.2, the cm fonts are not included, which I think is causing the problem. What happens when you guys read the attached eps file (created with commands above)? Do you see the chi symbol on the screen? Thanks for looking into this, Mark On Wed, Mar 19, 2008 at 2:18 PM, John Hunter [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: On Wed, Mar 19, 2008 at 7:43 AM, Mark Bakker [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: I have confirmed that it is a bug in (at least the windows version) of mpl 0.91.2. When saving eps files, and using mathtext, the cm fonts don't get saved, and the greek symbols (and others I presume) don't show up in the eps file. This works in mpl 0.90.1, where the eps file does store the fonts. %%BeginFont: Cmmi10 When running the same problem with 0.91.2, the fonts are not stored. Either using ps.fonttype 3 or 42. Anybody who can fix this? My guess is that you are picking up an rc file where useafm is set to True. Michael suggested checking this rc setting but I did not see any response on this on list. Have you checked it? In the script that is causing you trouble, print out the value import matplotlib print 'afm setting', matplotlib.rcParams['ps.useafm'] If this is True, then you need to find your matplotlibrc file and set it to False. I can't imagine a windows vs other platform issue that could cause this since we do not use only matplotlib tools in our font conversion pipeline JDH -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] from pylab import nx?
Chris Withers wrote: Eric Firing wrote: If you are referring to scripts in the matplotlib/examples/ subdirectory then you must have a version in which some of those scripts had not been brought up to date with the rest of matplotlib. You should turn them into unit tests as well as examples. The backend_driver.py example runs a number of other examples using a number of different backends. That's been a reasonably successful set of regression and coverage tests. It's not perfect, but it's a start. There are also some lower-level unit tests for frequently-reoccurring bugs in the unit directory. Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] compiling from svn on windows
Chris Withers wrote: Michael Droettboom wrote: That's cool'n'all, but when is svn going to make it into a Windows binary release? ;-) I suspect your question is somewhat rhetorical, but... it will probably be a while ;) Why is that? Who cranks out the binary releases on Windows and what compiler do they use? Matplotlib recently underwent a major refactoring of the code to make it easier to add new transformations and projections to the system. This code is significantly less tested than the latest release. The idea of a release is that it is reasonably well-tested and reasonably stable. Obviously, the matplotlib releases aren't perfect, but I suspect 0.91.2 is far more safe and predictable than SVN trunk is right now. However, there is a branch, matplotlib_0_91_maint, that *theoretically* should be the latest release + any important bugfixes, but no new features. I say *theoretically* because occasionally bugfixes are made only to the trunk. If you find such a fix, let us know and hopefully someone can backport it. Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] BUG: Log axes are upside down with PDF output...
I vaguely recall a bug whereby mathtext on PDF was upside down (because the direction of the y-axis was not being inverted)... but I can't find the bug report. It does seem to work in 0.90.1 and 0.91.2 (on Linux at least). Are you able to upgrade? Cheers, Mike Simson Garfinkel wrote: Hi. I'm making scientific graphs again, so i just got back on this mailing list after a two year hiatus. I am using: matplotlib-0.90.0-py2.5-macosx-10.4-fat.egg Here is a simple program: #!/usr/bin/python # # Do our plots with matplotlib import matplotlib matplotlib.use('Agg') from pylab import * fig = figure(num=1,figsize=(6.5,4)) ax = fig.add_axes([.15,.3,.8,.65]) ax.set_title(Why is the Y axes upside down?) ax.set_yscale('log') ax.set_ylabel('Queries per second') ax.bar(1,1000,.5,color='r') ax.bar(2,5000,.5,color='b') ax.bar(3,55000,.5,color='g') fig.savefig(broken_log_demo.png) Here is the plot with a PNG: Well, that looks good. But here is the plot when I change the type to PDF: Notice the the axes are reversed. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] from pylab import nx?
Chris Withers wrote: Michael Droettboom wrote: The backend_driver.py example runs a number of other examples using a number of different backends. That's been a reasonably successful set of regression and coverage tests. It's not perfect, but it's a start. There are also some lower-level unit tests for frequently-reoccurring bugs in the unit directory. Indeed, is there any kind of full unit test suite that a developer can run when changing things ot make sure they haven't fubarred anything? backend_driver.py is, AFAIK, the closest thing to that. I recently did a coverage analysis of it (with coverage.py), and it hits something like 98% of the non-error case code, so it's pretty good. What we don't have is an automated regression test framework to see if the results remain correct. There are a number of reasons why this is a non-trivial task -- there was a thread about that on this list a few months ago. Unfortunately, I can't find it... Maybe someone else remembers the subject line? Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] update: BUG - axes problem update
Simson Garfinkel wrote: 1. Moving to matplotlib-0.91.2 solved the problem with PDF generation on log axes. 2. Installing matplotlib-0.91.2 on Linux required installing these packages first: * freetype-devel * libpng-devel (Those packages were NOT installed automatically by easy_install) Yeah -- easy_install doesn't address installing anything that's non-Python. It's a source of ranging debate about easy_install vs. the distribution packaging systems. Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] ipython, pylab quitting again after first time
Can you attach the traceback? Cheers, Mike Wolfgang Kerzendorf wrote: Hello, I have some trouble with ipython and matplotlib. I create a figure in one of my functions that I call from ipython. The first time it runs fine and I can use the figure interactively (selecting/ deselcting points and so on). The second time I run it, the code doesnt stop but continues without halting at the show routine. I'm doing this on a Mac (10.5.2/ Intel). On my Linux machine I did pylab.get_current_figure_manager().destroy() and bound it to a key to prevent this. If I do this on the mac (WXAgg) The next time I want to plot it complains about a deleted C++ extension and doesnt plot at all. Please help Wolfgang - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] can any windows 0.91.2 user reproduce
The *intention* is that the fonts *should* be included (with the exception of ps.useafm == True). That was definitely not a deliberate change. However, as one of the ones who hasn't been able to reproduce this problem, I'm afraid I'm not of much help. From reading the code, I'm still completely stumped as to why the font is not embedded. Someone will have to step through with a debugger on one of the broken systems to figure this out, I'm afraid. All the magic happens in convert_ttf_to_ps, which is C code, called from backend_ps.py. I'd start by seeing if that function is even called, and if not, why... Cheers, Mike Mark Bakker wrote: I know. In version 0.90.1 (and earlier) all greek symbols were included in the EPS. Now they are not anymore, and I cannot get any of the options to include them. Does anybody know how to fix this? Mark Date: Tue, 25 Mar 2008 10:43:43 -0400 From: Alan G Isaac [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Subject: Re: [Matplotlib-users] can any windows 0.91.2 user reproduce thisbug? To: matplotlib-users@lists.sourceforge.net mailto:matplotlib-users@lists.sourceforge.net Message-ID: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Content-Type: TEXT/PLAIN; CHARSET=ISO-8859-1 On Tue, 25 Mar 2008, Jim Vickroy apparently wrote: I loaded the eps file in Adobe Photoshop and the chi letter **was** displayed along the x-axis. -- jv Sounds like perhaps the symbol is not embedded in the EPS file. Cheers, Alan Isaac - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] can any windows 0.91.2 user reproduce
Hmm... That fix was in there in the first place to work around another Windows (well, case-insensitive filesystem) -related bug, in that occasionally the same font would get included with different paths, and therefore get included twice leading to other Postscript problems. One possible solution is to calculate a hash of the file and key off of that (with an I/O penalty, of course). I vaguely recall that keying off of the Postscript name embedded in the file wasn't good enough. I don't have time to look at this today, but maybe others have some better suggestions anyway. Cheers, Mike - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] problems in Inkscape with SVG exported from matplotlib
When matplotlib outputs an SVG, each unique character is assigned a numeric id (these are just assigned in order), and inserted as a def, and then used (referenced) wherever they are used. When you paste on SVG into another, those names clash, and Inkscape is pulling in the wrong characters when it goes to draw. Now, my gut feels that this is actually a bug in Inkscape -- pasting of referenced objects from one file into another should reassign new ids. However, I'm not an SVG expert, so I could be wrong, but I think I will take this question over to the Inkscape mailing list anyway. That said, there are probably some workarounds that matplotlib could make (using a hash of the character's content as the id, for instance). I'll look into that and reply when progress has been made. Mike Kaushik Ghose wrote: Hi Everyone, I have a peculiar problem, and I wonder if anyone can assist me. I have two figures generated from matplotlib and saved as svgs. They both print fine, and they load in Inkscape just fine. However, when I copy one figure and paste it into the other, the pasted figure's labels and text become garbled. Screenshots on this page http://assorted-experience.blogspot.com/2008/03/inkscape-matplotlibs-svg-one-strange.html Any suggestions would be most welcome Thanks -Kaushik - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] problems in Inkscape with SVG exported from matplotlib
I didn't write the first pass of SVG support, that was done before I got involved -- I'm not sure who to credit, but he or she deserves most of it. I did add the feature that's causing grief here -- the embedding of character outlines directly in the SVG file. I've committed a change in SVN (both the trunk and the branch) that should resolve your problem. I've written the inkscape mailing list about the correct solution, but I figure we need a workaround in mpl regardless. If you're not tracking SVN, you can replace your copy of backend_svg.py with this one, and it should *probably* work: http://matplotlib.svn.sourceforge.net/viewvc/*checkout*/matplotlib/branches/v0_91_maint/lib/matplotlib/backends/backend_svg.py?revision=5023pathrev=5023 Cheers, Mike Kaushik Ghose wrote: Hi Mike, Ah, such prompt, friendly and knowledgeable help! You're the guy implementing svg support in matplotlib, right? Thanks so much for implementing this!!! If I can do anything to assist please tell me. Thanks again, -Kaushik Michael Droettboom wrote: When matplotlib outputs an SVG, each unique character is assigned a numeric id (these are just assigned in order), and inserted as a def, and then used (referenced) wherever they are used. When you paste on SVG into another, those names clash, and Inkscape is pulling in the wrong characters when it goes to draw. Now, my gut feels that this is actually a bug in Inkscape -- pasting of referenced objects from one file into another should reassign new ids. However, I'm not an SVG expert, so I could be wrong, but I think I will take this question over to the Inkscape mailing list anyway. That said, there are probably some workarounds that matplotlib could make (using a hash of the character's content as the id, for instance). I'll look into that and reply when progress has been made. Mike Kaushik Ghose wrote: Hi Everyone, I have a peculiar problem, and I wonder if anyone can assist me. I have two figures generated from matplotlib and saved as svgs. They both print fine, and they load in Inkscape just fine. However, when I copy one figure and paste it into the other, the pasted figure's labels and text become garbled. Screenshots on this page http://assorted-experience.blogspot.com/2008/03/inkscape-matplotlibs-svg-one-strange.html Any suggestions would be most welcome Thanks -Kaushik - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] problems in Inkscape with SVG exported from matplotlib
Peter I. Hansen wrote: On Tue, Mar 25, 2008 at 11:33 PM, Kaushik Ghose [EMAIL PROTECTED] wrote: Hi Everyone, I have a peculiar problem, and I wonder if anyone can assist me. I have two figures generated from matplotlib and saved as svgs. They both print fine, and they load in Inkscape just fine. However, when I copy one figure and paste it into the other, the pasted figure's labels and text become garbled. A trick that works for me is to produce eps files with matplotlib, import them in scribus, and then export them to svg. Then they seem to be nicely compatible with inkscape. I wonder if you could skip a step and just use the Cairo backend to output SVG? Does that not work? It should be quite similar. Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] draw_tex NotImplementedError in backend_bases.py
if tick.label1On and tick.label1.get_visible(): 682 extent = tick.label1.get_window_extent(renderer) /usr/lib/python2.5/site-packages/matplotlib/axis.py in draw(self, renderer) 177 178 if self.label1On: -- 179 self.label1.draw(renderer) 180 if self.label2On: 181 self.label2.draw(renderer) /usr/lib/python2.5/site-packages/matplotlib/text.py in draw(self, renderer) 759 def draw(self, renderer): 760 self.update_coords(renderer) -- 761 Text.draw(self, renderer) 762 if self.get_dashlength() 0.0: 763 self.dashline.draw(renderer) /usr/lib/python2.5/site-packages/matplotlib/text.py in draw(self, renderer) 307 308 renderer.draw_tex(gc, x, y, line, -- 309 self._fontproperties, angle) 310 return 311 /usr/lib/python2.5/site-packages/matplotlib/backend_bases.py in draw_tex(self, gc, x, y, s, prop, angle, ismath) 264 265 def draw_tex(self, gc, x, y, s, prop, angle, ismath='TeX!'): -- 266 raise NotImplementedError 267 268 def draw_text(self, gc, x, y, s, prop, angle, ismath=False): type 'exceptions.NotImplementedError': We are running: In [4]: matplotlib.__version__ Out[4]: '0.98pre' with In [5]: rcParams['text.usetex']=False In [6]: plot(t,y) Out[6]: [matplotlib.lines.Line2D object at 0x9724c2c] Does this mean we really didn't successfully build from source? Or is there some other problem? Thanks, Ryan - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] problems in Inkscape with SVG exported from matplotlib
For the sake of the list, I'm linking the response to my question on the Inkscape mailing list -- this is certainly an Inkscape bug, that their copy-and-paste functionality does not handle use/defs correctly. However, as the workaround in mpl was easy enough, we don't have to wait for Inkscape to fix what sounds like a difficult problem. http://sourceforge.net/mailarchive/forum.php?thread_name=3c78ff030803260851l36e71d12n173fb77d4ddc4579%40mail.gmail.comforum_name=inkscape-devel Cheers, Mike Kaushik Ghose wrote: Hi Mike, I replaced the current file with your modified one, and it works fine - I pasted three figures together and had not problems. (I am on Windows XP, Python 2.5) Thanks again for maintaining and enhancing matplotlib! -Kaushik Michael Droettboom wrote: I didn't write the first pass of SVG support, that was done before I got involved -- I'm not sure who to credit, but he or she deserves most of it. I did add the feature that's causing grief here -- the embedding of character outlines directly in the SVG file. I've committed a change in SVN (both the trunk and the branch) that should resolve your problem. I've written the inkscape mailing list about the correct solution, but I figure we need a workaround in mpl regardless. If you're not tracking SVN, you can replace your copy of backend_svg.py with this one, and it should *probably* work: http://matplotlib.svn.sourceforge.net/viewvc/*checkout*/matplotlib/branches/v0_91_maint/lib/matplotlib/backends/backend_svg.py?revision=5023pathrev=5023 Cheers, Mike Kaushik Ghose wrote: Hi Mike, Ah, such prompt, friendly and knowledgeable help! You're the guy implementing svg support in matplotlib, right? Thanks so much for implementing this!!! If I can do anything to assist please tell me. Thanks again, -Kaushik Michael Droettboom wrote: When matplotlib outputs an SVG, each unique character is assigned a numeric id (these are just assigned in order), and inserted as a def, and then used (referenced) wherever they are used. When you paste on SVG into another, those names clash, and Inkscape is pulling in the wrong characters when it goes to draw. Now, my gut feels that this is actually a bug in Inkscape -- pasting of referenced objects from one file into another should reassign new ids. However, I'm not an SVG expert, so I could be wrong, but I think I will take this question over to the Inkscape mailing list anyway. That said, there are probably some workarounds that matplotlib could make (using a hash of the character's content as the id, for instance). I'll look into that and reply when progress has been made. Mike Kaushik Ghose wrote: Hi Everyone, I have a peculiar problem, and I wonder if anyone can assist me. I have two figures generated from matplotlib and saved as svgs. They both print fine, and they load in Inkscape just fine. However, when I copy one figure and paste it into the other, the pasted figure's labels and text become garbled. Screenshots on this page http://assorted-experience.blogspot.com/2008/03/inkscape-matplotlibs-svg-one-strange.html Any suggestions would be most welcome Thanks -Kaushik - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Setting font family in ticks not possible. Bug?
Gerolf Ziegenhain wrote: Dear Mailinglist, Today I tried to change the fontset to sans-serif for a whole plot. Everything except the ticks could be adjusted. This is what I tried first: *** ffont = {'size':'20','family':'sans-serif'} xticks(**ffont) *** Hmmm... This works for me. What backend are you using? Perhaps it isn't updating? Also, do these two lines + show() alone not work, or is it only in the context of something else? Also, what platform are you on? Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Radial Plot Weirdness
Nick Susch wrote: Hi, I am new to this list, so forgive me if this has been asked before. I am trying to do a radial plot and the following code does not seem to work: # -- START CODE --- import pylab import matplotlib fig = pylab.figure(figsize=(8,8)) ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True) pylab.hold(True) ax.plot([4.189, 4.188],[41.347, 41.058], color = 'green', lw=1) #ax.plot([4.199, 4.188],[41.347, 41.058], color = 'green', lw=1) ax.set_rmax(80) # scale plot pylab.show() # -- END CODE --- When you run this, the entire background of the plot turns green. If you comment out the first ax.plot and uncomment the line below it, it works as expected. Any ideas as to what is going on? Is there some kind of limitation to the smallest line allowed? Thanks for any help! It may be that the line is too close to unity and Agg (the rendering engine) is messing up. That's the best explanation I can think of as well... However, it does seem like other backends (Ps, Pdf, Cairo) do work. You may try using those as a workaround for now. Note that the SVN trunk also works, possibly due to a) upgrading Agg 2.3 to 2.4, and b) a pretty radical overhaul of the rendering engine, particularly polar plots. Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] What's up with py2exe_datafiles?
Christopher Barker wrote: Hi all, as far as I can tell, matplotlib.py2exe_datafiles is broken with the latest release. Is it getting fixed? Also, there is a LOT of stuff in there -- is there a way to strip out the stuff you may not need for a particular application? I'm using MPl embedded in a wxPython app, and I don't need the icons, etc, nor do a need a bunch of fonts. I suppose it's just disk space, though. One more question: In mpl-data, there are a bunch of images and fonts. There are also subdirectories images, and fonts, with a bunch more? My the different places for these? I can't speak for py2exe specifically, but the source tree doesn't have any fonts or images at the root of mpl-data. Perhaps the py2exe script is copying things there? Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] multicolor concatenated text.
Unfortunately, matplotlib doesn't automatically provide anything like the rich text formatting you describe. The best you could do is to manually position the text. Cheers, Mike Olivier De Wolf wrote: Hi, I would like to add a Text that has three colors, bbb, , where is in blue, is in green and in red. I am able to create three texts but how can I have them position 'side by side'? Thanks, Olivier - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Fwd: Issues with TeX symbols and font changes
Kacey A. wrote: Originally emailed this off to the wrong list, but any help would be much appreciated! -- Forwarded message -- From: *Kacey A.* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Date: Wed, Apr 16, 2008 at 8:44 PM Subject: Issues with TeX symbols and font changes To: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Hello all, I've spent more time than I care to share trying to remedy this, but it just doesn't seem to be working... So long story short, I'm trying to insert a special symbol in my axis label, so I type the following: [1] xlabel = (rWavelength ($\AA$)) ...in order to receive the symbol for angstroms (an A with a circle above it). Problem is... whereas the rest of my plot is in whatever the default Scipy plot font is (Tahoma, perhaps?), The default font is Bitstream Vera Sans. the stubborn angstroms symbol is in Times New Roman-esque font, which is bothering me to no end. I've attempted just changing the font of the entire font by using [2] font = {fontname:Times New Roman} ... [3] xlabel = (urWavelength ($\AA$), **font) ...but unfortunately that does nothing to affect the font of the axis tickmark labels (i.e. the numbers along the axes) -- so while my axis labels (excluding the angstrom symbol) and plot text (i.e. text(x,y,string)) might be in the font set via command [2], the axis numbering will *still* be in the default (i.e. Tahoma). To change the font globally (excluding mathtext), you can do: rc('font', family='Times New Roman') For what help it's worth, I'm running OS X (10.4.11) and Python 2.5.1, although I'm not 100% certain of what version of Scipy and Numpy I have installed... (I *think* I'm running Scipy 0.3.2). I'm also using TextMate to type and run my scripts. Thanks so much for any help in advance! I really love SciPy, but if there's really no feasible workaround for this... I might just have to use a different package altogether. Thanks again. When using mathtext (putting symbols inside of a pair of $), unfortunately the font choices are rather limited. You basically have a choice of Computer Modern (used in TeX/LaTeX documents), STIX (which is based on Times), and STIX sans (which is sans-serif, based on some font I haven't been able to identify). This font can be set with the mathtext.fontset rcParam (to one of cm, stix, stixsans or custom). Fortunately, all is not lost. If all you need to is an Angstrom symbol, you can use Unicode rather than mathtext. The code point for Å (A with ring above) is C5 -- so you can type the following string in Python: urWavelength (\u00c5) I hope that one of these options will prove helpful. Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] win32 build error in _path.cpp: 'numeric_limits' : is not a member of 'std'
C2039: 'numeric_limits' : is not a member of 'std' src\path.cpp(372) : error C2062: type 'double' unexpected src\path.cpp(372) : error C2039: 'infinity' : is not a member of 'operator``global namespace''' src\path.cpp(373) : error C2039: 'numeric_limits' : is not a member of 'std' src\path.cpp(373) : error C2062: type 'double' unexpected src\path.cpp(373) : error C2039: 'infinity' : is not a member of 'operator``global namespace''' src\path.cpp(374) : error C2039: 'numeric_limits' : is not a member of 'std' src\path.cpp(374) : error C2062: type 'double' unexpected src\path.cpp(374) : error C2039: 'infinity' : is not a member of 'operator``global namespace''' src\path.cpp(375) : error C2039: 'numeric_limits' : is not a member of 'std' src\path.cpp(375) : error C2062: type 'double' unexpected src\path.cpp(375) : error C2039: 'infinity' : is not a member of 'operator``global namespace''' src\path.cpp(376) : error C2039: 'numeric_limits' : is not a member of 'std' src\path.cpp(376) : error C2062: type 'double' unexpected src\path.cpp(376) : error C2039: 'infinity' : is not a member of 'operator``global namespace''' src\path.cpp(371) : error C3861: 'numeric_limits': identifier not found, even with argument-dependent lookup src\path.cpp(372) : error C3861: 'numeric_limits': identifier not found, even with argument-dependent lookup src\path.cpp(373) : error C3861: 'numeric_limits': identifier not found, even with argument-dependent lookup src\path.cpp(374) : error C3861: 'numeric_limits': identifier not found, even with argument-dependent lookup src\path.cpp(375) : error C3861: 'numeric_limits': identifier not found, even with argument-dependent lookup src\path.cpp(376) : error C3861: 'numeric_limits': identifier not found, even with argument-dependent lookup src\path.cpp(468) : error C2039: 'numeric_limits' : is not a member of 'std' src\path.cpp(468) : error C2062: type 'double' unexpected src\path.cpp(468) : error C2039: 'infinity' : is not a member of 'operator``global namespace''' src\path.cpp(469) : error C2039: 'numeric_limits' : is not a member of 'std' src\path.cpp(469) : error C2062: type 'double' unexpected src\path.cpp(469) : error C2039: 'infinity' : is not a member of 'operator``global namespace''' src\path.cpp(470) : error C2039: 'numeric_limits' : is not a member of 'std' src\path.cpp(470) : error C2062: type 'double' unexpected src\path.cpp(470) : error C2039: 'infinity' : is not a member of 'operator``global namespace''' src\path.cpp(471) : error C2039: 'numeric_limits' : is not a member of 'std' src\path.cpp(471) : error C2062: type 'double' unexpected src\path.cpp(471) : error C2039: 'infinity' : is not a member of 'operator``global namespace''' src\path.cpp(468) : error C3861: 'numeric_limits': identifier not found, even with argument-dependent lookup src\path.cpp(469) : error C3861: 'numeric_limits': identifier not found, even with argument-dependent lookup src\path.cpp(470) : error C3861: 'numeric_limits': identifier not found, even with argument-dependent lookup src\path.cpp(471) : error C3861: 'numeric_limits': identifier not found, even with argument-dependent lookup src\path.cpp(526) : warning C4800: 'long' : forcing value to bool 'true' or 'false' (performance warning) src\path.cpp(826) : warning C4800: 'long' : forcing value to bool 'true' or 'false' (performance warning) src\path.cpp(992) : error C2146: syntax error : missing ')' before identifier 'or' src\path.cpp(991) : error C3861: 'not': identifier not found, even with argument-dependent lookup src\path.cpp(994) : error C2059: syntax error : ')' error: command 'C:\bin\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe' failed with exit status 2 - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] win32 build error in _path.cpp: 'numeric_limits' : is not a member of 'std'
Martin Spacek wrote: Michael, Sorry for the delay. Adding: #include limits to the top of path.cpp in rev5055 helps - most of the errors have disappeared, but I still get this: running build_ext building 'matplotlib._path' extension C:\bin\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe /c /nologo /Ox /MD /W3 /GX /DNDEBUG -IC:\bin\Python25\lib\site-p ackages\numpy\core\include -Iwin32_static\include -I. -IC:\bin\Python25\lib\site-packages\numpy\core\include -Isrc -Iagg 24/include -I. -IC:\bin\Python25\include -IC:\bin\Python25\PC /Tpsrc/path.cpp /Fobuild\temp.win32-2.5\Release\src/path.o bj path.cpp c:\home\mspacek\Desktop\Work\matplotlib\src\agg_py_path_iterator.h(98) : warning C4800: 'PyArrayObject *' : forcing valu e to bool 'true' or 'false' (performance warning) src\path.cpp(340) : warning C4800: 'long' : forcing value to bool 'true' or 'false' (performance warning) src\path.cpp(535) : warning C4800: 'long' : forcing value to bool 'true' or 'false' (performance warning) src\path.cpp(835) : warning C4800: 'long' : forcing value to bool 'true' or 'false' (performance warning) src\path.cpp(1001) : error C2146: syntax error : missing ')' before identifier 'or' src\path.cpp(1000) : error C3861: 'not': identifier not found, even with argument-dependent lookup src\path.cpp(1003) : error C2059: syntax error : ')' error: command 'C:\bin\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe' failed with exit status 2 Looks like VS2003 is picky about using not and or. So I replaced them with ! and ||, which helped. Now I get this error: Sorry about that. That comes from switching between Python and C/C++ all the time. I have updated SVN to reflect this. running build_ext building 'matplotlib._path' extension C:\bin\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe /c /nologo /Ox /MD /W3 /GX /DNDEBUG -IC:\bin\Python25\lib\site-p ackages\numpy\core\include -Iwin32_static\include -I. -IC:\bin\Python25\lib\site-packages\numpy\core\include -Isrc -Iagg 24/include -I. -IC:\bin\Python25\include -IC:\bin\Python25\PC /Tpsrc/path.cpp /Fobuild\temp.win32-2.5\Release\src/path.o bj path.cpp c:\home\mspacek\Desktop\Work\matplotlib\src\agg_py_path_iterator.h(98) : warning C4800: 'PyArrayObject *' : forcing valu e to bool 'true' or 'false' (performance warning) src\path.cpp(340) : warning C4800: 'long' : forcing value to bool 'true' or 'false' (performance warning) src\path.cpp(535) : warning C4800: 'long' : forcing value to bool 'true' or 'false' (performance warning) src\path.cpp(835) : warning C4800: 'long' : forcing value to bool 'true' or 'false' (performance warning) c:\home\mspacek\Desktop\Work\matplotlib\src\agg_py_path_iterator.h(160) : error C3861: 'round': identifier not found, ev en with argument-dependent lookup c:\home\mspacek\Desktop\Work\matplotlib\src\agg_py_path_iterator.h(150) : while compiling class-template member function 'unsigned int SimplifyPathVertexSource::vertex(double *,double *)' with [ VertexSource=transformed_path_t ] src\path.cpp(1115) : see reference to class template instantiation 'SimplifyPathVertexSource' being compiled with [ VertexSource=transformed_path_t ] c:\home\mspacek\Desktop\Work\matplotlib\src\agg_py_path_iterator.h(161) : error C3861: 'round': identifier not found, ev en with argument-dependent lookup c:\home\mspacek\Desktop\Work\matplotlib\src\agg_py_path_iterator.h(217) : error C3861: 'round': identifier not found, ev en with argument-dependent lookup c:\home\mspacek\Desktop\Work\matplotlib\src\agg_py_path_iterator.h(218) : error C3861: 'round': identifier not found, ev en with argument-dependent lookup error: command 'C:\bin\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe' failed with exit status 2 I guess that would require another #include statement somewhere? I'm obviously not a C/C++ guru... round() is defined in math.h so adding #include math.h to the top of the file might fix it. Thanks for your patience! Mike Martin Michael Droettboom wrote: Unfortunately, you're using a compiler I don't have access to. I don't think even the guy that makes the Windows releases (Charlie Moad) uses Visual Studio 2003. That is not to say we don't want VS2003 to work, just that it unfortunately doesn't get much testing and you're hitting the bleeding edge here. If you add -- #include limits to the top of path.cpp, does that resolve the issue? If not, we may need to do some namespace mangling on VS2003 -- Microsoft's docs don't seem to *explicitly* put numeric_limits in the std:: namespace, but in my past experience, std:: is often a synonym for :: in Visual Studio. Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA
Re: [Matplotlib-users] SVG export text grouping on mac
The rcParam svg.embed_chars controls this behavior. I would assume it is set differently on your Windows and Mac boxes. When it is True, rather than outputting text blocks, it embeds the characters as outlines. This means that the fonts do not have to be installed just to view the SVG correctly. The upside is better portability of the file. The downside is that the text can be impossible to edit in tools such as Inkscape or Illustrator. (Using SVG fonts would have been better, but there isn't much support for them in the wild yet). When it is False, regular text blocks are used, but things will look strange (particularly with math text) if the correct fonts are not installed on the viewer's machine. Hope that helps. Mike Kaushik Ghose wrote: Hi Everyone, I'm using matplotlib on mac (matplotlib-0.91.2-py2.5-macosx-10.3-fat.egg) . On windows svg export would have very sensible text grouping. For example an xlabel('Time') when saved to svg results in one text object 'Time'. In the mac version this is saved as 5 separate objects, not text. A little puzzling, and inconvenient. Is there an option somewhere to change this behavior? I'm attaching an example svg. Thanks! -Kaushik - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] SVG export text grouping on mac
Sorry. I mistyped. It's svg.embed_char_paths Cheers, Mike Kaushik Ghose wrote: Hi Mike, Thanks for the tip. I tried it, but I get the following message: Bad key svg.embed_chars on line 294 in /Users/kghose/.matplotlib/matplotlibrc. You probably need to get an updated matplotlibrc file from http://matplotlib.sf.net/matplotlibrc or from the matplotlib source distribution The text is still exported as path. Thanks -Kaushik Michael Droettboom wrote: The rcParam svg.embed_chars controls this behavior. I would assume it is set differently on your Windows and Mac boxes. When it is True, rather than outputting text blocks, it embeds the characters as outlines. This means that the fonts do not have to be installed just to view the SVG correctly. The upside is better portability of the file. The downside is that the text can be impossible to edit in tools such as Inkscape or Illustrator. (Using SVG fonts would have been better, but there isn't much support for them in the wild yet). When it is False, regular text blocks are used, but things will look strange (particularly with math text) if the correct fonts are not installed on the viewer's machine. Hope that helps. Mike Kaushik Ghose wrote: Hi Everyone, I'm using matplotlib on mac (matplotlib-0.91.2-py2.5-macosx-10.3-fat.egg) . On windows svg export would have very sensible text grouping. For example an xlabel('Time') when saved to svg results in one text object 'Time'. In the mac version this is saved as 5 separate objects, not text. A little puzzling, and inconvenient. Is there an option somewhere to change this behavior? I'm attaching an example svg. Thanks! -Kaushik - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] SVG export text grouping on mac
Yes. I'll fix that. Thanks. Kaushik Ghose wrote: Thanks, that worked! Small note, the example matplotlibrc file on the website (http://matplotlib.sourceforge.net/matplotlibrc) as well as the one in the most recent mac OS egg has svg.embed_chars. Thanks -Kaushik Michael Droettboom wrote: Sorry. I mistyped. It's svg.embed_char_paths Cheers, Mike Kaushik Ghose wrote: Hi Mike, Thanks for the tip. I tried it, but I get the following message: Bad key svg.embed_chars on line 294 in /Users/kghose/.matplotlib/matplotlibrc. You probably need to get an updated matplotlibrc file from http://matplotlib.sf.net/matplotlibrc or from the matplotlib source distribution The text is still exported as path. Thanks -Kaushik Michael Droettboom wrote: The rcParam svg.embed_chars controls this behavior. I would assume it is set differently on your Windows and Mac boxes. When it is True, rather than outputting text blocks, it embeds the characters as outlines. This means that the fonts do not have to be installed just to view the SVG correctly. The upside is better portability of the file. The downside is that the text can be impossible to edit in tools such as Inkscape or Illustrator. (Using SVG fonts would have been better, but there isn't much support for them in the wild yet). When it is False, regular text blocks are used, but things will look strange (particularly with math text) if the correct fonts are not installed on the viewer's machine. Hope that helps. Mike Kaushik Ghose wrote: Hi Everyone, I'm using matplotlib on mac (matplotlib-0.91.2-py2.5-macosx-10.3-fat.egg) . On windows svg export would have very sensible text grouping. For example an xlabel('Time') when saved to svg results in one text object 'Time'. In the mac version this is saved as 5 separate objects, not text. A little puzzling, and inconvenient. Is there an option somewhere to change this behavior? I'm attaching an example svg. Thanks! -Kaushik - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] win32 build error in _path.cpp: 'numeric_limits' : is not a member of 'std'
agg_bezier_arc.cpp C:\bin\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe /c /nologo /Ox /MD /W3 /GX /DNDEBUG -IC:\bin\Python25\lib\site-p ackages\numpy\core\include -Iwin32_static\include -I. -IC:\bin\Python25\lib\site-packages\numpy\core\include -Isrc -Iagg 24/include -I. -IC:\bin\Python25\include -IC:\bin\Python25\PC /Tpagg24/src/agg_trans_affine.cpp /Fobuild\temp.win32-2.5\ Release\agg24/src/agg_trans_affine.obj agg_trans_affine.cpp C:\bin\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe /c /nologo /Ox /MD /W3 /GX /DNDEBUG -IC:\bin\Python25\lib\site-p ackages\numpy\core\include -Iwin32_static\include -I. -IC:\bin\Python25\lib\site-packages\numpy\core\include -Isrc -Iagg 24/include -I. -IC:\bin\Python25\include -IC:\bin\Python25\PC /Tpagg24/src/agg_vcgen_stroke.cpp /Fobuild\temp.win32-2.5\ Release\agg24/src/agg_vcgen_stroke.obj agg_vcgen_stroke.cpp C:\bin\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe /c /nologo /Ox /MD /W3 /GX /DNDEBUG -IC:\bin\Python25\lib\site-p ackages\numpy\core\include -Iwin32_static\include -I. -IC:\bin\Python25\lib\site-packages\numpy\core\include -Isrc -Iagg 24/include -I. -IC:\bin\Python25\include -IC:\bin\Python25\PC /Tpsrc/path.cpp /Fobuild\temp.win32-2.5\Release\src/path.o bj path.cpp c:\home\mspacek\Desktop\mpl\src\agg_py_path_iterator.h(98) : warning C4800: 'PyArrayObject *' : forcing value to bool 't rue' or 'false' (performance warning) src\path.cpp(343) : warning C4800: 'long' : forcing value to bool 'true' or 'false' (performance warning) src\path.cpp(538) : warning C4800: 'long' : forcing value to bool 'true' or 'false' (performance warning) src\path.cpp(838) : warning C4800: 'long' : forcing value to bool 'true' or 'false' (performance warning) c:\home\mspacek\Desktop\mpl\src\agg_py_path_iterator.h(160) : error C3861: 'round': identifier not found, even with argu ment-dependent lookup c:\home\mspacek\Desktop\mpl\src\agg_py_path_iterator.h(150) : while compiling class-template member function 'un signed int SimplifyPathVertexSource::vertex(double *,double *)' with [ VertexSource=transformed_path_t ] src\path.cpp(1118) : see reference to class template instantiation 'SimplifyPathVertexSource' being compiled with [ VertexSource=transformed_path_t ] c:\home\mspacek\Desktop\mpl\src\agg_py_path_iterator.h(161) : error C3861: 'round': identifier not found, even with argu ment-dependent lookup c:\home\mspacek\Desktop\mpl\src\agg_py_path_iterator.h(217) : error C3861: 'round': identifier not found, even with argu ment-dependent lookup c:\home\mspacek\Desktop\mpl\src\agg_py_path_iterator.h(218) : error C3861: 'round': identifier not found, even with argu ment-dependent lookup error: command 'C:\bin\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe' failed with exit status 2 -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] legend is not properly drawn when a plot is saved in 'pdf' format
This bug seems to be Cairo-backend specific. The Python PDF backend seems to work fine. Most likely a problem in the Cairo backend and not Cairo itself, but I haven't dug any further. Cheers, Mike Joshua Lippai wrote: I just tested it on OS X using the wxAgg backend, and it appears to be fine. I've atached the pdf image. What GUI are you having matplotlib use? Josh On Wed, Apr 23, 2008 at 8:50 AM, Yong-Duk Jin [EMAIL PROTECTED] wrote: I'm using matplotlib 0.91.2 from ubuntu hardy 8.04 When I saved a plot in a pdf format the legend is not properly drawn. I attached the figure to demonstrate the problem. The legend box(?) is smaller than the legend label. I used the following code to draw this test plot. from pylab import * x = []; y = [] figure(figsize=(2,2)) Angle = '0.0' plot(x,y,label='0.0deg'); axis([0,1,0,1]); legend() savefig('test.pdf') Any comment? -- Yong-Duk Jin - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] problem with dynamic subplots and wx
The clipping rectangle was using inverted y-coordinates (origin at bottom), rather than origin at top. This has been fixed in SVN trunk r5067. FWIW, this seems to be specific to the Wx rendering backend, and doesn't happen with Agg, Gtk, Cairo etc. Cheers, Mike Brian Blais wrote: On Apr 23, 2008, at Apr 23:9:17 PM, Joshua Lippai wrote: I should note that I'm doing this on OS X 10.5.2, but I don't imagine Tiger would have a problem Leopard doesn't have. you do indeed have the problem. If you change the subplot(211) to subplot(111) you'll see the proper plot (a sine wave). For some reason, when you try to subplot with 2 rows and 2 columns (and probably more) the line doesn't appear on the plot. what it should look like, and does with .91.2, is attached. bb -- Brian Blais [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] http://web.bryant.edu/~bblais http://web.bryant.edu/%7Ebblais - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] font always the same in PNG
The font lookup mechanism has been much improved in 0.91.2 -- you may want to try using that. In 0.90.x, often if you don't get a perfectly exact match for a font, it reverts back to the default Vera Sans. Vera Sans, however, is not a fixed-width font. Can you provide the png file of fonts_demo.py so I can be sure of what is happening? One way to diagnose this is to do rc(verbose, level=debug-annoying) which will print out a bunch of stuff related to font lookup. Attach the output here and I'll have a look at it to try to figure out what may be going wrong. Cheers, Mike Paul Smith wrote: Hi all, I've been trying in vain to get a better font on a plot than the fixed width serif one that always appears. I've got lib-freetype6 installed (on Ubuntu server), and ran fc-cache after. The .matplotlib/ttfont.cache contains entries for the Free* fonts. The fonts themselves are in /usr/share/fonts/truetype/freefont. The sample code below would seem (to me) to have used FreeSans, but the png has the same bad looking fixed-serif font. When running the matplotlib examples/fonts_demo.py the result is the same font all over that .png figure too (difference only in sizes). I usually work on XP, and it all works fine there. Does using only Agg as the backend make any difference whatsoever? Paul ubuntu 7.10 python 2.5 matplotlib 0.90.1 Some sample code; import matplotlib from matplotlib import rc rc('font',**{'family':'sans-serif','sans-serif':['Arial','FreeSans']}) matplotlib.use('Agg') from pylab import * plot(arange(100)) ax=gca() ax.set(xlabel='Useless',ylabel='Pointless') draw() show() savefig('test') l=ax.xaxis.get_label() print 'font prop: ',l.get_font_properties() print 'font name: ',l.get_fontname() Produces this output; font prop: (['Arial', 'FreeSans'], 'normal', 'normal', 'normal', 'normal', 12) font name: FreeSans - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users