Re: [Matplotlib-users] py2exe and matplotlib errors when executing exe
On 19/05/2010 01:17, New2Python wrote: Thanks, I changed the matplotlibrc file to use the WXAgg backend and then had to copy the file into the mpl.get_configdir() and in my local working dir for it to work. The file runs however a python error screen pops up and then closes without giving me the chance to read it, anybody know how to stop the window from closing so quickly You have probably set wx.App(redirect=True), change to False and then you should see the exception in your IDE. Werner -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] align title of subplot with ylabel
Thanks for the suggestions, 'annotate' is what I need, I think. I get errors though, also when I run the example scripts from here: http://matplotlib.sourceforge.net/trunk-docs/users/annotations_guide.html#using-complex-coordinate-with-annotation . I get the error 'NoneType' object is not iterable when I try plt.show() or try to save to eps. So I am not sure if I have the correct version of matplotlib installed. I checked out the newest matplotlib from the svn repository, removed my current installed version and installed the version in the 'trunk/' directory. 'annotate' did not work. Later, I installed matplotlib from the '/branches/v0_99_maint' directory. In both cases there were no errors in the installation, but still 'annotate' did not work. Could it be that I have the wrong library from the svn repository installed? Does r8319 mean release #8319? Kind Regards Hannes On Tue, 2010-05-18 at 13:34 -0400, Jae-Joon Lee wrote: This can be done relatively easily with the current svn version of matplotlib (r8319). Below is the modified version of your code. See http://matplotlib.sourceforge.net/trunk-docs/users/annotations_guide.html#using-complex-coordinate-with-annotation for how the annotation works. While this is certainly possible with the released version, but it will require you to write a few tens of lines of code. Basically, you need create a custom Text class that update its position during the drawing time. Regards, -JJ ###Code import scipy import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(121) plt.plot(scipy.sin(scipy.arange(1,100, 0.001))) plt.xlabel('xlabel') yl = plt.ylabel(ylabel) plt.annotate(A, (0,1.), xycoords=(yl, axes fraction), xytext=(0, 14), textcoords=offset points, fontsize=14) ax = fig.add_subplot(122) plt.plot(scipy.cos(scipy.arange(1,100, 0.001))) plt.xlabel('xlabel') my_ticklabel = ax.get_yticklabels()[-2] # Note that there is no guarantee that all ticklabels are drawn. plt.annotate(B, (0,1.), xycoords=(my_ticklabel, axes fraction), xytext=(0, 14), textcoords=offset points, fontsize=14) ###End Code On Mon, May 17, 2010 at 11:08 AM, hettling hettl...@few.vu.nl wrote: Dear all, I'm struggling with the following problem plotting my data: I have a figure with two panels next to each other, which I want to label 'A' and 'B'. I want to left-justify my panel labels, but not to the box that contains the plot, but to the y-axis label. I played around with 'text()' and 'title()', but did not find a good solution except for giving the coordinates manually to 'text()'. This would be very inconvenient though, because I have many different plots on different scales. Here is what I tried: ###Code import scipy import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(121) plt.plot(scipy.sin(scipy.arange(1,100, 0.001))) plt.xlabel('xlabel') plt.ylabel(ylabel) plt.text(0,1,A, fontsize=14, transform=ax.transAxes) ax = fig.add_subplot(122) plt.plot(scipy.cos(scipy.arange(1,100, 0.001))) plt.text(0,1,B, fontsize=14, transform=ax.transAxes) plt.xlabel('xlabel') ###End Code So the texts 'A' and 'B' should be a little bit higher and more to the left. The 'A' I want to align with the y-axis label of the left plot, the 'B' with the values of the y-axis of the right plot. I hope my question is clear, I will appreciate any help! Thanks in advance, Hannes -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] introducing mpl_toolkits.gridspec
The functionality of the gridspec is now merged into the matplotlib. The updated documentation can be found in http://matplotlib.sourceforge.net/trunk-docs/users/gridspec.html Regards, -JJ On Tue, May 11, 2010 at 11:57 AM, Jae-Joon Lee lee.j.j...@gmail.com wrote: Hi, gridspec is a module that implements matplotlib’s Subplot slightly differently. Current matplotlib’s Subplot only allows a Subplot to occupy a single cell of the n x m grid. gridspec enables a Subplot to occupy multiple cells. http://leejjoon.github.com/mpl_toolkits-gridspec/ The code is hosted in the github repo http://github.com/leejjoon/mpl_toolkits-gridspec and the source can be downloaded from http://github.com/leejjoon/mpl_toolkits-gridspec/downloads This is motivated from the discussion in the mailing list a while ago. http://sourceforge.net/mailarchive/message.php?msg_id=4A0DA94E.1040500%40american.edu I originally prepared this as a patch for matplotlib (http://article.gmane.org/gmane.comp.python.matplotlib.general/19097), but never committed. Instead, it is packaged as a mpl_tookit module. Regards, -JJ -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] How to have few marks on the lines?
Hi, I am a wondering if it's possible to have few line distinguishing marks on the data lines on a chart such as circle, start, square. When I use some thing like this for the color of the graph (i.e. rs, k^), it uses the shape for each data point and the lines becomes very thick. All I want is to put 4-5 shaper markers on each line with line (the data line will have few hundred data points). Many thanks, Omer -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] PY2EXE with Matplotlib and wxPython compiles but won't run???
I'm trying to build an executable using PY2EXE; running Python 2.5.2 and wxPython 2.8.10.1 and MatplotLib 0.99.0I tried using the setup.py from the PY2EXE.org Matplotlib page and although everything compiles correctly and generates an executable.When I launch the executable I get the following error:"The application requires a version of wxPython greater than or equal to 2.8, but a matching version was not found."You currently have these version(s) installed.I can compile an executable with PY2EXE and wxPython that works fine, but apparantly somethins in the setup for matplotlib is causing a problem.Has anyone else seen this problem or know of a solution?ThanksDavid(setup.py is attached) setup.py Description: Binary data -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] PY2EXE with Matplotlib and wxPython compiles but won't run???
On 19/05/2010 19:55, David Grudoski wrote: I'm trying to build an executable using PY2EXE; running Python 2.5.2 and wxPython 2.8.10.1 and MatplotLib 0.99.0 I tried using the setup.py from the PY2EXE.org Matplotlib page and although everything compiles correctly and generates an executable. When I launch the executable I get the following error: The application requires a version of wxPython greater than or equal to 2.8, but a matching version was not found. You currently have these version(s) installed. I can compile an executable with PY2EXE and wxPython that works fine, but apparantly somethins in the setup for matplotlib is causing a problem. Has anyone else seen this problem or know of a solution? You need to patch matplotlib (backend_wx.py), see the bottom of this page: http://www.py2exe.org/index.cgi/MatPlotLib Werner -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] hist question...
Hi all, Is there anyway of re-ploting the distribution generated by hist at a later point? I want to call it in a subroutine and have the resulting distributions returned so I can plot them without having to recalculate them each time. I couldn't find anything int he online documentation but I figured it'd be something like: import matplotlib.pyplot as plt hplot=plt.hist(data, bins=1000) plt.hist(hplot) or plt.hist(hplot[0],bins=hplot[1]) or plt.plot(hist) etc, but nothing works. Cheers, Nick Schurch -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] linearized log axis
Maybe I am misunderstanding your problem, but you can select 'semilog' for the x/yscale parameter. Ben Root On Wed, May 19, 2010 at 7:03 AM, Christer Malmberg christer.malmberg.0...@student.uu.se wrote: Hi, my problem is that I need a graph with a discontinous y-axis. Let me explain the problem: in my field (microbiology) the data generated from for example growth assays have a huge range (10^0-10^9), which has to be plotted on a semilogy style plot (cell concentration vs. time). The problem is that 0 cells is a useful number to plot (indicates cell concentration lower than detection limit), but of course not possible to show in a log diagram. This is easily solved on old-style logarithmic graph paper; since the data will be either 0, or 1 it is customary just to draw a zero x-axis at 10^-1 on the paper and that's that. On the computer, this is extremely hard. Most people I know resort to various tricks in Excel, such as entering a small number (0.001 etc) and starting the y-axis range from 10^1 to hide the problem. This makes excel draw a line, instead of leaving out the dot and line entirely. The part of the curve below the x-axis is then manually cut off in a suitable image editor. Needless to say, this is extremely kludgy. Even professional graphing packages like Graphpad Prism resort to similar kludges (re-define 0 values to 0.1, change the y-axis tick label to 0 etc.) This problem of course exists in other fields, while investigating a solution I found a guy who worked with aerosol contamination in clean rooms, and he needed to plot values logarithmically, at the same time as showing detector noise around 1-10 particles. He solved it by the same trick I would like to do in Matplotlib, namely plotting a standard semilogy plot but with the 10^-1 to 10^0 decade being replaced by a 0-1 linear axis on the same side. The guy in this post has the same problem and a useful example: http://ubuntuforums.org/showthread.php?t=394851 His partial solution is quite bad though, and I just got stuck while trying to improve it. I looked around the gallery for useful examples, and the closest I could find is the twinx/twiny function, but I didn't manage a plot that put one data curve across both axes. This code gives an image that maybe explains what I'm trying to do: === t = array([0,1,2,4,6,9,12,24]) y = array([100, 50, 10, 100, 5, 1, 0, 0]) subplot(111, xscale=linear, yscale=log) errorbar(x, y, yerr=0.4*y) linbit = axes([0.125, 0.1, 0.775, 0.1],frameon=False) linbit.xaxis.set_visible(False) for tl in linbit.get_yticklabels(): tl.set_color('r') show() === (the y=0 points should be plotted and connected to the line in the log part) Is this possible to do in matplotlib? Could someone give me a pointer on how to go on? Sorry for the long mail, /C -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Bitness issues?
Colleagues, I am trying to follow the http://matplotlib.sourceforge.net/users/pyplot_tutorial.html tutorial with little success. The very first import fails with either 64 or 32-bit python. Any hints I have missed? $ python Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type help, copyright, credits or license for more information. import matplotlib.pyplot as plt Traceback (most recent call last): File stdin, line 1, in module File /Library/Python/2.6/site-packages/matplotlib-0.99.1.1-py2.6-macosx-10.3-fat.egg/matplotlib/pyplot.py, line 6, in module from matplotlib.figure import Figure, figaspect File /Library/Python/2.6/site-packages/matplotlib-0.99.1.1-py2.6-macosx-10.3-fat.egg/matplotlib/figure.py, line 16, in module import artist File /Library/Python/2.6/site-packages/matplotlib-0.99.1.1-py2.6-macosx-10.3-fat.egg/matplotlib/artist.py, line 5, in module from transforms import Bbox, IdentityTransform, TransformedBbox, TransformedPath File /Library/Python/2.6/site-packages/matplotlib-0.99.1.1-py2.6-macosx-10.3-fat.egg/matplotlib/transforms.py, line 34, in module from matplotlib._path import affine_transform ImportError: /Library/Python/2.6/site-packages/matplotlib-0.99.1.1-py2.6-macosx-10.3-fat.egg/matplotlib/_path.so: no appropriate 64-bit architecture (see man python for running in 32-bit mode) exit() $ defaults write com.apple.versioner.python Prefer-32-Bit -bool yes $ python Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type help, copyright, credits or license for more information. import matplotlib.pyplot as plt Bus error $ Sincerely, Vlad This e-mail and its attachments are intended only for the individual or entity to whom it is addressed and may contain information that is confidential, privileged, inside information, or subject to other restrictions on use or disclosure. Any unauthorized use, dissemination or copying of this transmission or the information in it is prohibited and may be unlawful. If you have received this transmission in error, please notify the sender immediately by return e-mail, and permanently delete or destroy this e-mail, any attachments, and all copies (digital or paper). Unless expressly stated in this e-mail, nothing in this message should be construed as a digital or electronic signature. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] linearized log axis
On 05/19/2010 10:28 AM, Benjamin Root wrote: Maybe I am misunderstanding your problem, but you can select 'semilog' for the x/yscale parameter. You mean symlog. See http://matplotlib.sourceforge.net/examples/pylab_examples/symlog_demo.html Although the example doesn't show it, the axis limits don't have to be symmetric. For example, on the top plot, you can use gca().set_xlim([0, 100]) to show only the right-hand side. Eric Ben Root On Wed, May 19, 2010 at 7:03 AM, Christer Malmberg christer.malmberg.0...@student.uu.se mailto:christer.malmberg.0...@student.uu.se wrote: Hi, my problem is that I need a graph with a discontinous y-axis. Let me explain the problem: in my field (microbiology) the data generated from for example growth assays have a huge range (10^0-10^9), which has to be plotted on a semilogy style plot (cell concentration vs. time). The problem is that 0 cells is a useful number to plot (indicates cell concentration lower than detection limit), but of course not possible to show in a log diagram. This is easily solved on old-style logarithmic graph paper; since the data will be either 0, or 1 it is customary just to draw a zero x-axis at 10^-1 on the paper and that's that. On the computer, this is extremely hard. Most people I know resort to various tricks in Excel, such as entering a small number (0.001 etc) and starting the y-axis range from 10^1 to hide the problem. This makes excel draw a line, instead of leaving out the dot and line entirely. The part of the curve below the x-axis is then manually cut off in a suitable image editor. Needless to say, this is extremely kludgy. Even professional graphing packages like Graphpad Prism resort to similar kludges (re-define 0 values to 0.1, change the y-axis tick label to 0 etc.) This problem of course exists in other fields, while investigating a solution I found a guy who worked with aerosol contamination in clean rooms, and he needed to plot values logarithmically, at the same time as showing detector noise around 1-10 particles. He solved it by the same trick I would like to do in Matplotlib, namely plotting a standard semilogy plot but with the 10^-1 to 10^0 decade being replaced by a 0-1 linear axis on the same side. The guy in this post has the same problem and a useful example: http://ubuntuforums.org/showthread.php?t=394851 His partial solution is quite bad though, and I just got stuck while trying to improve it. I looked around the gallery for useful examples, and the closest I could find is the twinx/twiny function, but I didn't manage a plot that put one data curve across both axes. This code gives an image that maybe explains what I'm trying to do: === t = array([0,1,2,4,6,9,12,24]) y = array([100, 50, 10, 100, 5, 1, 0, 0]) subplot(111, xscale=linear, yscale=log) errorbar(x, y, yerr=0.4*y) linbit = axes([0.125, 0.1, 0.775, 0.1],frameon=False) linbit.xaxis.set_visible(False) for tl in linbit.get_yticklabels(): tl.set_color('r') show() === (the y=0 points should be plotted and connected to the line in the log part) Is this possible to do in matplotlib? Could someone give me a pointer on how to go on? Sorry for the long mail, /C -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net mailto:Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] PY2EXE with Matplotlib and wxPython compiles but won't run???
Well I was able to compile the embedding_in_wx5.py example ( I'm not sure why or how) but it works. embedding_in_wx2.py still won't compile but I was able to compile my program and get it to run as expected. I'll leave this as another unresolved mystery of programming... My thanks to the Werner for being there and helping me work this out. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] isolate and locate closed contours
On 5/19/10 3:24 PM, Mike Bauer wrote: Hello, I am hoping that there is a way to use matplotlib to process a sea level pressure field and extract the closed contours therein so that I have a collection of lists with the (lon,lat) pairs that define the perimeter of each closed contour. At the very least I would like a perimeter list of each contour closed or not. I'm guessing the answer might be something like this http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg07915.html Thank you for any ideas. Mike Mike: Yep, that's a good place to start. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX: (303)497-6449 NOAA/OAR/PSD R/PSD1Email : jeffrey.s.whita...@noaa.gov 325 BroadwayOffice : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users