Re: [Matplotlib-users] Getting started with bar charts
[Again copying to matplotlib-users; maybe the main developers can comment on whether these shortcomings in the getp/setp interface should be fixed.] Hi Derek, It does seem as those these settings affect the top and bottom of the graph - I was wondering if it was possible to show tickmarks along the bottom edge but not the top edge? I don't think that's directly supported. Here's a hacky way to do it: lines = getp(gca(), 'xticklines') toplines = [ l for l in lines if getp(l, 'ydata') == (1,) ] setp(toplines, visible=False) How I came up with this: I knew that I wanted to make some of the xticklines invisible, so I looked at the list of line objects for clues as to what differs between them. They seem to have xdata and ydata properties, and ydata is (0,) for half of the lines and (1,) for the other half, so it looks like it is the vertical position in axis coordinates. (xdata seems to be in data coordinates.) And the other property I do not see on the list is the one that shows whether a tick goes into the graph or just out - in the prc file, there is a line: xtick.direction : in # direction: in or out but there is no direction' property? You're right, there is no obvious property to control this. Here's an even hackier way to do this (and one that doesn't look very future- proof): for l in getp(gca(), 'xticklines'): setp(l, 'marker', 5-getp(l, 'marker')) The line objects have a marker property, which is 2 for some markers and 3 for the others... so I guessed that one of them means upwards and the other downwards, and checked this guess by flipping the xtick.direction parameter and looking again. So subtracting the marker from 5 flips the direction. I wonder how this is done in Matlab? label: any string which shows me that the Yaxis has a label - in this case a string - but I do not see how one can set the font properties for the Yaxis label as it is not Text object?? I think you cannot do this with setp alone. Use the ylabel command: ylabel('foo bar', fontsize=18) -- Jouni - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How to use logarithmic scale with histogram?
Mika Orajärvi [EMAIL PROTECTED] writes: This code does seem to draw some kind of histogram but it would be much more usefull to have at least the y-scale as logarithmic. But I haven't found a way to make the scale logarithmic. According to the docstring of hist you can give it a keyword argument of log=True to make the y axis logarithmic. However there is a slight bug in that zero-height histogram bars like you have in your example cause log(0) to be computed. Here's a quick fix: from pylab import * x=0.000925,0.000879,0.000926,0.00088,0.001016,0.000931,0.000927,0.00088,\ 0.000926,0.000926,0.000879,0.0009 n, bins = mlab.hist(x, 1000) width = 0.9 * (bins[1]-bins[0]) nz = nonzero(n) bar(bins[nz], n[nz], width=width, log=True) grid(True) show() If the devs agree that this is a bug in hist, I can fix it in svn. -- Jouni K. Seppänen http://www.iki.fi/jks - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Symbols below a figure
Nils Wagner [EMAIL PROTECTED] writes: I have upgraded matplotlib via svn. Then you probably should be following the developers' mailing list as well as this one. According to the thread about build_ext --inplace, the mpl-data directory is undergoing a restructuring in svn, and apparently not everything is finished yet. I surmise that this is causing your problems. -- Jouni K. Seppänen http://www.iki.fi/jks - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] setting the default line style order
The question of setting the color and line style sequences comes up every now and then, and although there are neat solutions like Fernando demonstrated, perhaps we should add support for them to matplotlib. The Matlab interface seems to be like this: figure set(gca, 'LineStyleOrder', '-o|-x|-^') % sequence of three line styles set(gca, 'ColorOrder', [1 0 0; 0 0 1]) % sequence of two colors (red and blue) set(gca, 'NextPlot', 'replacechildren') % don't reset the properties I just set plot(random(6)) This plots six lines with different combinations of style and color; the seventh line would look the same as the first. Probably you can avoid the NextPlot thing by setting DefaultLineStyleOrder on the root handle, but never mind. So, to make the interface familiar to Matlab users, I suggest to add properties line.linestyleorder and line.colororder that can take any sequences of linestyles and colors, or an n-by-3 array of rgb color values for the latter. I think the |-separated linestyles spec is a hack (necessary in Matlab because it cannot have vectors of strings because of the auto-flattening matrices) that we shouldn't emulate. How does that sound? -- Jouni K. Seppänen http://www.iki.fi/jks - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] setting the default line style order
Eric Firing [EMAIL PROTECTED] writes: Jouni K. Seppänen wrote: So, to make the interface familiar to Matlab users, I suggest to add properties line.linestyleorder and line.colororder Are you talking about Axes properties (instance attributes) or rcParam entries or both? In any case, I agree that built-in support would easy to provide and would help enough people to be worthwhile. I was thinking about rcParam entries, but now that you mention it, Axes properties would make more sense. -- Jouni K. Seppänen http://www.iki.fi/jks - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Unifying numpy, scipy, and matplotlib docstring formats
Barry Wark [EMAIL PROTECTED] writes: Yes, I agree. I wasn't coming at so much from the goal of making Pylab a Matlab clone (as you point out, that's silly, and misses much of the advantage of Python), but rather from the goal of making interactive use as efficient as possible. When I fire up ipython -pylab to do some quick exploration, it's nice not to have to type N.blah or pylab.plot IMHO the greatest strength of Matlab in interactive use is the matrix input format. For one thing, it is easier to type something like [0 1 0; 1 0 0; 0 0 1] than array([[0,1,0],[1,0,0],[0,0,1]]) Granted, you can often leave out the array() wrapper, but typing all the commas and brackets and getting the nesting right slows me down enough that using Python feels like tedious work where Matlab is more like an Emacs-like extension of the mind. Another neat feature is auto-flattening: to e.g. add row- and column-wise sums and a grand total to a matrix M, you can type [M sum(M,2); sum(M,1) sum(M(:))] compared to which the r_[] and c_[] syntax feels like an ugly hack. (Of course, the auto-flattening feature is a disaster for serious programming (as opposed to quick interactive work), so Matlab has added cell arrays which don't auto-flatten, leading to no end of confusion between [] and {} indexing and the need to add {:} in seemingly random spots in Matlab code.) I suppose these things could be addressed quite neatly by IPython. It could even modify your history similarly to what it currently does with the %magic commands, so that when you type a = [0 1 0; 1 0 0; 0 0 1] and then examine your history, you see a = array([[0,1,0],[1,0,0],[0,0,1]]) which you could copy-paste into the program you are developing. Perhaps the namespace issue could also be addressed at the IPython level. The pylab profile could import the various packages, perhaps with some kind of abbreviated names, and rewrite commands like a = array(...) plot(sin(a)) to a = numpy.array(...) pylab.plot(numpy.sin(a)) so again you could copy/paste from the history to an editor and get correctly Pythonic code without any from ... import *. Probably a 100% solution is quite difficult because of the dynamic features in Python, but it seems to me that a 80% solution should be feasible. (Parse the input to an AST using the parser facility in the Python library, use a tree walker to find all references to functions or variables, and if they don't exist in locals() or globals() and are not the target of an assignment anywhere in the AST, replace them by references to the appropriate package.) -- Jouni K. Seppänen http://www.iki.fi/jks - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] PDF and accentued characters
Lionel Roubeyrie [EMAIL PROTECTED] writes: sorry to resend this problem, I didn't have any response and the problem always exists, all accentued characters are set to ? when I save figures in pdf format. Does someone have a solution to that? Does saving the figure as eps and converting to pdf work for you? The pdf backend doesn't support unicode, since I've never been able to really understand how encoding strings in pdf works. (Nicolas Grilly's recent patch fixed something related to encodings, so perhaps he understands them better?) Patches are of course welcome. I'm afraid I'm currently too busy with my day job to do any major hacking on the pdf backend. -- Jouni K. Seppänen http://www.iki.fi/jks - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] PDF and accentued characters
Lionel Roubeyrie [EMAIL PROTECTED] writes: Le Lundi 26 Février 2007 14:20, Darren Dale a écrit : What are you using to do the conversion? epstopdf should maintain the integrity of the fonts. epstopdf should maintain... but not, it doesn't do that! What exactly is the problem with the converted pdf file? Try opening it in Adobe Reader and viewing Document Properties / Fonts. Do you see any Type 3 fonts, and what are their names? -- Jouni K. Seppänen http://www.iki.fi/jks - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] invalidrestore
[EMAIL PROTECTED] writes: Back to the subject at hand. Using PNG files works but brings with it other problems and so I would really appreciate a resolution to this invalidrestore issue. I can't use PDF because I have to embedd the plots in a Word document. Not sure what SVG is (I'll look it up). In my (admittedly limited) experience Word handles pdf files much better than eps files. I just tried (in MS Word 2004 for Mac) Insert / Picture / From File and selected a file produced by Matplotlib's pdf backend, and Word seems to embed it just fine. (I can't test printing right now, though.) -- Jouni K. Seppänen http://www.iki.fi/jks - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] PDF and accentued characters
Lionel Roubeyrie [EMAIL PROTECTED] writes: Fonts are BitStream VeraSans-Roman, TrueType. Then this is not the usual font problem where fonts get converted either into Type 3 or into raw drawing commands. Can you put example files (both eps and pdf) on some website so we can try to understand what is wrong with them? -- Jouni K. Seppänen http://www.iki.fi/jks - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] PDF and accentued characters
Lionel Roubeyrie [EMAIL PROTECTED] writes: Oups, sorry for the mistake, the Vera font in the resulting pdf file from epstopdf is effectively converted to T3Font_0 Type 3. You can have a look here: http://www.limair.asso.fr/share/pre2.eps and http://www.limair.asso.fr/share/pre2.pdf The Type 3 font is present in the eps file, so it is not created by the conversion to pdf. Perhaps it is an artifact of the distilling done by matplotlib; if you set ps.usedistiller to None, what does the eps file look like? Somehow the Cmr and Cmmi fonts survive as TrueType. One quick workaround for your problem could be to turn all text into mathtext: replace e.g. février by r$\rm{f\'evrier}$ and for the yticklabels do something like (caveat: untested code) for x in getp(gca(), 'yticklabels'): setp(x, 'text', r'$\rm{%s}$' % getp(x, 'text')) (Or is there an easier way to select Computer Modern Roman as the font?) -- Jouni K. Seppänen http://www.iki.fi/jks - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] invalidrestore - PDF
[EMAIL PROTECTED] writes: a) 2.3 doesn't have the sorted function - it uses a .sort() function. So, I had to change line 487 from: I think this was taken care of by Nicolas Grilly's recent patch. b) No update() function (line 396) for (name, value) in self.markers.items(): xobjects[name]=value[0] Applied in svn, thanks! After that, I got my pdf file. However, if I print the PDF directly, works fine but when I create an object link to the PDF and print from inside Word, the printout is degraded (kind of fuzzy with texts). That sounds to me like a bug in Word (as does the invalidrestore thing). -- Jouni K. Seppänen http://www.iki.fi/jks - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How to make figures transparent by default, leave foreground color to pdflatex?
Anand Patil [EMAIL PROTECTED] writes: - How can I make my figures and axes transparent by default? Here's one idea: In [1]:fig=figure(frameon=False) In [2]:ax = fig.add_subplot(111, frameon=False) In [3]:ax.plot([3,1,4,1,5,9,2]) Out[3]:[matplotlib.lines.Line2D instance at 0x2c98b70] In [4]:show() In [5]:savefig('foo.pdf') And here's another: In [20]:fig=figure() In [21]:fig.figurePatch.set_alpha(0.1) In [22]:ax=fig.add_subplot(111) In [23]:ax.axesPatch.set_alpha(0.1) In [24]:ax.plot([3,1,4,1,5,9,2]) Out[24]:[matplotlib.lines.Line2D instance at 0x16f7e490] In [25]:show() In [26]:savefig('foo.pdf') Does either of these do what you are looking for? - When I inserted some of my old pdf plots into a latex presentation, to my surprise their foreground color had changed from black to the color of the text in the presentation. Is there a way to signal to Matplotlib that I would like this to happen? Can I make this behavior default? Were the old pdf plots produced with the pdf backend, or with the eps backend and then converted to pdf with some external utility? I'm guessing that what happened was that the pdf file didn't specify any color, and when it was included, it inherited the graphics state from the including pdf file. I'm not quite sure if that's supposed to happen when including files, although I can of course see how it could be considered a useful feature. Certainly there is no such intended feature in matplotlib. I think I could support it for monochromatic plots quite easily, but it would be much trickier if you want part of the plot in the inherited color and another part in a specified color. -- Jouni K. Seppänen http://www.iki.fi/jks - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How to make figures transparent by default, leave foreground color to pdflatex?
Jouni K. Seppänen [EMAIL PROTECTED] writes: Anand Patil [EMAIL PROTECTED] writes: - When I inserted some of my old pdf plots into a latex presentation, to my surprise their foreground color had changed from black to the color of the text in the presentation. Is there a way to signal to Matplotlib that I would like this to happen? Can I make this behavior default? Certainly there is no such intended feature in matplotlib. I think I could support it for monochromatic plots quite easily, I added a new rc parameter pdf.inheritcolor to enable this. You will probably want to disable the figure and axes frames if you use it, as both the fill and stroke colors will be inherited from the surrounding environment, and the frames are filled by default. I got some error messages from svn, but it looks like the change is now there. (To check, see if CHANGELOG has an entry for 2007-03-02 describing this change.) -- Jouni K. Seppänen http://www.iki.fi/jks - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Axes label
[EMAIL PROTECTED] writes: Somebody at the usenet suggested that I play with the ticker formatter and locator. While that helped the multi-color sample I cited, it didn't help in my plots. The formatter only controls how the y-axis labels are formatted, whereas AFAIK the locator only affects the values of the ymajor and yminor. This works for me: figure() gca().yaxis.set_major_locator(LinearLocator()) x=arange(0, 7, 0.01) plot(sin(x)) gca().set_ylim((-1.1,1.1)) show() -- Jouni K. Seppänen http://www.iki.fi/jks - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How to draw a straight line?
[EMAIL PROTECTED] writes: How do I draw a line going from point A to point B on a figure (not plot reference frame), with a particular color and style? Give a transform=gcf().transFigure argument to plot: http://www.scipy.org/Cookbook/Matplotlib/Transformations If your line goes outside the axes, you will want to do something like l=plot([...], [...], transform=gcf().transFigure) setp(l, clip_on=False) For some reason the clip_on keyword argument to plot does not have an effect. This is probably a bug. -- Jouni K. Seppänen http://www.iki.fi/jks - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] errorbar() makes a LOT of lines
Jack Sankey [EMAIL PROTECTED] writes: The problem is when I do errobar() I get not only the data lines, but also a bunch of small lines for drawing the error bars, and it's very difficult to sort them all out to get at the data of the plot. One possibility could be to change the return value of errorbar() from the current unstructured list of lines to e.g. a dict of lists of lines, so you could modify them separately. Here is a patch of mine that did this for boxplot (and was accepted): http://sourceforge.net/tracker/index.php?func=detailaid=1364810group_id=80706atid=560722 Would something like this help with your problem? -- Jouni K. Seppänen http://www.iki.fi/jks - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] trouble with rcParams
Jeff Peery [EMAIL PROTECTED] writes: I am having some confusion about how best to set my plot settings. Should I use rcParams, or carry around my own class object holding plot() and scatter() settings? IMHO modifying rcParams is not a good way to use the object-oriented interface. It can be very useful for interactive plotting using the (state-machine) pylab interface, but such non-explicit state can make an object-oriented program difficult to follow. Of course rcParams is needed for things like selecting fonts. 1) from what I read, I expected a rcParams value to keep if I closed my app then reopened it. But it went back to some default... maybe the matplotlibrc file? are these things separate? rcParams is initialized from the matplotlibrc file. 2) when I changed the rcParams for my line style (for example) ALL line styles changed not just the lines in plot(). If you want more detailed control, I think you have to use the keyword arguments (or set the equivalent properties on the line objects). 3) I didn't see a rcParams object for the scatter() parameters, markers size, style, color, linewidth etc. Is this possible? I think the patch.* parameters affect the markers created by scatter(). -- Jouni K. Seppänen http://www.iki.fi/jks - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plots into multi-page pdf
[EMAIL PROTECTED] writes: I am using matplotlib to create single page plots and the whole process works fine. However, when I am done, I end up with lots of single page pdf files. Is there a way to get matplotlib to combine them all into a single PDF file? No, at least not currently. Tools that can do this include pdftk and pdfTeX; in pdfTeX the easiest way to go is probably to use the pdfpages package. http://www.accesspdf.com/pdftk/ http://www.tug.org/applications/pdftex/ http://www.ctan.org/tex-archive/macros/latex/contrib/pdfpages/pdfpages.pdf I tried using another package PyPDF but ended up with either file I/O problems or too many file opened problem. I was not aware of PyPDF, but it looks like it is being actively developed. Perhaps you could submit a bug report to the author of PyPDF? -- Jouni K. Seppänen http://www.iki.fi/jks - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] PDF backend problem
[EMAIL PROTECTED] writes: Now, I am running into another problem. Everything works fine up to 8 page plots. Starting with the 9th page, MPL chokes at line 1084 in backend_pdf.py and couldn't find the cooresponding ttf file (VeraSe.ttf) but it had no problem reading that file for the first 8 plots. Does the following change help with this? (If you are following svn, just run svn update; otherwise, the easiest way is to replace line 1084 by the three lines prefixed with + below.) Index: backend_pdf.py === --- backend_pdf.py (revision 3044) +++ backend_pdf.py (revision 3045) @@ -1081,7 +1081,9 @@ font = self.afm_font_cache.get(key) if font is None: filename = fontManager.findfont(prop, fontext='afm') -font = AFM(file(filename)) +fh = file(filename) +font = AFM(fh) +fh.close() self.afm_font_cache[key] = font return font -- Jouni K. Seppänen http://www.iki.fi/jks - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Rotating a subplot counter-clockwise 90 degrees?
David Fokkema [EMAIL PROTECTED] writes: basically a horizontal cumulative histogram, apart from the fact that the plot should be rotated 90 degrees counter-clockwise. Does hist(..., orientation='horizontal') look right? -- Jouni K. Seppänen http://www.iki.fi/jks - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] PDF Backend problem still unresolved
[EMAIL PROTECTED] writes: Starting with the 9th page, MPL chokes at line 1084 in backend_pdf.py Jouni posted a couple of responses witih suggestions in CVS syntax but I was unable to use that information. I had to take my laptop to be to be repaired, so I can't do much work on Matplotlib right now. In the meantime, please post some more information: what version of Python and Matplotlib is this, on which platform, can you reduce your code to a small example that exhibits the bug, what output do you get with verbose.level: debug? -- Jouni - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] savefig problems
Dominik Szczerba [EMAIL PROTECTED] writes: I want bright information (fonts,lines) on dark background (figure bg, axes bg) and I can fully achieve this goal while DISPLAYING plots. However, SAVING damages their colors The following works for me (svn revision 3159): figure(facecolor='k') subplot(111, axisbg='k') plot([3,1,4,1,5,9,2], color='w', lw=2) savefig('foo.png', facecolor='k') savefig('foo.pdf', facecolor='k') ingloriously (I could not trace down the rule what is aimed to be achieved) and tweaking the two options in the example matplotlibrc (savefig.facecolor and savefig.edgecolor) would not help. The following works for me: rc('savefig', facecolor='k') savefig('foo.png'); savefig('foo.pdf') Perhaps this has been fixed by somebody between your question and now. If you are still having problems, could you be more specific about how you are trying to accomplish your goal? -- Jouni K. Seppänen http://www.iki.fi/jks - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Histogram align 'edge' or 'center' bug?
David Fokkema [EMAIL PROTECTED] writes: If I choose center, the result is that my histogram is calculated for edge values but the bars are placed at center values which is completely misleading and wrong! I'd say this is a bug, but I may be overlooking something here... Looks like a bug to me. Could you file it at http://sf.net/tracker/?group_id=80706atid=560720 so it isn't forgotten? -- Jouni K. Seppänen http://www.iki.fi/jks - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Dendrogram
Timothy [EMAIL PROTECTED] writes: Hope this isn't a sore subject, but are there ways with Matplotlib to generate dendrograms? I have no idea why it should be a sore subject, but there seems to be nothing built in for drawing dendrograms. I'm sure contributions will be welcomed. :-) I guess the first task is to think about how to specify the input. Matlab's dendrogram function takes a three-column matrix where the first two columns encode a binary tree and the third column holds the cluster distances. I think a more intuitive interface should be possible in Python. -- Jouni K. Seppänen http://www.iki.fi/jks - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] a bug in tex formatting?
johann cohen-tanugi [EMAIL PROTECTED] writes: If I do r'$A\tilde{B}$' the tilde is actually on the A !! It doesn't do that for me. Either this has been fixed between your question and now, or it depends on the specifics of your environment. The following simple test puts the tilde on B in both cases: In [22]:rcParams['text.usetex'] Out[22]:False In [23]:text(0,0,r'$A\tilde{B}$') Out[23]:matplotlib.text.Text instance at 0x17b814e0 In [24]:text(1,0,r'$A\tilde B$') Out[24]:matplotlib.text.Text instance at 0x17b81508 This is with the TkAgg backend and current svn version of matplotlib. What does this experiment produce for you? However, the following might be considered a bug: In [28]:text(1,1,r'$A\tilde{}B$') --- exceptions.ValueErrorTraceback (most recent call last) /private/tmp/ipython console ... ValueError: unrecognized symbol \tild I think John Hunter once said that Matplotlib's mathtext attempts to support a subset of LaTeX syntax, and any inconsistencies within that subset should be considered bugs. Admittedly it doesn't seem very likely that someone wants to but a raised tilde between two letters, but the error message indicates that the parsing is somehow very different from TeX. -- Jouni K. Seppänen http://www.iki.fi/jks - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] .notdef (was: a bug in tex formatting?)
johann cohen-tanugi [EMAIL PROTECTED] writes: Actually, I have other problems : I cannot save in many formats. The bmp is deemed usueless by gimp, I didn't even know you can save in bmp format. Does png format work better? and ps and eps save options gives the following error message (I am using matplotlib-0.90 on python/ipython 2.4) : In [1]: show() --- exceptions.ValueErrorTraceback (most recent call last) [...] /usr/lib/python2.4/site-packages/matplotlib/mathtext.py in _get_info(self, font, sym, fontsize, dpi) 748 num = 0 749 sym = '.notdef' -- 750 raise ValueError('unrecognized symbol %s, %d' % (sym, num) ) 751 filename = os.path.join(self.basepath, basename) + '.ttf' 752 if filename not in bakoma_fonts: ValueError: unrecognized symbol .notdef, 0 Not a very useful error message, given that it sets the values of the sym and num variables just before reporting the error. In current svn the line corresponding to your 749 is commented out, so if you could try either with the svn version or just comment out the line in your version, you would get a more useful diagnostic. The code looks like if latex_to_bakoma.has_key(sym): ... elif len(sym) == 1: ... else: ... raise ValueError(...) so it looks like you have used a symbol that mathtext doesn't know about and that isn't a single letter. I'm guessing that could mean a misspelled backslash command or a parsing problem like I mentioned in my previous email where \tilde{} is seen as \tild. -- Jouni K. Seppänen http://www.iki.fi/jks - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] AttributeError: LineCollection instance has no attribute 'get_lines'
Nils Wagner [EMAIL PROTECTED] writes: File /usr/lib64/python2.4/site-packages/matplotlib/legend.py, line 357, in _auto_legend_data hlines = handle.get_lines() AttributeError: LineCollection instance has no attribute 'get_lines' It seems that get_lines() was removed from LineCollection in revision 2052 by Eric Firing: | r2052 | efiring | 2006-02-11 22:56:42 +0200 (Sat, 11 Feb 2006) | 3 lines | | Add autolim kwarg to axes.add_collection; change get_verts() | methods of collections accordingly. Perhaps Eric knows best how to fix _auto_legend_data()? -- Jouni K. Seppänen http://www.iki.fi/jks - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] AttributeError: LineCollection instance has no attribute 'get_lines'
Eric Firing [EMAIL PROTECTED] writes: In any case, thanks for bringing the legend/LineCollection bug to my attention. This is the sort of thing it is nice to get cleaned up before the next release, coming soon. Do you know of some other simple bugs like this we should look at ASAP? Of the bugs listed at http://sf.net/tracker/?group_id=80706atid=560720 I suspect a few would be simple to fix: 1671570 Invalid CSS 2 styles in SVG output 1650523 inconsistent use of tabs and spaces in indentation 1605288 import pylab with python -OO -- Jouni K. Seppänen http://www.iki.fi/jks - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] AttributeError: LineCollection instance has no attribute 'get_lines'
Jouni K. Seppänen [EMAIL PROTECTED] writes: Eric Firing [EMAIL PROTECTED] writes: Do you know of some other simple bugs like this we should look at ASAP? Of the bugs listed at http://sf.net/tracker/?group_id=80706atid=560720 I suspect a few would be simple to fix: Also I'm not at all sure that my solution to the Circle problem is correct: http://thread.gmane.org/gmane.comp.python.matplotlib.devel/2667/focus=2670 -- Jouni K. Seppänen http://www.iki.fi/jks - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Histogram align 'edge' or 'center' bug?
David Fokkema [EMAIL PROTECTED] writes: I fixed the bug, I think. At least it's working on my system and I think it is not invasive. Comments please? I'll send it upstream otherwise... Does this handle the case where the user has specified bins of different widths? It looks like you are only using the width of the first bin: +if align == 'center': + hw = .5*(bins[1]-bins[0]) + nbins = [x-hw for x in bins] +else: + nbins = bins At least, I've always thought that unequal bins are allowed, but from the following it seems that the probability density support also makes an incompatible assumption: if normed: - db = bins[1]-bins[0] + db = nbins[1]-nbins[0] return 1/(len(y)*db)*n, bins -- Jouni K. Seppänen http://www.iki.fi/jks - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Histogram align 'edge' or 'center' bug?
David Fokkema [EMAIL PROTECTED] writes: I can't think of an application where you have bins of different widths and you want to center the values... Actually, now that I think about it, there is not enough information in the bin centers to know the widths of the bins if they may vary. For example, if your bin edges are (2, 4, 8, 16, 32) or (1, 5, 7, 17, 31), you get the same bin centers (3, 6, 12, 24). Perhaps it's best to disallow variable-width bins when align='center'. -- Jouni K. Seppänen http://www.iki.fi/jks - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Translating ticks a la MultipleLocator ?
Iyer [EMAIL PROTECTED] writes: With all respect, I have certainly perused the tutorials before posting the question. From your postings it seems that you are misunderstanding some fundamental concepts, but it is not clear how. Can you write up a little piece of code showing what you are doing now, and explain how you would like the output changed? Just make up some data and plot it, and point out what is wrong about the result. As an example of how to phrase your question, here is how I would write the question I thought you were trying to communicate a few emails ago: -- The following script makes an otherwise good plot, but I want the x-axis to go from 0 to 1, not 0 to 10. How do I do this? x = arange(0,10,0.5) y = sin(x) plot(x,y) -- The best answer to *that* question, which you got from John Hunter, is to change the script to the following: x = arange(0,10,0.5) y = sin(x) dt = 1.0/10 plot(x*dt,y) Since you say that this does not solve your problem, that must not have been the question you intended to ask. Perhaps rephrasing the question using a code example would help make your point clearer. -- Jouni K. Seppänen http://www.iki.fi/jks - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Omitting curves from a legend
Bill Baxter [EMAIL PROTECTED] writes: Documentation issue/question: I figured there was probably some way to set attributes individually using the return value from contour since contour's docstring helpfully tells me that countour returns a ContourSet object. However, 'ContourSet?' in ipython gives me nothing. Similarly with plot(), it says it returns a 'list of lines' but that is not so useful since I can't look up the docstring for 'list of lines'. Call setp on the returned object: In [8]:y = plot(sin(arange(10))) In [9]:setp(y) alpha: float animated: [True | False] antialiased or aa: [True | False] axes: unknown ... xdata: array ydata: array zorder: any number And similarly: In [11]:z = contour(outerproduct(arange(10), arange(10))) In [12]:setp(z) alpha: unknown array: unknown clim: a length 2 sequence of floats cmap: a colormap colorbar: unknown label_props: unknown norm: unknown Or, in ipython you can type z.set_TAB to see the completions. With the list returned from plot you cannot simply type y[0].set_TAB but have to assign the value of y[0] to a variable first. -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] pylab.setp - expected behaviour?
Matthias Michler [EMAIL PROTECTED] writes: The result really surprises me (using module time): time plot 9.7 sec time setp 9.9 sec- slower than plot! time .set 5.0 sec So my question is: Is this the expected / desired behaviour? I think it is not surprising. The setp function (and much of the pylab interface in general) is designed for convenience in interactive use, and thus it handles various useful cases such as a list of objects as the first argument, and different ways to specify properties (e.g. setp(object, prop='value') and setp(object, 'prop', 'value')). Eventually it does the equivalent of (getattr(object, 'set_%s'%prop))(value) which is obviously much slower than the direct object.set_prop(value) So, if you are writing a program, you are better off using the OO interface. -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] creating a blank graph with room for hand written tick labels.
Ryan Krauss [EMAIL PROTECTED] writes: I am writing a final exam and I want my students to sketch a graph of something and label the plot themselves. So, I need to create an axis with x and y labels, but with no tick marks. This I can do, but creating blank tick marks seems to get rid of the space where the students would write in their own tick marks. A quick hack would be to make non-blank tick marks but cause them to be invisible in another way, e.g. by setting alpha=0 or color='w': yticks(arange(-5,5.2),['0']*10,alpha=0) xticks(arange(1,10),['0']*10,alpha=0) -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] usetex with svg or pdf (was: SVG vs PNG)
Steve Schmerler [EMAIL PROTECTED] writes: I was wondering: Is it (technically) possible to have .svg export capabilities with usetex-support and if so, has there been no need for this feature so far The usetex feature is implemented for the Agg backend (i.e., png output) using dvipng, and for the PostScript backend using (I think) dvips with psfrag, and neither of these is easily generalizable to work with svg or pdf. However, some time ago I committed the beginnings of a dvi parser and a little support code in the pdf backend, enough to get a small demo almost working: http://article.gmane.org/gmane.comp.python.matplotlib.devel/2687 I have no idea how difficult it would be to get this working in the svg backend, but in the pdf backend the biggest hurdle is probably in generalizing the current font support so that the TeX fonts can be embedded. -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] usetex with svg or pdf
Jochen Küpper [EMAIL PROTECTED] writes: for the PostScript backend using (I think) dvips with psfrag, and neither of these is easily generalizable to work with svg or pdf. What's the problem of using dvi2pdf, dvipdfm, dvipdfmx, or soemthing like that for PDF? Looks quite similar to the dvips route for Postscript to me? The dvips route is not so simple. First matplotlib creates the PostScript file with all text strings replaced by tags, and this is fed to LaTeX using \includegraphics. The psfrag package replaces the tags with LaTeX constructs, and then the dvi file is converted using dvips into the final postscript file. There is no equivalent to psfrag that works with pdf (at least none that I know of). Probably you could create a pdf file without any texts and input that in your LaTeX file, and then -- with sufficient LaTeX-fu -- render the text strings at the correct positions, and run the LaTeX file through pdflatex, because pdftex includes a pdf parser so that you can do \includegraphics{foo.pdf}. So in that sense it may be generalizable, but it won't be a direct port of the ps backend. -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] removing all padding / white space around plot
Allen Beye Riddell [EMAIL PROTECTED] writes: I'd like to remove the whitespace, padding, offset, etc on the left and right of the plot as I'm writing the entire thing to a jpg. I've turned the frame, axes, ticks off, but the space still remains. [...] ax = fig.add_subplot(111) Replace this line by ax = fig.add_axes((0,0,1,1)) The default subplot axes leave some space for tick labels etc., but this gives you axes spanning the full figure. -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] legend breaks clf()
Norbert Nemec [EMAIL PROTECTED] writes: Thanks for the hint. I just fixed the problem in SVN. I thought I had fixed this in March... see http://thread.gmane.org/gmane.comp.python.matplotlib.devel/2574 But that was the get_handles() in legend.py, while this one is in axes.py. Probably the code was originally copied from one place to the other, but the functions have diverged since: one copy has had this bug fixed, the other has been extended to handle RegularPolyCollections. Perhaps get_handles() should be promoted from internal function to a method of Axes? Also, if someone were interested in creating a unit test suite for matplotlib, a good way to start could be to identify the intended types of member variables (e.g. list of Line2D objects), run various example scripts and check that the variables have the correct kind of data. -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] keeping zoom...
fred [EMAIL PROTECTED] writes: imshow(rand(50,50)) then zoom with the mouse and redo imshow(rand(50,50)) the zoom factor is not kept, ie xrange/yrange are still (0,50). How can I keep the zoom factor ? Try: imshow(rand(50,50)) # zoom with mouse xlim=getp(gca(), 'xlim'); ylim = getp(gca(), 'ylim') imshow(rand(50,50)) setp(gca(), 'xlim', xlim); setp(gca(), 'ylim', ylim) -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Font problem saving [e]ps
Giorgio F. Gilestro [EMAIL PROTECTED] writes: Another bug, though, comes with backend_pdf.py The function embedPDF in the class PdfFile has a call to encodings.cp1252.decoding_map[charcode] I believe this was fixed by Michael Droettboom in svn revision 3450. You can apply the patch to your copy if you don't want to use in-development versions: Index: backend_pdf.py === --- backend_pdf.py (revision 3449) +++ backend_pdf.py (revision 3476) @@ -500,11 +500,20 @@ # composite font, based on multi-byte characters. from encodings import cp1252 -firstchar, lastchar = 0, 255 +# The decoding_map was changed to a decoding_table as of Python 2.5. +if hasattr(cp1252, 'decoding_map'): +def decode_char(charcode): +return cp1252.decoding_map[charcode] or 0 +else: +def decode_char(charcode): +return ord(cp1252.decoding_table[charcode]) + def get_char_width(charcode): -unicode = cp1252.decoding_map[charcode] or 0 +unicode = decode_char(charcode) width = font.load_char(unicode, flags=LOAD_NO_SCALE).horiAdvance return cvt(width) + +firstchar, lastchar = 0, 255 widths = [ get_char_width(charcode) for charcode in range(firstchar, lastchar+1) ] widthsObject = self.reserveObject('font widths') -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] savefig pdf doesn't work anymore
Lionel Roubeyrie [EMAIL PROTECTED] writes: I've got a problem with saving plots in pdf format like you can see in the following output. It seems encodings.cp1252 doesn't have a decoding_map method (but a decoding_table one). Is it a bug or a problem in my encodings file? It's a bug, fixed in svn some time ago. Here's the patch if you want to fix it in your version: Index: backend_pdf.py === --- backend_pdf.py (revision 3449) +++ backend_pdf.py (revision 3476) @@ -500,11 +500,20 @@ # composite font, based on multi-byte characters. from encodings import cp1252 -firstchar, lastchar = 0, 255 +# The decoding_map was changed to a decoding_table as of Python 2.5. +if hasattr(cp1252, 'decoding_map'): +def decode_char(charcode): +return cp1252.decoding_map[charcode] or 0 +else: +def decode_char(charcode): +return ord(cp1252.decoding_table[charcode]) + def get_char_width(charcode): -unicode = cp1252.decoding_map[charcode] or 0 +unicode = decode_char(charcode) width = font.load_char(unicode, flags=LOAD_NO_SCALE).horiAdvance return cvt(width) + +firstchar, lastchar = 0, 255 widths = [ get_char_width(charcode) for charcode in range(firstchar, lastchar+1) ] widthsObject = self.reserveObject('font widths') -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] text element mixed coordinate systems
Matthew Auger [EMAIL PROTECTED] writes: Hi...I'm interested in plotting text elements with the X value in data coordinates and the Y value in axis coordinates See http://www.scipy.org/Cookbook/Matplotlib/Transformations. -- Jouni K. Seppänen http://www.iki.fi/jks - 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] Latex, Labels and PDF
John T Whelan [EMAIL PROTECTED] writes: Shouldn't rsome label text ($\mu V$) work? It doesn't work in any released version, but it seems that Michael Droettboom's recent mathtext improvements include this (and much more). -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] pdf saving on OS X
Brian Blais [EMAIL PROTECTED] writes: and it works with pylab. But, if I use matplotlib.Figure directly in an app, and then call: myfig.savefig('blah.pdf') it saves it as 'blah.pdf.jpg', a jpeg file. Sounds like you are using a backend other than the pdf one. Can you write up a complete example of code that behaves like you describe? -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Discrete legend
Jose Gomez-Dans [EMAIL PROTECTED] writes: I realise that the legend class has some support for patches, but how does one go about using them? I can't just add a legend (I get a very messy legend, one for every patch in my plot). Pass to the legend command a list of patches, and the legend will only show those patches. Here's a quick example: #!/usr/bin/env python from numpy import * from pylab import * from matplotlib.patches import Polygon square = array([[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0]]) reds=[] for x,y in (0,0),(2,0),(1,1): reds.append(Polygon(square+(x,y), fc='red')) blues = [] for x,y in (1,0),(0,1),(2,1): blues.append(Polygon(square+(x,y), fc='blue')) for p in reds+blues: gca().add_patch(p) axis((0,3,0,3)) legend([reds[0], blues[0]], ['foo', 'bar']) show() In the example there are six patches, but only two are passed to legend, and those two are shown in the result. -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] pdf saving on OS X
Brian Blais [EMAIL PROTECTED] writes: This is the smallest example I can write. I am embedding the figure in a wx window. In this test case, I print (successfully) a PNG and EPS, but the PDF doesn't work (gets a .jpg attached to the end). Right. It seems that the wx backend has special cases for postscript and svg but not pdf, and for some reason defaults to jpeg format when it cannot determine which format was needed. Here's a workaround for now: binDkASyCT9Gy.bin Description: application/python -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Crashing with a St8bad_cast
Steve Lianoglou [EMAIL PROTECTED] writes: Trying to import pylab from the shell gives me a Bus Error. [...] Anybody have any ideas on what to do from here? Follow the instructions in the SEGFAULTS file, which begins as follows: | First thing to try is simply rm -rf the site-packages/matplotlib and | build subdirs and get a clean install. Installing a new version over | a pretty old version has been known to cause trouble, segfault, etc. -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib digest...
John Hunter [EMAIL PROTECTED] writes: On 8/3/07, fred [EMAIL PROTECTED] wrote: Is there any tarball for ml archives ? Unfortunately a lot of the mail archive search algorithms are pretty poor. I subscribe over gmail, which has decent search, but I do not have the entire archives. I have a lot of the archives, particularly the earlier years when I was using a UNIX mail server and client, but now that I have moved over to gmail I do not have the recent archives in flat file or tarball. You can download the recent archives from gmane.org (though all email addresses are encrypted): http://gmane.org/export.php I wonder if there is any similar possibility at sourceforge? The gmane archives only go back to 2004 or so, so it would be nice if you (or other early developers) could upload older archives to gmane. The instructions are at http://gmane.org/import.php but basically all you have to do is put up a unix-style mbox file somewhere and send the URL to the gmane administrators. Importing does have the effect that old article numbers are no longer valid, and thus the read/unread status in newsreader programs is reset; thus it would be a good idea to gather all old archives first and then do just one upload, and warn readers in advance. -- Jouni - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Custom contour labels?
Zelakiewicz, Scott (GE, Research) [EMAIL PROTECTED] writes: I get one contour line as expected, but instead of printing the contour level (50) I would like to print a simple string like Some String. I tried using the fmt option of clabel, but it requires a way to stuff in the level value (ie. fmt=Some String %f). Is it possible to use a simple string for these labels? I don't know if there is a recommended way, but here is a quick hack: class FormatFaker(object): def __init__(self, str): self.str = str def __mod__(self, stuff): return self.str A=arange(100).reshape(10,10) CS=contour(A,[50,]) CS.clabel(fmt=FormatFaker('Some String')) show() -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Contour, numbering contourlones
George LeCompte [EMAIL PROTECTED] writes: The contours labels show 3 zeros beyond the decimal point. Is it possible to force these labels to integers? If so how? If not why not? clabel(CS, inline=1, fontsize=10, fmt='%3.0f') Is there a way to browse previous postings to matplotlib-users without looking month by month? For example can I bring up all postings regarding 'contour'? This was discussed recently: http://thread.gmane.org/gmane.comp.python.matplotlib.general/9915/focus=9917 You can search the list on at least sourceforge.net, gmane.org, and mail-archive.com: http://sourceforge.net/search/?ml_name=matplotlib-userstype_of_search=mlistsgroup_id=80706words=contour http://search.gmane.org/?query=contourgroup=gmane.comp.python.matplotlib.general http://www.mail-archive.com/search?q=contourl=matplotlib-users%40lists.sourceforge.net -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] tk, pylab and unicode
Xavier Gnata [EMAIL PROTECTED] writes: I'm a french user and I'm trying to put an 'é' into a pylab title. Ok it is a bug because matplotlib.rc('text',usetex=False) and then it works. But is always fails using matplotlib.rc('text',usetex=True) As a workaround, does \'e (as in rf\'evrier) work with usetex=True? -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] XPDF works but Ghostscript Doesn't for .eps
Darren Dale [EMAIL PROTECTED] writes: The testgs.eps (for test with ghostscript) does not convert to pdf using either apple preview or adobe distiller (the adobe log is included) It does however convert successfully with epstopdf so there is some subtle difference. I'm sorry, I have no idea. I guess you would have to take it up with ghostscript, that is the program that is producing the file that adobe and apple preview is having trouble with. Since this is on Mac OS X, I suspect it is the long-standing font problem; that is, matplotlib finds and uses some system fonts but does not embed them correctly. If you force the Bitstream Vera family of fonts, does it work then? : Error: No paper information available - using defaults I think this is an xpdf error message. Adding errQuiet yes to ~/.xpdfrc might silence it, at the cost of omitting more serious messages too. -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib svn bug: Found an unknown keyword in AFM header...?
Eric Firing [EMAIL PROTECTED] writes: My guess is that this problem has been lurking all along, but was only triggered when I changed font_manager to look for *all* system fonts instead of only truetype, Another data point: a recent svn version of matplotlib segfaults on my OS X system, and ktrace suggests it occurs while it is reading CharcoalCY.dfont. Running under gdb causes it to exit with a traceback that ends like this: File /Users/jks/Hacking/matplotlib/matplotlib/lib/matplotlib/font_manager.py, line 200, in get_fontconfig_fonts status, output = commands.getstatusoutput(fc-list file) File /Library/Frameworks/Python.framework/Versions/2.4//lib/python2.4/commands.py, line 54, in getstatusoutput text = pipe.read() IOError: [Errno 4] Interrupted system call Investigating... -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib svn bug: Found an unknown keyword in AFM header...?
Jouni K. Seppänen [EMAIL PROTECTED] writes: Another data point: a recent svn version of matplotlib segfaults on my OS X system, and ktrace suggests it occurs while it is reading CharcoalCY.dfont. Looks like a freetype bug: the following code segfaults when linked against libfreetype.6.3.10 but not when linked against libfreetype.6.3.16. Freetype has some code to read dfont files, which apparently had a bug in the older version, and this is triggered by the new code that reads in all font files. #include ft2build.h #include FT_FREETYPE_H int main() { FT_Library library; FT_Face face; int error; error = FT_Init_FreeType(library); if (error) { printf(FT_Init_FreeType error %d\n, error); return; } error = FT_New_Face(library, /Library/Fonts/CharcoalCY.dfont, 0, face); if (error) { printf(FT_New_Face error %d\n, error); return; } return; } -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib svn bug: Found an unknown keyword in AFM header...?
Eric Firing [EMAIL PROTECTED] writes: I think that the problem is occurring in the last line. This remains to be verified. It looks like *.afm files are being found, but when createFontDict tries to parse them it doesn't find what it expects. The cause of the problem is a combination of two things: first, for some reason the afmfiles list contains non-AFM files, which is probably a bug; second, the AFM parser doesn't quit when faced with a malformed file. I committed a sanity check (diff attached) in afm.py to fix the second problem, but the first one remains. -- Jouni K. Seppänen http://www.iki.fi/jks Index: lib/matplotlib/afm.py === --- lib/matplotlib/afm.py (revision 3726) +++ lib/matplotlib/afm.py (revision 3727) @@ -53,7 +53,27 @@ else: return True +def _sanity_check(fh): + +Check if the file at least looks like AFM. +If not, raise RuntimeError. + +# Remember the file position in case the caller wants to +# do something else with the file. +pos = fh.tell() +try: +line = fh.readline() +finally: +fh.seek(pos, 0) + +# AFM spec, Section 4: The StartFontMetrics keyword [followed by a +# version number] must be the first line in the file, and the +# EndFontMetrics keyword must be the last non-empty line in the +# file. We just check the first line. +if not line.startswith('StartFontMetrics'): +raise RuntimeError('Not an AFM file') + def _parse_header(fh): Reads the font metrics header (up to the char metrics) and returns @@ -255,6 +275,7 @@ dkernpairs : a parse_kern_pairs dict, possibly {} dcomposite : a parse_composites dict , possibly {} +_sanity_check(fh) dhead = _parse_header(fh) dcmetrics = _parse_char_metrics(fh) doptional = _parse_optional(fh) - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib svn bug: Found an unknown keyword in AFM header...?
Andrew Jaffe [EMAIL PROTECTED] writes: I admit I don't understand the problems or the speccific code involved, but I *think* it may be that the OSX-specific code isn't restricted to afm files. Hence I wonder if the following is a fix: -for f in OSXInstalledFonts(): +for f in OSXInstalledFonts(fontext=fontext): It helps in this particular case, but I think the intention behind this code is to allow loading non-TrueType fonts even when fontext='ttf'. On OS X there are various non-TrueType font formats (dfont, otf, resource-fork fonts), at least some of which are supported by freetype, so if you always pass fontext to OSXInstalledFonts, you unnecessarily limit the fonts found to those whose filename indicates ttf format. (Macs also don't care as much about filename extensions as the rest of the world.) But I'm just guessing here as to the reasoning behind the code. Somebody else might know better? -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Bar graph color
Lee, Young-Jin [EMAIL PROTECTED] writes: Then, I realized because each bar is so narrow I can't see the color of the bars but only outside lines (I see the colors by zooming it), which I couldn't find a way to change the color. My question is, is there any way either 1) to get rid of the outside lines or 2) to change the color of the lines? Thanks much in advance! To get rid of the lines, set the linewidth property of the bars to 0; to change their color, set the edgecolor property. For example, using ipython -pylab: In [31]: a=bar([1,2,3,4],[3,1,4,1],lw=0) In [32]: setp(a[1], lw=10, ec='red') Out[32]: [None, None] Here I used the abbreviations lw and ec for linewidth and edgecolor. The first command creates a bar chart where all bars have line width zero, the second modifies one of the bars to have very thick red edges. You can experiment with the properties using the pylab commands getp and setp. -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] PS and imshow
John Hunter [EMAIL PROTECTED] writes: On 8/24/07, Christopher Barker [EMAIL PROTECTED] wrote: This may not be what it seems. The native coordinate system for PostScript is in points, which are 1/72 if an inch, so it's common to force that as a dpi. [...] Yes, this is exactly right and the reason we do it this way. We support fractional points so indeed you have higher resolutions. Off the top of my head, I am not sure what is going on with the image resolution problem I just tried with current svn, and the following script produces two results that have visibly different resolutions: #!/usr/bin/python from pylab import * foo = rand(10,10) imshow(foo) savefig('foo10.ps', dpi=10) savefig('foo100.ps', dpi=100) Perhaps the original poster could show a bit of code where the scaling fails? (I'm not sure if figimage is doing the right thing, though...) -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Error TclError: no display name and no $DISPLAY environment variable
Deen Sethanandha [EMAIL PROTECTED] writes: I use matplotlib as part of my Trac plugin. I got this error when I try to access the web site that use my plugin. [...] File /usr/lib/python2.5/site-packages/matplotlib/pylab.py, line 876, in figure File /usr/lib/python2.5/site-packages/matplotlib/backends/backend_tkagg.py, line 88, in new_figure_manager File lib-tk/Tkinter.py, line 1639, in __init__ Your plugin is importing pylab, which automatically imports the TkAgg backend based on your .matplotlibrc setting, and this makes no sense in a non-interactive environment. The quick way to make this work is to replace import pylab by the following lines: import matplotlib matplotlib.use('Agg') import pylab See also: examples/webapp_demo.py. -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Using the object-oriented interface (was: Error TclError: no display name and no $DISPLAY environment variable)
Deen Sethanandha [EMAIL PROTECTED] writes: I am very new to using the matplotlib. I am wondering if I can use just matplotlib without using pylab at all? Yes, you can. The documentation is not perfect, but there is a tutorial to get you started and some reference documentation to explore: http://matplotlib.sourceforge.net/leftwich_tut.txt http://matplotlib.sourceforge.net/classdocs.html Also examples/webapp_demo.py uses the object-oriented interface. -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] PS and imshow
Petr Danecek [EMAIL PROTECTED] writes: On Fri, 2007-08-24 at 20:03, Jouni K. Seppänen wrote: savefig('foo10.ps', dpi=10) savefig('foo100.ps', dpi=100) In fact, the dpi option does change the resulting PS file, but the quality is still very poor - see the example http://www.ucl.cas.cz/~petr/matplotlib-test.tgz I don't see a big difference between test-600.eps and test-convert.eps when viewed in gv with magnification 10 and 0.1, respectively. Obviously there is some resampling in test-600.eps: your source image is 1494 by 1494 pixels large, which at 600 dpi is larger than the 5 by 5 cm figure created by the script (and the axes are even smaller). test-convert.eps has a bounding box of 0 0 1494 1494, so obviously it is a non-resampled image at 72 dpi. If the problem you are alluding to is in the resampling, perhaps varying the interpolation algorithm will produce a better result? See the docstring of imshow. To get a non-resampled image, figimage should work, but it doesn't seem to understand PIL images yet... -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] dateplot problem
Alan G Isaac [EMAIL PROTECTED] writes: I recall some discussion of problem importing mpl EPS files into Microsoft products in the past, and I think I recall that there was a fix. Perhaps you are thinking of one of these posts, which suggest using the svg backend and converting to emf via Inkscape or Visio: http://article.gmane.org/gmane.comp.python.matplotlib.general/9241 http://article.gmane.org/gmane.comp.python.matplotlib.general/9250 -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] inverted x-axis
Johann Cohen-Tanugi [EMAIL PROTECTED] writes: I would like to know if there is an easy to invert a axis (specifically the x-axis), id est to have the labels between say 0 an1 automatically run from right to left. setp(gca(), 'xlim', reversed(getp(gca(), 'xlim'))) i.e., just put the larger limit before the smaller one. -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] imshow : text.py broken?
Michael Droettboom [EMAIL PROTECTED] writes: I forgot to mention when I added baseline alignment -- I really have no idea how to get a good baseline out of the usetex machinery, or if that's even possible. In principle it should be possible: TeX aligns its boxes on a baseline unless you request otherwise, so you just have to make sure you position your text or formula at known coordinates, and when you examine the resulting page, you keep track of where the baseline should be. In practice there probably are some more complications. Or, resort to some TeX hackery... you can get TeX to report the dimensions (height, depth, and width) of a box with \showbox: http://uucode.com/blog/2006/02/26/showbox-in-latex/ -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] combine eps files into a ps file ?
Martin Bures [EMAIL PROTECTED] writes: MATLAB has a command, print, and it allows you to output a figure to a file, such as a .ps file and it has a switch '-append' so that you can append multiple plots to the same file. Is there a switch for the pylab command, 'savefig' to do the same thing? No, at least not currently. -- Jouni K. Seppänen http://www.iki.fi/jks - 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] Mac fonts do not display in plot
Yuri Bendaña [EMAIL PROTECTED] writes: For example, the following doesn't work: figtext(0.8,0.3,Large Folds, weight='bold', fontname='Helvetica') I only get the default font (I believe it's Vera) and no bold. Yes, I think that's a known bug. The font manager doesn't know how to read the bold version of Helvetica from Helvetica.dfont. A workaround is to run fondu (http://fondu.sourceforge.net/) on Helvetica.dfont, put the resulting ttf files in some directory and use them directly: In [20]: from matplotlib.font_manager import FontProperties In [21]: fp=FontProperties(fname='/tmp/HelveticaBold.ttf',size=14) In [22]: text(.1,.1,'this is bold',fontproperties=fp) -- Jouni K. Seppänen http://www.iki.fi/jks - 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] bar graph and legend
Gianluca Santarossa [EMAIL PROTECTED] writes: In this example, on my PC both the entries in the legend appear in blue color: legend((bar1,bar2), ('First','Second')) You want legend((bar1[0],bar2[0]), ('First','Second')). What happened was that matplotlib made a legend entry for two of the blue bars in bar1; it would have made six entries, but stopped because you only gave it two labels. Moreover, if I add a legend to a graph plotting a set with marks and without lines, the legend will show two points instead of one (which would have been the expected behaviour). Is this correct? I get four points, not two, but perhaps this has changed in the svn version. At least in the svn version you can control the number of points with the numpoints keyword argument: In [6]: plot([3,1,4,1,5,9,2,6,5,3,5],'bo') Out[6]: [matplotlib.lines.Line2D instance at 0x16cf9b98] In [7]: legend(_, ('foo',), numpoints=1) Out[7]: matplotlib.legend.Legend instance at 0x16cf9bc0 -- Jouni K. Seppänen http://www.iki.fi/jks - 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] eliminating end labels on axes
James Boyle [EMAIL PROTECTED] writes: I have not been able to figure out how to just make the first and last ytick labels vanish. [...] I thought that the following might work but this just makes all the labels disappear - my understanding is incomplete. ytl = a.get_yticklabels() ytl[0]._visible = False ytl[-1]._text = False It is usually a bad idea to manipulate directly anything starting with an underscore -- that's a Pythonic way of indicating a private variable. The set_visible() method should work here: ytl = a.get_yticklabels() ytl[0].set_visible(False) -- Jouni K. Seppänen http://www.iki.fi/jks - 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] hatching background
Christian Meesters [EMAIL PROTECTED] writes: is it somehow possible to have a hatch in parts of the background, which would achieve something like this pseudo-parameter to axvspan pylab.axvspan(2, 10, hatch='//')? Do you mean something like this? In [34]: phi=pi*array((0,.2,.4,.6,.8,1,-.8,-.6,-.4,-.2)) In [35]: fill(cos(phi), sin(phi)) Out[35]: [matplotlib.patches.Polygon instance at 0x1894cda0] In [36]: a=gca() In [37]: setp(getp(a,'frame'), hatch='//') Out[37]: [None] (For some reason I don't see the hatch pattern in Agg-based backends, in current svn, but it is there in e.g. eps and pdf.) -- Jouni K. Seppänen http://www.iki.fi/jks - 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] Drawing filled circles (discs)
sidimok [EMAIL PROTECTED] writes: I'm using matplotlib to draw (from matplotlib.Patches import Circle) filled circles (disks) from a formatted data file, and would give each disk a color relative to a variable, as done by the scatter function. Here's one way to do it: #!/usr/bin/env python import matplotlib from matplotlib.patches import Circle import pylab def myscatter(ax, colormap, x, y, radii, colors): for x1,y1,r,c in zip(x, y, radii, colormap(colors)): ax.add_patch(Circle((x1,y1), r, fc=c)) fig=pylab.figure() ax=fig.add_subplot(111) myscatter(ax, matplotlib.cm.jet, pylab.rand(20), pylab.rand(20), 0.1*pylab.rand(20), pylab.rand(20)) ax.axis('equal') pylab.show() Implementing a CircleCollection as a subclass of PatchCollection would probably lead to a faster solution, but perhaps the code above is enough for simple needs. -- Jouni K. Seppänen http://www.iki.fi/jks - 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] plot different columns
Fabian Braennstroem [EMAIL PROTECTED] writes: Lets say I have to columns, the I could use in a script: res=plot(array_mapped[:,0],array_mapped[:,1], 'b', array_mapped[:,0],array_mapped[:,2], 'g') The next time a have 5 columns in a file and want to plot all 5 columns without adjusting the 'plot' command in the script, but just by defining an argument when starting the script. Perhaps 'plot' is not the ideal interface for your purposes. How about something like this: #!/usr/bin/env python import matplotlib from matplotlib.lines import Line2D import pylab import numpy as npy def myplot(ax, matrix, linestyle, color): for column in range(1, matrix.shape[1]): line = Line2D(matrix[:,0], matrix[:,column], linestyle=linestyle, color=color) ax.add_line(line) colors = 'brk' for d in range(2,5): fig=pylab.figure() ax=fig.add_subplot(111) matrix = npy.random.rand(d,d) matrix[:,0] = npy.linspace(0, 1, num=d) myplot(ax, matrix, '-', colors[d-2]) pylab.show() -- Jouni K. Seppänen http://www.iki.fi/jks - 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] Change the line width of a legend
yves frederix [EMAIL PROTECTED] writes: I was wondering if it is possible to change the line width of the border around a legend. Yes, e.g. lg=legend(...) lg.get_frame().set_linewidth(0.1) Also, if there is a way of creating the legend without the border at all, I would be happy to hear about it. Does setting the line width to zero do what you want? -- Jouni K. Seppänen http://www.iki.fi/jks - 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] Drawing filled circles (discs)
sidimok [EMAIL PROTECTED] writes: Well, let's take the one you've proposed the last time. How than can i put a colorbar beside the plot? Add in the imports from matplotlib.colorbar import ColorbarBase, make_axes and change the myscatter function to def myscatter(ax, colormap, x, y, radii, colors): for x1,y1,r,c in zip(x, y, radii, colormap(colors)): ax.add_patch(Circle((x1,y1), r, fc=c)) cax, _ = make_axes(ax) ColorbarBase(cax, cmap=colormap) A better solution is probably to implement a CircleCollection similarly to the other collections. -- Jouni K. Seppänen http://www.iki.fi/jks - 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] latex labels on saved plots
Jordan Atlas [EMAIL PROTECTED] writes: I'm having trouble saving eps or pdf versions of plots that have TeX labels using matplotlib. Which version of matplotlib are you using? The error message you quote for the pdf backend shows a line 1085 in get_canvas_width_height, which is impossible both in the latest released version 0.90.1 and in current svn. I vaguely remember there being a bug like that quite some time ago. In any case, no released version of matplotlib supports using TeX with the pdf backend. Do you mean the (TeX-like) mathtext format parsed by matplotlib? In current svn there is some support for TeX with the pdf backend, but it has not (AFAIK) been tested on Windows. I saw an older thread (http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg03953.html ) that seems to address similar issues, but I don't understand the solution (using XPDF distiller). Gmane mangles the URL (to protect email addresses) so I can't read the message you cite, but using the XPDF distiller means setting ps.usedistiller to xpdf in your matplotlibrc file. You will need to have ps2pdf (from ghostscript) and pdftops (from xpdf or poppler) installed. -- Jouni K. Seppänen http://www.iki.fi/jks - 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] plot different columns
Fabian Braennstroem [EMAIL PROTECTED] writes: Jouni K. Seppänen schrieb am 09/16/2007 05:51 PM: def myplot(ax, matrix, linestyle, color): [...] Thanks for your help! add_line seems to be the right function... I am not sure yet, if I need your function call, but I will check it!? Oh, I just wrote my suggestion as a myplot function called by a main program as an example of what you could use instead of the built-in plot. There are of course many possible ways to organize your program. -- Jouni K. Seppänen http://www.iki.fi/jks - 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] Drawing filled circles (discs)
sidimok [EMAIL PROTECTED] writes: Thank you very much indeed for the help, both solutions work like a charm. However Dave's one gives rough cirlces, approximated by polygones, which is not very accurate for my buisness. As he said, increasing the number of vertices could be enough, depending on your exact needs. If you zoom in on polygons, you will of course eventually see the difference. May I ask how to create a circleCollection as Jouni The Expert proposed? I meant that you could read through collections.py and implement a CircleCollection along the lines of the other collections there. I'm not quite sure what exactly this entails [so I'm not expert enough to answer your question :-)]. At least it would mean a new method for backends, although one that you could implement once in backend_bases. (Now that I look at collections.py, the base class Collection has a get_verts method that derived classes should override and that other parts of matplotlib call, so perhaps collections of non-polygons would require more extensive changes than just adding a new subclass.) The advantage would be speed of rendering in case you draw lots of circles, so if speed is not a problem, don't worry about this. -- Jouni K. Seppänen http://www.iki.fi/jks - 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] Starting troubles with matplotlib.
Shishir Ramam [EMAIL PROTECTED] writes: What I cannot understand is why the vertical bars don't align to the y-axis 0 point. Also if you don't draw some of the green lines, the red ones extend beyond the x-axis. I wonder if this is an artifact from the subpixel rendering in Agg and the snap-to-pixel corrections in axis lines... -- Jouni K. Seppänen http://www.iki.fi/jks - 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] Starting troubles with matplotlib.
Jouni K. Seppänen [EMAIL PROTECTED] writes: Shishir Ramam [EMAIL PROTECTED] writes: What I cannot understand is why the vertical bars don't align to the y-axis 0 point. Also if you don't draw some of the green lines, the red ones extend beyond the x-axis. I wonder if this is an artifact from the subpixel rendering in Agg and the snap-to-pixel corrections in axis lines... No, it's much simpler: in matplotlibrc there is a setting for lines.solid_capstyle, and apparently the default is projecting, but you want butt. -- Jouni K. Seppänen http://www.iki.fi/jks - 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] Rv: three-d contour plot(intensity or arrow plot)
yadin Bocuma Rivas [EMAIL PROTECTED] writes: every time i try to plot i have these error Unfortunately, the 3D plotting capabilities of matplotlib are not being maintained. A list of Python software for 3D plotting can be found at http://new.scipy.org/Topical_Software#head-8f49c45f696b5833d161aab95c22e5d495658a44 -- Jouni K. Seppänen http://www.iki.fi/jks - 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] contour or intensity plot.
yadin Bocuma Rivas [EMAIL PROTECTED] writes: i want to generate a contour plot [...] an example will be very helpfull Please see examples/contour_demo.py in the matplotlib distribution and http://matplotlib.sourceforge.net/matplotlib.pylab.html#-contour -- Jouni K. Seppänen http://www.iki.fi/jks - 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] Non-interactive use always tries to load wx
Daniel O'Connor [EMAIL PROTECTED] writes: I am trying to use matplotlib non-interactively but if I don't have DISPLAY set then wx barfs even though I have tried forcing the backend, etc.. This should probably be in the FAQ... you need to set the backend before you import pylab, because importing pylab reads your matplotlibrc file and does all sorts of setup: import matplotlib matplotlib.use('agg') import pylab -- Jouni K. Seppänen http://www.iki.fi/jks - 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] Specifying X,Y Pairs For Line Plots
Rich Shepard [EMAIL PROTECTED] writes: x,y = [(15.0, 0.0), (30.0, 1.0), (70.0, 1.0), (85.0, 0.0)] ValueError: too many values to unpack You are looking for the classic unzip trick: x,y = zip(*[(15.0, 0.0), (30.0, 1.0), (70.0, 1.0), (85.0, 0.0)]) -- Jouni - 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] How to get current value of xlim/ylim?
Slackenerny [EMAIL PROTECTED] writes: graph = f.add_subplot(...) I could help myself with graph.get_xlim() So, how could I have helped myself, without annoying you? ;) The commands getp(graph) and setp(graph) might have helped. -- Jouni K. Seppänen http://www.iki.fi/jks - 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] needed grp2idx
s_pushparaj [EMAIL PROTECTED] writes: I am working to plot and compare distributions. For that I require the grp2idx.m file to run boxplotC.m. Kindly help me get the request m file. It looks like you got the wrong list. This list is for discussing matplotlib, a Python plotting package. You refer to m files, by which I suppose you mean Matlab code. You can find Matlab code at http://www.mathworks.com/matlabcentral/ -- Jouni K. Seppänen http://www.iki.fi/jks - 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
[EMAIL PROTECTED] writes: Michael Droettboom [EMAIL PROTECTED] writes: 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... One possible source of platform-specific issues is cbook.get_realpath_and_stat, which is used on the font files to obtain hash keys. Does stat do anything sensible on Windows? Oh, never mind, John seems to have found the bug in a message that didn't quite make it to my newsreader before I posted. Apparently stat does not do on Windows what this code is expecting it to do. -- Jouni K. Seppänen http://www.iki.fi/jks - 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
John Hunter [EMAIL PROTECTED] writes: Michael: if you let me know better what this key is supposed to be doing (can we not simply use the filename for windows?) then I can attempt or test some fixes. I seem to recall that there was some problem with case-insensitive file systems. On OS X os.path.realpath doesn't normalize case (some OS X file systems are case sensitive but the usual one is not): os.path.realpath function realpath at 0x474b0 r=_ r('/system/library/fonts/LucidaGrande.dfont') '/system/library/fonts/LucidaGrande.dfont' r('/System/Library/Fonts/LucidaGrande.dfont') '/System/Library/Fonts/LucidaGrande.dfont' s=os.stat s('/system/library/fonts/LucidaGrande.dfont') (33188, 10369L, 234881026L, 1, 0, 0, 2295501L, 1206468480, 1191377895, 1194639447) s('/System/Library/Fonts/LucidaGrande.dfont') (33188, 10369L, 234881026L, 1, 0, 0, 2295501L, 1206468480, 1191377895, 1194639447) Stat is a clever way of finding the real identity of the file on Unix-like systems. On Windows we clearly need something else... -- Jouni K. Seppänen http://www.iki.fi/jks - 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
Michael Droettboom [EMAIL PROTECTED] writes: 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. How about checking first the size of the file, assuming that os.stat('filename').st_size is sensible on Windows? If the size matches an existing file, compute a hash of the contents of both to see if they are the same, and in any case, memoize the results so that future checks of the exact same filename are fast. That way you only incur the cost of the hash if the same file is included with multiple names, or in the rare case that two different files have the same size. -- Jouni K. Seppänen http://www.iki.fi/jks - 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] failed to save in 'eps' format when I use latex environment
Darren Dale [EMAIL PROTECTED] writes: pdf output uses dviread.py to parse the dvi files created by latex, get the font layout information, and place the glyphs. [...] there are some subtle and difficult to resolve limitations of dviread (like rendering greek letters in math mode) that have prevented us from using it everywhere. Jouni, would you care to comment? The details are a little complicated, but yes, dviread.py lacks some features of the font support in dvips. The PS backend calls dvips and so gets to use all the font machinery in a modern TeX system, and dviread doesn't (yet) implement all the features. Another potential problem is that dviread makes more assumptions about the TeX system than the PS backend, and I have only tested it on TeX Live on a Mac. Both TeX Live and teTeX on a Unix-ish system should be fine, but I have no idea about TeX implementations on Windows, or any commercial implementations. For various reasons, I haven't had much time recently to hack on matplotlib, but improving dviread is high on my todo list when I do find the time. -- Jouni K. Seppänen http://www.iki.fi/jks - 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] markeredgewidth and pdf
Christopher Brown [EMAIL PROTECTED] writes: With mpl 0.91.2, the markeredgewidth property does not seem to have an effect when using the pdf backend (seems to always be 1, regardless of what I set it to, and it seems to be fine with other backends). I can't replicate this problem. Could you send me (off-list) the resulting pdf file and a screenshot from your pdf viewer? -- Jouni K. Seppänen http://www.iki.fi/jks - 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] Type 3 fonts
Christopher Brown [EMAIL PROTECTED] writes: I have read a little bit online about the difference between types 1 and 3, but I can't find a description of which font is which type. So what font should I use? Try setting the pdf.fonttype parameter in your matplotlibrc file to 42 and see if the resulting file passes validation. Matplotlib currently only uses TrueType fonts, which can be embedded in either Type 3 or Type 42 format. I seem to recall there was some problem with the Type 42 format so Type 3 was made the default; Michael Droettboom probably remembers it better. If you really need to use Type 1 fonts as opposed to TrueType, there actually is some limited support for them in the pdf backend, currently used only by the dviread approach to using LaTeX. You could try setting text.usetex to True - if it works out for you, you should see Type 1 TeX fonts in the output. If not, it will probably take a little hacking to smuggle a Type 1 font (a pfa or pfb file) past the front end, but the pdf backend should then embed it. -- Jouni K. Seppänen http://www.iki.fi/jks - 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] Type 3 fonts
Christopher Brown [EMAIL PROTECTED] writes: I have read a little bit online about the difference between types 1 and 3, but I can't find a description of which font is which type. So what font should I use? Try setting the pdf.fonttype parameter in your matplotlibrc file to 42 and see if the resulting file passes validation. Matplotlib currently only uses TrueType fonts, which can be embedded in either Type 3 or Type 42 format. I seem to recall there was some problem with the Type 42 format so Type 3 was made the default; Michael Droettboom probably remembers it better. If you really need to use Type 1 fonts as opposed to TrueType, there actually is some limited support for them in the pdf backend, currently used only by the dviread approach to using LaTeX. You could try setting text.usetex to True - if it works out for you, you should see Type 1 TeX fonts in the output. If not, it will probably take a little hacking to smuggle a Type 1 font (a pfa or pfb file) past the front end, but the pdf backend should then embed it. -- Jouni K. Seppänen http://www.iki.fi/jks - 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] [newb] batch processing
Neal Becker [EMAIL PROTECTED] writes: To produce a batch of pdfs, I'm using: [...] Works, but causes my display to flash, I think each time either close() or figure() is called (not sure which). Any better way? To avoid opening a window at all, use a non-interactive backend by putting something like the following at the start of your script, _before_ importing anything else: import matplotlib matplotlib.use('pdf') -- Jouni K. Seppänen http://www.iki.fi/jks - 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] getting the min and max values of an axis for plotting
Johann Cohen-Tanugi [EMAIL PROTECTED] writes: I have a function, which I am plotting. I want to add a line positioned at, say, the mean of the function, so I want to do plot([x,x],[y0,y1]). Try axvline(x). -- Jouni K. Seppänen http://www.iki.fi/jks - 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 labels - interaction with functions
David Simpson [EMAIL PROTECTED] writes: This is probably my lack of knowledge of python, but how do I set up legend labels for some bar-plots that have been produced inside a function. For example, the following will nicely plot my bar-plots, but then legend doesn't know about the colours used, so here just uses black for both labels. Legends for multiple histograms don't behave the way people expect, because the colors are taken bar by bar, first from one histogram, then from the second histogram, etc. You need to take just one bar from each histogram and pass them as the first argument to legend: from pylab import * x=arange(0,5) y=array([ 1.2, 3.4, 5.4, 2.3, 1.0]) z=array([ 2.2, 0.7, 0.4, 1.3, 1.2]) def plotb(x,y,col): p=bar(x,y,color=col) return p[0] p1 = plotb(x,y,'k') p2 = plotb(x+0.4,z,'y') legend((p1, p2), ('YYY','ZZZ')) show() I think this behavior of legend is suboptimal, but there is a logic to it: by default you label objects in the order you draw them, and the histogram plot happens to consist of several similarly-colored objects. -- Jouni K. Seppänen http://www.iki.fi/jks - 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] changing ticklabels color
Chiara Caronna [EMAIL PROTECTED] writes: ax1=p.subplot(212) ax1.set_xlabel('t [sec]') ax1.set_ylabel('g^2(q,t)') ax1.set_yticklabels(color='r') You could do for label in ax1.get_yticklabels(): label.set_color('r') or use the setp shortcut: p.setp(ax1.get_yticklabels(), color='r') -- Jouni K. Seppänen http://www.iki.fi/jks - 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] ugly arrow with xpdf
Friedrich Hagedorn [EMAIL PROTECTED] writes: % xpdf foo.pdf then I see on the startpoint an ugly pike. With gv and evince everything is ok. Just to be sure about what the problem is, could you show us a screenshot of the ugly rendering, and another of a better rendering in another viewer? I think the list doesn't accept attachments, so it would be best if you could put the files somewhere on the web and send a link to the list or, failing that, send the screenshots to me by email. Also, what exact version of xpdf are you using? -- Jouni K. Seppänen http://www.iki.fi/jks - 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] ugly arrow with xpdf
I finally committed this fix. -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Problem in afm.py with 0.98.3
[EMAIL PROTECTED] (Berthold Höllmann) writes: (Pdb) print self._header {'Notice': 'Copyright (c) 1999 Ministry of Education, Taipei, Taiwan. All Rights Reserved.', 'Ascender': 880.0, 'FontBBox': [-123, -250, 1000, 880], 'Weight': 'Regular', 'Descender': -250.0, 'CharacterSet': 'Adobe-CNS1-0', 'IsFixedPitch': False, 'FontName': 'MOEKai-Regular', 'StartFontMetrics': 4.0996, 'CapHeight': 880.0, 'Version': '1.000', 'UnderlinePosition': -100, 'Characters': 13699, 'UnderlineThickness': 50, 'ItalicAngle': 0.0, 'StartCharMetrics': 13699} That AFM file doesn't include a family name or a full name for the font it describes. It seems that both are in fact optional attributes. I have committed a change (on the trunk, and in the maintenance branch) that should fix this, but since I don't have any AFM files like this, I can't check that it works. Can you check out either the trunk or the maintenance branch from Subversion, or apply the following patch and try again? -- Jouni K. Seppänen http://www.iki.fi/jks Index: lib/matplotlib/afm.py === --- lib/matplotlib/afm.py (revision 6149) +++ lib/matplotlib/afm.py (revision 6150) @@ -34,7 +34,7 @@ John D. Hunter [EMAIL PROTECTED] -import sys, os +import sys, os, re from _mathtext_data import uni2type1 #Convert string the a python type @@ -433,12 +433,22 @@ def get_fullname(self): Return the font full name, eg, 'Times-Roman' -return self._header['FullName'] +name = self._header.get('FullName') +if name is None: # use FontName as a substitute +name = self._header['FontName'] +return name def get_familyname(self): Return the font family name, eg, 'Times' -return self._header['FamilyName'] +name = self._header.get('FamilyName') +if name is not None: +return name +# FamilyName not specified so we'll make a guess +name = self.get_fullname() +extras = r'(?i)([ -](regular|plain|italic|oblique|bold|semibold|light|ultralight|extra|condensed))+$' +return re.sub(extras, '', name) + def get_weight(self): Return the font weight, eg, 'Bold' or 'Roman' return self._header['Weight'] - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users