[Matplotlib-users] Set X,Y,and Z data for a pcolormesh
Hi All, I wish to make a 3d volume with a series of slices through it. I have X-Z data at 15 different Y planes. In MATLAB, I would make a pcolor plot, then set the Z data to the original ydata, and the Y data to a constant. This works fine. I would like to achieve a similar result in matplotlib, but I cannot figure out anyway to do it. Any help would be appreciated. James -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Set-X-Y-and-Z-data-for-a-pcolormesh-tp43187.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] scikits.timeseries and matplotlib.finance.candlestick()
Has anyone managed to plot a candlestick chart with a scikits.timeseries? Is there an easy way to wrap the matplotlib.finance.candlestick call? James -- This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] building matplotlib 1.3 on OS X 10.8.4
I built MPL 1.3 from source, all seem to go OK but I ran into the problem of not finding libfreetype.6.dylib when importing. On the web, I found references to this problem for builds on OS X. The solutions refer to a file README.osx, which is not present in the 1.3 distribution. The documentation (http://matplotlib.org/1.3.0/users/installing.html) also refers to this file and appears to be out of date. I have tried fiddling with the LD_LIBRARY paths, but have not come upon a solution. --Jim Boyle-- Introducing Performance Central, a new site from SourceForge and AppDynamics. Performance Central is your source for news, insights, analysis and resources for efficient Application Performance Management. Visit us today! http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] building matplotlib from source in Linux
Hi, I'm installing matplotlib from source on a linux machine (system details below). The module builds and installs without error. I can import pylab successfully from an interactive python prompt. When I plot data, however, pylab.show() brings up an empty plot window (gray background), and pylab.savefig("test.png") makes an empty image (white background). I've tried rebuilding, but with no success (output also below). Suggestions are greatly appreciated, Thanks, James > uname -a Linux mitbbr00 2.6.9-67.0.20.ELhugemem #1 SMP Wed Jun 25 12:40:18 CDT 2008 i686 athlon i386 GNU/Linux > python Python 2.5.4 (r254:67916, Aug 10 2009, 13:16:31) [GCC 3.4.6 20060404 (Red Hat 3.4.6-8)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import matplotlib >>> matplotlib.__version__ '0.99.0' Source obtained from matplotlib sourceforge site No customizations to matplotlibrc Let the file simple_plot.py contain the following: from pylab import * plot([1,2,3]) show() > python simple_plot.py --verbose-helpful $HOME=/afs/lns.mit.edu/user/jbattat CONFIGDIR=/afs/lns.mit.edu/user/jbattat/.matplotlib matplotlib data path /usr/local/lib/python2.5/site-packages/matplotlib/ mpl-data loaded rc file /usr/local/lib/python2.5/site-packages/matplotlib/mpl- data/matplotlibrc matplotlib version 0.99.0 verbose.level helpful interactive is False units is False platform is linux2 font search path ['/usr/local/lib/python2.5/site-packages/matplotlib/ mpl-data/fonts/ttf', '/usr/local/lib/python2.5/site-packages/ matplotlib/mpl-data/fonts/afm'] generated new fontManager backend TkAgg version 8.4 findfont: Matching :family=sans- serif:style =normal:variant=normal:weight=normal:stretch=normal:size=medium to Bitstream Vera Sans (/usr/local/lib/python2.5/site-packages/matplotlib/ mpl-data/fonts/ttf/Vera.ttf) with score of 0.00 > gcc --version gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-8) = = = BUILDING MATPLOTLIB matplotlib: 0.99.0 python: 2.5.4 (r254:67916, Aug 10 2009, 13:16:31) [GCC 3.4.6 20060404 (Red Hat 3.4.6-8)] platform: linux2 REQUIRED DEPENDENCIES numpy: 1.1.1 freetype2: 9.7.3 OPTIONAL BACKEND DEPENDENCIES libpng: 1.2.7 Tkinter: Tkinter: 67737, Tk: 8.4, Tcl: 8.4 wxPython: no * wxPython not found Gtk+: no * Building for Gtk+ requires pygtk; you must be able * to "import gtk" in your build/install environment Mac OS X native: no Qt: no Qt4: no Cairo: no OPTIONAL DATE/TIMEZONE DEPENDENCIES datetime: present, version unknown dateutil: matplotlib will provide pytz: 2008c OPTIONAL USETEX DEPENDENCIES dvipng: no ghostscript: 7.07 latex: 3.14159 pdftops: 3.00 [Edit setup.cfg to suppress the above messages] = = = = pymods ['pylab'] packages ['matplotlib', 'matplotlib.backends', 'matplotlib.projections', 'mpl_toolkits', 'mpl_toolkits.mplot3d', 'mpl_toolkits.axes_grid', 'ma\ tplotlib.sphinxext', 'matplotlib.numerix', 'matplotlib.numerix.mlab', 'matplotlib.numerix.ma', 'matplotlib.numerix.linear_algebra', 'matplotli\ b.numerix.random_array', 'matplotlib.numerix.fft', 'matplotlib.delaunay', 'dateutil', 'dateutil/zoneinfo'] running build running build_py creating build creating build/lib.linux-i686-2.5 copying lib/pylab.py -> build/lib.linux-i686-2.5 creating build/lib.linux-i686-2.5/matplotlib copying lib/matplotlib/__init__.py -> build/lib.linux-i686-2.5/ matplotlib copying lib/matplotlib/_cm.py -> build/lib.linux-i686-2.5/matplotlib copying lib/matplotlib/_mathtext_data.py -> build/lib.linux-i686-2.5/ matplotlib copying lib/matplotlib/_pylab_helpers.py -> build/lib.linux-i686-2.5/ matplotlib copying lib/matplotlib/afm.py -> build/lib.linux-i686-2.5/matplotlib copying lib/matplotlib/artist.py -> build/lib.linux-i686-2.5/matplotlib copying lib/matplotlib/axes.py -> build/lib.linux-i686-2.5/matplotlib copying lib/matplotlib/axis.py -> build/lib.linux-i686-2.5/matplotlib copying lib/matplotlib/backend_bases.py -> build/lib.linux-i686-2.5/ matplotlib copying lib/matplotlib/bezier.py -> build/lib.linux-i686-2.5/matplotlib copying lib/matplotlib/blocki
[Matplotlib-users] contourf() color mapping
Hi, I'm having some trouble producing a filled contour how I want it. Say I'm plotting data over the range [1.2, 20] using 15 level lines evenly spaced over that interval. I'd like the min of that interval to map to the min of the color spectrum (say "jet" so dark blue) and the max of that interval to map to the max of the spectrum (so red). It doesn't seem to work that way. When I do filled contours, sometimes the low values are mapped to black or dark gray and sometimes they're mapped to blue. I always want the endpoints of the spectrum to map to the endpoints of the plotted values. Can this be done? Any help is appreciated. Thanks. - James -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] contourf() color mapping
Great. Just what I needed. I appreciate it. - James On Feb 2, 2010, at 1:56 PM, Eric Firing wrote: > James Conners wrote: >> Hi, >> >> I'm having some trouble producing a filled contour how I want it. >> >> Say I'm plotting data over the range [1.2, 20] using 15 level lines evenly >> spaced >> over that interval. I'd like the min of that interval to map to the min of >> the color spectrum (say "jet" so dark blue) >> and the max of that interval to map to the max of the spectrum (so red). It >> doesn't seem to work that way. >> When I do filled contours, sometimes the low values are mapped to black or >> dark gray and >> sometimes they're mapped to blue. >> >> I always want the endpoints of the spectrum to map to the endpoints of the >> plotted values. Can this be done? >> Any help is appreciated. Thanks. > > The root of the problem is a questionable choice I made in the > _process_colors method of ContourSet; I will investigate either changing > it, or making it an option. In the meantime, there is an easy > workaround: just use the set_clim method of the ContourSet, or the > pyplot.clim function. In ipython -pylab: > > z = rand(10,10) > cs = contourf(z) > cb = colorbar() > cs.set_clim(cs.layers.min(), cs.layers.max()) > draw() > > The idea behind the present default choice for clim within contourf is that > the range of colors covers values from the lowest contour level to the > highest; the color of a *layer* is then the color of the midpoint > between its bounding levels. This has some logic to it (and is more > consistent with pcolor and image color mapping), but I agree that it > probably makes more sense to use the full color range by default; most > often, this is likely to be what one wants, and for the exceptions one > can always use set_clim. > > Eric > >> >> - James >> >> >> -- >> The Planet: dedicated and managed hosting, cloud storage, colocation >> Stay online with enterprise data centers and the best network in the business >> Choose flexible plans and management services without long-term contracts >> Personal 24x7 support from experience hosting pros just a phone call away. >> http://p.sf.net/sfu/theplanet-com >> ___ >> Matplotlib-users mailing list >> Matplotlib-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] vector EPS
>>>>> "M" == Matthias Michler writes: M> I'm sorry, I'm not an expert in eps-graphics. For me the final pics M> look good and I have no idea what is different between matplotlib M> eps-files and eps-files generated somewhere else. Based exclusively on the eps you posted in this thread, MPL took a ttf font (Bitstream Vera Sans) and created a PostSctipt Type3 font from it, rather than embedding the original font as a Type42 font. It is still a vector font, but one which only PS interpreters can rasterize. The OP's downstream seems to want the fonts to be in a format (such as Type1, TTF (which is embedded in PostScipt as Type42) or CFF (which is converted to Type1 when embedded in PostScript)) which their tools can understand, replace, et cetera. If one were to edit the eps in a text editor, and replace the Type3 w/ a Type42 of the original TTF, I suspect the OP's downstream might find the eps more to its liking. Ttftotype42 from <http://www.lcdf.org/type/> can convert TTF to Type42. -JimC -- James Cloos OpenPGP: 1024D/ED7DAEA6 -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] vector EPS
>>>>> "M" == Michael Droettboom writes: M> Matplotlib will output Type 42 fonts if the rcParam "ps.fonttype" M> is set to 42. I read the reply which stated that after sending mine.... Sorry for the noise. -JimC -- James Cloos OpenPGP: 1024D/ED7DAEA6 -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] figure save problem
I have the same problem with nearly identical setup: OS X 10.5.8 - intel matplotlib 99.1.1 python 2.6.1 ipython 0.9.1 numpy-1.3.0 --Jim On Mar 11, 2010, at 1:31 PM, Andre Walker-Loud wrote: > Hi All, > > I am having a problem saving figures produced with matplotlib. Right > now, I am running a freshly built > > matplotlib-0.99.1.2 (unzipped, the directory reads 0.99.1.1?) built on > python-2.6 > numpy-1.3.0 > scipy-0.7.1 > ipython-0.10 > > > All on an OSX 10.5 intel. > > When I try to save a figure, in the "Save the figure" dialogue box, > the "Save As:" window does not recognize any keyboard entries. If I > copy and paste, that works (at first). But I remembered reading about > this problem people were having with Snow Leopard. > > Originally, copy/pasting worked to "workaround" this problem, but I > find that after trying a few other things, I can no longer even paste > anything into the "Save As:" Box. Further, when I click the "Save" or > "Cancel" buttons, they flash like normal, however the dialogue box > does not go away, the file is not saved, and I can't escape! > Ahh! I can still navigate through my folders with the mouse in > the dialogue box, but clearly something is not right. > > > Last week, I had Python 2.5, matplotlib 0.98.6 and everything worked > just fine. > > I have the problem whether running through python or ipython.asdfasdf > > > Any ideas how to fix this? > > > Thanks, > > Andre > > -- > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://*p.sf.net/sfu/intel-sw-dev > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://*lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] plotyy equivalent example -- png output
Below is the working code to plot two different data series with different units on the same graph, with the same x co-ordinates: import pylab # generate some data x = range(0, 10) y1 = [i*i for i in x] y2 = [pylab.sin(0.4*i) for i in x] # the data share x axis but have different y units figure = pylab.gcf() # Get the current figure orig_axis = pylab.gca()# Get the current axis orig_axis.set_axis_off() # Turn it off to avoid complications # use this for the overlapping axes box = [0.14, 0.14, 0.72, 0.72] # This uses the first set of data axis1 = figure.add_axes(box, label = 'axis1') axis1.set_title('TITLE') axis1.plot(x, y1, '-^y') axis1.set_ylabel('AXIS 1 LABEL') axis1.set_xlabel('SHARED X LABEL') axis1.spines['right'].set_visible(False) # This uses the second set of data # Note the same box region is used but the label must be different axis2 = figure.add_axes(box, label = 'axis2') axis2.plot(x, y2, '-sb') axis2.yaxis.set_ticks_position('right') axis2.yaxis.set_label_position('right') axis2.set_ylabel('AXIS 2 LABEL') axis2.spines['bottom'].set_visible(False) axis2.spines['top'].set_visible(False) axis2.spines['left'].set_visible(False) # Write out to a file pylab.savefig('out.png', dpi = 100, transparent = True) Issues: 1) I can't use show() in this case because there is no Transparent parameter. 2) It's still a botch. 3) I tried using alpha but it didn't seem to work at all? Does anyone have a better implementation of this or better ideas? Many thanks James -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plotyy equivalent example -- png output
Thank you Matthias :) I think the problem here is that I never found an example showing 'twin' scales, so I botched it to get the same result! Cheers James -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] OSX 10.5 event.key bug
in matplotlib under 10.5 Mac OS X, if the event.key is 'g' or 'l' then grid plotting ('g') or log plotting ('l') is turned on is this a known bug? any workarounds? J - 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=100&url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Odd problem when saving to eps/ps
Hi I am using Python 2.4.4, Numpy 1.1.1 and Pylab 0.98.3 and have a problem with saving to eps. Basically I create 7 plots, each with 2 subplots of which one is an imshow colour map and the second is a simple plot(). When saving them to eps I can display 5 out of 7 with ghostview but 2 of them fail to display. Setting the file type to PNG I can get all 7 out but this is for a ps latex document so I need eps. If I turn off the plot() subplot I can get all 7 out into eps. All 7 plots are effectively the same just with different data and all 7 display fine via the backend Tkagg. Any ideas Cheers James - 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=100&url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Testing - my posts aren't showing up on the list
Hello, I have found that messages sometimes don't show up on these lists if your options are set not to receive mailings (eg. if you just want to look for replies in the archive). James. Michael Droettboom wrote: > I don't know if there's any way of knowing from the outside... > > You can send your question to me, and I can forward it to the list... > (Seems silly, but it might work.) > > Mike > > Joshua J. Kugler wrote: >> I've sent two messages to this list, and neither have appeared in the >> archives, or come back to me. Did I use the right combination of words >> to get stopped by a spam filter? :) >> >> j - 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=100&url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] OSX 10.5 event.key bug
Using matplotlib 0.98.5 on OSX 10.5, the following error occurs for many key_press events using the standard connect class - letter such as c,v,s etc (and most important, backspace) Exception in Tkinter callback Traceback (most recent call last): File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk/Tkinter.py", line 1403, in __call__ return self.func(*args) File "/Library/Python/2.5/site-packages/matplotlib/backends/backend_tkagg.py", line 312, in key_press FigureCanvasBase.key_press_event(self, key, guiEvent=event) File "/Library/Python/2.5/site-packages/matplotlib/backend_bases.py", line 1122, in key_press_event self.callbacks.process(s, event) File "/Library/Python/2.5/site-packages/matplotlib/cbook.py", line 155, in process func(*args, **kwargs) File "/Library/Python/2.5/site-packages/matplotlib/backend_bases.py", line 1626, in key_press self.canvas.toolbar.back() AttributeError: FigureCanvasTkAgg instance has no attribute 'toolbar' would a full list of the "bad" keys help? J -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] OSX 10.5 event.key bug
Using matplotlib 0.98.5 on OSX 10.5, the following error occurs for many key_press events using the standard connect class - letter such as c,v,s etc (and most important, backspace) Exception in Tkinter callback Traceback (most recent call last): File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk/Tkinter.py", line 1403, in __call__ return self.func(*args) File "/Library/Python/2.5/site-packages/matplotlib/backends/backend_tkagg.py",line 312, in key_press FigureCanvasBase.key_press_event(self, key, guiEvent=event) File "/Library/Python/2.5/site-packages/matplotlib/backend_bases.py", line 1122, in key_press_event self.callbacks.process(s, event) File "/Library/Python/2.5/site-packages/matplotlib/cbook.py", line 155, in process func(*args, **kwargs) File "/Library/Python/2.5/site-packages/matplotlib/backend_bases.py", line 1626, in key_press self.canvas.toolbar.back() AttributeError: FigureCanvasTkAgg instance has no attribute 'toolbar' would a full list of the "bad" keys help? J -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] bad keys in event.key
Using matplotlib 0.98.5 on OSX 10.5, the following error occurs for many key_press events using the standard connect class - letter such as c,v,s etc (and most important, backspace) Exception in Tkinter callback Traceback (most recent call last): File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk/Tkinter.py", line 1403, in __call__ return self.func(*args) File "/Library/Python/2.5/site-packages/matplotlib/backends/backend_tkagg.py",line 312, in key_press FigureCanvasBase.key_press_event(self, key, guiEvent=event) File "/Library/Python/2.5/site-packages/matplotlib/backend_bases.py", line 1122, in key_press_event self.callbacks.process(s, event) File "/Library/Python/2.5/site-packages/matplotlib/cbook.py", line 155, in process func(*args, **kwargs) File "/Library/Python/2.5/site-packages/matplotlib/backend_bases.py", line 1626, in key_press self.canvas.toolbar.back() AttributeError: FigureCanvasTkAgg instance has no attribute 'toolbar' would a full list of the "bad" keys help? J -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] bad keys in event.key
I downloaded keypress_demo.py from the matplotlib website runs as follows ./keypress_demo.py (then typed letter 'c') Exception in Tkinter callback Traceback (most recent call last): File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk/Tkinter.py", line 1403, in __call__ return self.func(*args) File "/Library/Python/2.5/site-packages/matplotlib/backends/backend_tkagg.py", line 312, in key_press FigureCanvasBase.key_press_event(self, key, guiEvent=event) File "/Library/Python/2.5/site-packages/matplotlib/backend_bases.py", line 1122, in key_press_event self.callbacks.process(s, event) File "/Library/Python/2.5/site-packages/matplotlib/cbook.py", line 155, in process func(*args, **kwargs) File "/Library/Python/2.5/site-packages/matplotlib/backend_bases.py", line 1626, in key_press self.canvas.toolbar.back() AttributeError: FigureCanvasTkAgg instance has no attribute 'toolbar' now you are making me think something is wrong with my build, but this is an out of the box laptop, 10.5, numpy 1.2.1, zlib-1.2.3, freetype-2.3.7, libpng-1.2.33, then build matplotlib-0.98.5 J note: i backed down to 0.98.3, it works fine John Hunter wrote: > On Wed, Dec 17, 2008 at 1:24 PM, James Schombert wrote: >> Using matplotlib 0.98.5 on OSX 10.5, the following error >> occurs for many key_press events using the standard >> connect class - letter such as c,v,s etc (and most important, backspace) >> >> Exception in Tkinter callback >> Traceback (most recent call last): >> File >> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk/Tkinter.py", >> line 1403, in __call__ >> return self.func(*args) >> File >> "/Library/Python/2.5/site-packages/matplotlib/backends/backend_tkagg.py",line >> 312, in key_press >> FigureCanvasBase.key_press_event(self, key, guiEvent=event) >> File "/Library/Python/2.5/site-packages/matplotlib/backend_bases.py", >> line 1122, in key_press_event >> self.callbacks.process(s, event) >> File "/Library/Python/2.5/site-packages/matplotlib/cbook.py", line 155, >> in process >> func(*args, **kwargs) >> File "/Library/Python/2.5/site-packages/matplotlib/backend_bases.py", >> line 1626, in key_press >> self.canvas.toolbar.back() >> AttributeError: FigureCanvasTkAgg instance has no attribute 'toolbar' >> >> would a full list of the "bad" keys help > > I am not seeing this on the 0.98.5 release candidate. I fire up > > > python simple_plot.py -dTkAgg > > and click 'c' somewhere on the figure/axes, or 'delete' and I am not > getting the traceback. > > JDH -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] possible kludge for masked value colors in contourf?
As far as I can tell, you cannot specify the color that contourf uses for masked values. The examples enclosed with matplotlib ( 0.98.3) specifically comment that this is the case. It appears that contourf just does not plot anything where the masked values occur and the background ( usually white ) is what is seen. This is very useful but I would like to have a bit more choice in how the areas of masked data are represented. I came up with the following hack which seems to work, but being far from expert I wanted to know if anyone wished to help or give advice. Is this reasonable or what ? In the code below data is a masked array with some areas masked. The result is that the missing areas are now black rather than white ( the default background, I guess) fig = pylab.figure() ax = fig.add_subplot(111) ax.axesPatch.set_facecolor('k') cs = ax.contourf(data) pylab.savefig('example') I am aware that pcolor , pcolormesh and using cm.set_bad will work but I also wanted the option for contourf - it produces nice looking plots. Thanks for any help. --Jim -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] 2nd Tk window from matplotlib
can anyone recommend the best method in which to open a 2nd Tk window from matplotlib? One where you might enter some data to be read by the main script in an interactive way. Current attempting an Tk commands will just reajust the plot window. J -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Code attached for autoscaled text around graph
All, Attached, and below, is public domain code for making variable-sized plots with autoscaled text that exactly fits the available visual plot space, useful for web sites where users choose output files with different sizes. Examples are at the bottom of the file. James R. Phillips 2548 Vera Cruz Drive Birmingham, AL 35235 USA email: zun...@zunzun.com http://zunzun.com #Entered into the public domain 20 March 2009 #James R. Phillips #2548 Vera Cruz Drive #Birmingham, AL 35235 USA #email: zun...@zunzun.com #http://zunzun.com import numpy as np import math, matplotlib matplotlib.use('Agg') # must be used prior to the next two statements import matplotlib.pyplot as plt import matplotlib.mlab as mlab def DetermineOnOrOffFromString(in_String): tempString = in_String.split('_')[-1:][0].upper() # allows any amount of prefacing text if tempString == 'ON': return True return False def DetermineScientificNotationFromString(inData, in_String): tempString = in_String.split('_')[-1:][0].upper() # allows any amount of prefacing text if tempString == 'ON': return True elif tempString == 'OFF': return False else: # must be AUTO minVal = np.abs(np.min(inData)) maxVal = np.abs(np.max(inData)) deltaVal = np.abs(maxVal - minVal) scientificNotation = False if (maxVal > 100.0) or (minVal < -100.0) or (deltaVal < .05): scientificNotation = True return scientificNotation def CommonPlottingCode(in_WidthInPixels, in_HeightInPixels, in_XName, in_YName, in_UseOffsetIfNeeded, in_X_UseScientificNotationIfNeeded, in_Y_UseScientificNotationIfNeeded, in_Left, in_Bottom, in_Right, in_Top): # default to lots of room around graph # a litle more room between x axis and tick mark labels, so not text overlap at the bottom left corner - set this before other calls matplotlib.rcParams['xtick.major.pad'] = 5+ (float(in_HeightInPixels) / 100.0) # minimum + some scaled fig = plt.figure(figsize=(float(in_WidthInPixels ) / 100.0, float(in_HeightInPixels ) / 100.0), dpi=100) fig.subplotpars.update(in_Left, in_Bottom, in_Right, in_Top) ax = fig.add_subplot(111, frameon=True) # white background, almost no border space fig.set_facecolor('w') xFormatter = fig.gca().xaxis.get_major_formatter() xFormatter._useOffset = in_UseOffsetIfNeeded xFormatter.set_scientific(in_X_UseScientificNotationIfNeeded) fig.gca().xaxis.set_major_formatter(xFormatter) yFormatter = fig.gca().yaxis.get_major_formatter() yFormatter._useOffset = in_UseOffsetIfNeeded yFormatter.set_scientific(in_Y_UseScientificNotationIfNeeded) fig.gca().yaxis.set_major_formatter(yFormatter) # Scale text to imagesize. Text sizes originally determined at image size of 500 x 400 widthRatioForTextSize = float(in_WidthInPixels) / 500.0 heightRatioForTextSize = float(in_HeightInPixels) / 400.0 for xlabel_i in ax.get_xticklabels(): xlabel_i.set_fontsize(xlabel_i.get_fontsize() * heightRatioForTextSize) xOffsetText = fig.gca().xaxis.get_offset_text() xOffsetText.set_fontsize(xOffsetText.get_fontsize() * heightRatioForTextSize * 0.9) for ylabel_i in ax.get_yticklabels(): ylabel_i.set_fontsize(ylabel_i.get_fontsize() * widthRatioForTextSize) yOffsetText = fig.gca().yaxis.get_offset_text() yOffsetText.set_fontsize(yOffsetText.get_fontsize() * heightRatioForTextSize * 0.9) x_label = ax.set_xlabel(in_XName) y_label = ax.set_ylabel(in_YName) x_label._fontproperties._size = x_label._fontproperties._size * heightRatioForTextSize y_label._fontproperties._size = y_label._fontproperties._size * widthRatioForTextSize plt.grid(True) # call this just before returning return fig, ax def YieldNewExtentsAndNumberOfMajor_X_TickMarks(fig, ax, in_WidthInPixels, in_HeightInPixels, in_OffsetUsed): # draw everything so items can be measured for size canvas = plt.get_current_fig_manager().canvas canvas.draw() # some preliminary info xLabelPoints = ax.set_xlabel(ax.get_xlabel()).get_window_extent().get_points() # [ [x,y], [x,y] ] yLabelPoints = ax.set_ylabel(ax.get_ylabel()).get_window_extent().get_points() # [ [x,y], [x,y] ], rotated 90 degrees xTickZeroPoints = ax.get_xticklabels()[0].get_window_extent().get_points() yTickZeroPoints = ax.get_yticklabels()[0].get_window_extent().get_points() xTickIndexPoints = ax.get_xticklabels()[len(ax.get_xticklabels())-1].get_window_extent().get_points() yTickIndexPoints = ax.get_yticklabels()[len(ax.get_yticklabels())-1].get_window_extent().get_points() currentPoints = ax.bbox.get_points() maxLeft = currentPoints[0][0] maxBottom = currentPoints[0][1] maxRight = currentPoints[1][0] maxTop = currentPo
[Matplotlib-users] capsize on errorbars
Dear MPL gurus, I've probably failed to RTFM properly. I'm trying to produce error bars with horizontal lines at the top of the vertical error bars to cap them. I've tried adjusting capsize on both plt.bar and plt.errorbar, but have not had any success. I think I had this working previously with 1.0.1, but can't remember for definite. Matplotlib: 1.1.0 Python version: 2.7.2 IPython: 0.11 Windows XP 32 bit Many thanks for any pointers, and apologies if I have missed an obvious setting. James === begin example code === import matplotlib.pyplot as plt import numpy as np plt.ion() X = np.array([.5,1.5,2.5,3.5]) Y = np.array([1,2,3,4]) dY = np.array([.1,.2,.3,.4]) f = plt.figure() ax = f.add_subplot(111) A = plt.bar(X, Y, yerr=dY, ecolor='red', capsize=10) A[0].set_facecolor('black') A[1].set_facecolor('gray') A[2].set_facecolor('black') A[3].set_facecolor('gray') ax.set_xlim([0.,4.8]) plt.show() This message may contain confidential information. If you are not the intended recipient please inform the sender that you have received the message in error before deleting it. Please do not disclose, copy or distribute information in this e-mail or take any action in reliance on its contents: to do so is strictly prohibited and may be unlawful. Thank you for your co-operation. This email has been processed by SmoothZap - www.smoothwall.net -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] capsize on errorbars
Ben, Adjusting mew sorted it out. Somewhere along the line, I'd changed lines.markeredgewidth in my matplotlibrc to 0, so it wasn't drawing the lines. Now I know the caps are drawn as a dashed marker, it meant that the lines around it weren't being drawn (or rather they were, but with zero width). With mew>0, if I change capsize, the width of the cap now adjusts accordingly. Many thanks. James From: ben.v.r...@gmail.com [mailto:ben.v.r...@gmail.com] On Behalf Of Benjamin Root Sent: 08 November 2011 16:41 To: Blake, James Cc: matplotlib-users@lists.sourceforge.net Subject: Re: [Matplotlib-users] capsize on errorbars On Tue, Nov 8, 2011 at 9:57 AM, Blake, James wrote: Dear MPL gurus, I've probably failed to RTFM properly. I'm trying to produce error bars with horizontal lines at the top of the vertical error bars to cap them. I've tried adjusting capsize on both plt.bar and plt.errorbar, but have not had any success. I think I had this working previously with 1.0.1, but can't remember for definite. Matplotlib: 1.1.0 Python version: 2.7.2 IPython: 0.11 Windows XP 32 bit Many thanks for any pointers, and apologies if I have missed an obvious setting. James === begin example code === import matplotlib.pyplot as plt import numpy as np plt.ion() X = np.array([.5,1.5,2.5,3.5]) Y = np.array([1,2,3,4]) dY = np.array([.1,.2,.3,.4]) f = plt.figure() ax = f.add_subplot(111) A = plt.bar(X, Y, yerr=dY, ecolor='red', capsize=10) A[0].set_facecolor('black') A[1].set_facecolor('gray') A[2].set_facecolor('black') A[3].set_facecolor('gray') ax.set_xlim([0.,4.8]) plt.show() Are you trying to widen the cap, or make it thicker? I forget which does which, but in my plots, I use "capsize" for one of them and "mew" (markeredgewidth) for the other. If I remember correctly, the errorbar caps are actually a dash marker turned on its side. If that is the case, then adjusting "mew" would adjust the thickness. Ben Root This message may contain confidential information. If you are not the intended recipient please inform the sender that you have received the message in error before deleting it. Please do not disclose, copy or distribute information in this e-mail or take any action in reliance on its contents: to do so is strictly prohibited and may be unlawful. Thank you for your co-operation. This email has been processed by SmoothZap - www.smoothwall.net -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] SyntaxError: matplotlib python3 install problem
Hi, I downloaded a zip from the master on the github matplotlib repository, when I run: python3 setup.py install I get several 'SyntaxError: invalid syntax' errors which appear to highlight quotes ... byte-compiling /usr/local/lib/python3.2/site-packages/matplotlib/sphinxext/plot_directive.py to plot_directive.cpython-32.pyc File "/usr/local/lib/python3.2/site-packages/matplotlib/sphinxext/plot_directive.py", line 510 exec "import numpy as np\nfrom matplotlib import pyplot as plt\n" in ns ^ SyntaxError: invalid syntax byte-compiling /usr/local/lib/python3.2/site-packages/matplotlib/backends/backend_svg.py to backend_svg.cpython-32.pyc File "/usr/local/lib/python3.2/site-packages/matplotlib/backends/backend_svg.py", line 69 s = s.replace(u"&", u"&") ^ SyntaxError: invalid syntax ... Full output is here: https://gist.github.com/3656878 I'm running Scientific Linux 5.4 and numpy appears to work ok installed via pip-3.2. Any ideas? -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] masked array problem
I am having a problem when using masked arrays. The attached scripts are identical except for the data. One will actually produce a plot, whereas the other will not. I cannot figure out what I am doing wrong, such that the second script fails. Am I doing something wrong with this, or is this an actual bug? Thanks, --James Evans masked_array-fail.py Description: Binary data masked_array-good.py Description: Binary data -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Sigmoid Curve Fitting
Chris Spencer writes: > > I had already encountered zunzun.com while Googling the problem. I'm > not sure what to make of it, although it seems to be an online > curve-fitting service. Unfortunately, my usage requires the ability to > run the process locally. The fitting source code for http://zunzun.com is freely available under a BSD-style license on Google's source code repository at http://code.google.com/p/pythonequations/downloads/list and comes with many examples - so you *can* run it locally. James Phillips zun...@zunzun.com http://zunzun.com -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Installing matplotlib from source on Snow Leopard
Hi, I'm having trouble with my built-from-source installation of matplotlib on Snow Leopard (I also tried installing from the .dmg file, but that install failed -- see below for details). I downloaded: matplotlib-1.0.0.tar.gz and then built and installed: > tar xvzf matplotlib-1.0.0.tar.gz > cd matplotlib-1.0.0 > python setup.py build > python setup.py install Then tried using pylab: > cd > 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 pylab Traceback (most recent call last): File "", line 1, in File "/Library/Python/2.6/site-packages/pylab.py", line 1, in from matplotlib.pylab import * File "/Library/Python/2.6/site-packages/matplotlib/pylab.py", line 216, in from matplotlib import mpl # pulls in most modules File "/Library/Python/2.6/site-packages/matplotlib/mpl.py", line 2, in from matplotlib import axis File "/Library/Python/2.6/site-packages/matplotlib/axis.py", line 10, in import matplotlib.font_manager as font_manager File "/Library/Python/2.6/site-packages/matplotlib/font_manager.py", line 52, in from matplotlib import ft2font ImportError: dlopen(/Library/Python/2.6/site-packages/matplotlib/ft2font.so, 2): Symbol not found: _FT_Attach_File Referenced from: /Library/Python/2.6/site-packages/matplotlib/ft2font.so Expected in: flat namespace in /Library/Python/2.6/site-packages/matplotlib/ft2font.so I've seen both of these problems listed elsewhere, but no solution posted: http://www.mailinglistarchive.com/html/matplotlib-users@lists.sourceforge.net/2010-09/msg00091.html Any help is greatly appreciated. Here's information on my environment: Mac OS X 10.6.4 > uname -a Darwin My-MacBook-Pro.local 10.4.0 Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 2010; root:xnu-1504.7.4~1/RELEASE_I386 i386 I was building from source because I was not able to install from the DMG installer (matplotlib-1.0.0-python.org-py2.6-macosx10.4.dmg). When I tried the .dmg installer, I got the following message: matplotlib 1.0.0-r0 can't be installed on this disk. matplotlib requires System Python 2.6 to install Thanks for your help, James -- Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Axes labels crooked using mplot3d in WX
From: ben.v.r...@gmail.com [mailto:ben.v.r...@gmail.com] On Behalf Of Benjamin Root On Wed, Nov 10, 2010 at 3:12 PM, unij mailto:jdavidhei...@unisynmedical.com>> wrote: I'm trying to use mplot3d in a Wx based application, and most things seem to be working fine. The one issue that keeps tripping me up is that the axes labels are drawn at a weird angle. If I do the same type of plot without using wx, then this problem goes away. I am completely stumped as to where to even begin looking to fix this problem, so I would appreciate any pointers you can give me. I've attached a screenshot showing what I am talking about - a simple plot where the axes labels look strange. http://old.nabble.com/file/p30184616/mplot3d.jpg I can reproduce the weird angle issue, but I can't seem to find a backend where it doesn't occur. Could you run "import matplotlib; print matplotlib.get_backend()" to determine which backend you are using when everything looks ok? Also, could you report the output of "matplotlib.__version__"? If it happens for all backends then the problem is in mplot3d/axis3d.py. Unfortunately, the code there is a little light on commenting, but i don't notice any glaring mathematical error off the bat. Ben Root That's actually a really good point and something I didn't explain well - I didn't go out of my way to test with other backends, but rather I tried it by recreating the plot independently of my GUI, creating the same plot using pyplot, following the example in scatter3d_demo.py from the sourceforge demos page. If I then import matplotlib and check the backend, I get that it's TkAgg, but I'm not sure whether that backend is actually being used - is it? I did just try changing between Wx and WxAgg for the backends, and the positions of the labels definitely move around in weird ways between the two, so I think I'm now even more confused than I was before. James -- Centralized Desktop Delivery: Dell and VMware Reference Architecture Simplifying enterprise desktop deployment and management using Dell EqualLogic storage and VMware View: A highly scalable, end-to-end client virtualization framework. Read more! http://p.sf.net/sfu/dell-eql-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Axes labels crooked using mplot3d in WX
From: ben.v.r...@gmail.com [mailto:ben.v.r...@gmail.com] On Behalf Of Benjamin Root Sent: Thursday, November 11, 2010 12:20 PM To: James Davidheiser; Matplotlib Users Subject: Re: [Matplotlib-users] Axes labels crooked using mplot3d in WX On Thu, Nov 11, 2010 at 12:20 PM, Benjamin Root mailto:ben.r...@ou.edu>> wrote: On Thu, Nov 11, 2010 at 9:31 AM, James Davidheiser mailto:jdavidhei...@unisynmedical.com>> wrote: From: ben.v.r...@gmail.com<mailto:ben.v.r...@gmail.com> [mailto:ben.v.r...@gmail.com<mailto:ben.v.r...@gmail.com>] On Behalf Of Benjamin Root Sent: Thursday, November 11, 2010 8:19 AM To: James Davidheiser Cc: matplotlib-users@lists.sourceforge.net<mailto:matplotlib-users@lists.sourceforge.net> Subject: Re: [Matplotlib-users] Axes labels crooked using mplot3d in WX On Thu, Nov 11, 2010 at 8:49 AM, James Davidheiser mailto:jdavidhei...@unisynmedical.com>> wrote: From: ben.v.r...@gmail.com<mailto:ben.v.r...@gmail.com> [mailto:ben.v.r...@gmail.com<mailto:ben.v.r...@gmail.com>] On Behalf Of Benjamin Root On Wed, Nov 10, 2010 at 3:12 PM, unij mailto:jdavidhei...@unisynmedical.com>> wrote: I'm trying to use mplot3d in a Wx based application, and most things seem to be working fine. The one issue that keeps tripping me up is that the axes labels are drawn at a weird angle. If I do the same type of plot without using wx, then this problem goes away. I am completely stumped as to where to even begin looking to fix this problem, so I would appreciate any pointers you can give me. I've attached a screenshot showing what I am talking about - a simple plot where the axes labels look strange. http://old.nabble.com/file/p30184616/mplot3d.jpg I can reproduce the weird angle issue, but I can't seem to find a backend where it doesn't occur. Could you run "import matplotlib; print matplotlib.get_backend()" to determine which backend you are using when everything looks ok? Also, could you report the output of "matplotlib.__version__"? If it happens for all backends then the problem is in mplot3d/axis3d.py. Unfortunately, the code there is a little light on commenting, but i don't notice any glaring mathematical error off the bat. Ben Root That's actually a really good point and something I didn't explain well - I didn't go out of my way to test with other backends, but rather I tried it by recreating the plot independently of my GUI, creating the same plot using pyplot, following the example in scatter3d_demo.py from the sourceforge demos page. If I then import matplotlib and check the backend, I get that it's TkAgg, but I'm not sure whether that backend is actually being used - is it? I did just try changing between Wx and WxAgg for the backends, and the positions of the labels definitely move around in weird ways between the two, so I think I'm now even more confused than I was before. James The difference between a gui kit like Wx and its Agg equivalent is probably expected. Agg renderers bring additional capabilities and functionality with respect to rendering special vector-based graphics such as fonts. For example, while examining this bug, I noticed that the GTK backend can only represent fonts with either a 0 degree rotation, or 90 degree rotation, while the GTKAgg doesn't have that limitation. I have tested Wx, WxAgg, GTK, GTKAgg, QTAgg, QT4Agg, and TkAgg and have found them all to be rotating the text incorrectly. GTK doesn't rotate at all, and emits an error (I wonder if we can catch this and perform an appropriate failback?). Wx does not appear to be performing the translation step properly, causing the label to appear on top of the tick labels. The other backends all seem to have similar results. I wonder if the calculation for the text angle is off because maybe it is not using all 3 dimensions? In other words, the text appear to fail to take into account depth perception. I will take another peek at the code and see what I can figure out. Ben Root I also noticed that the problem is dependent on window / frame dimensions - resize the frame, and the angle changes. For nearly square windows, the angles are almost correct, but as you go to more rectangular aspect ratios, the text gets skewed. I'm guessing that means the error has something to do with the assumptions the code is making about how the window is scaled, which break down when you're not in a square. James Astute observation. Digging further, I have noticed that the source of the problem is that the angle given to a text object is relative to the display coordinate system. So, no matter how one resizes the figure window, the text angle is *always* the same. When the aspect ratio is square, then everything lines up right. I am going to look into making text objects aware of transforms for rotation purposes t
[Matplotlib-users] Line2D: drawstyle + pick_event
'pick_event' fires when I pick on either the marker or the line segment of a Line2D object. But if I change the drawstyle to use steps (steps-pre, steps-post, steps-mid), picking on the line segment is broken. It still seems to think the line is linear. This leads to very strange behavior where picking on a line gives no feedback (e.g. a tooltip), but picking on a blank part of the graph does. Do I need to write my own custom picker function or is this an oversight in the code? Thanks, Jim -- Index, Search & Analyze Logs and other IT data in Real-Time with Splunk Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. Free Software Download: http://p.sf.net/sfu/splunk-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Colorbar labels never appear vertically
Hi, I am having a problem where the colorbar labels will never appear vertically, even when their rotation is specified as "vertical". As you can see in the screenshot here: http://minus.com/lbOJyOljH this creates problems when the labels are cut off and generally looks unprofessional. I am creating the colorbars with code like: cbar1.set_label("Lifetime [$\mu$s]", rotation='vertical') And yet the specified rotation has no effect. Any help would be much appreciated, James -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Colorbar labels never appear vertically
I made this standalone script here: http://pastebin.com/AnKeCwiU and this does not suffer from the issue. For comparison here is the plotting function in my program: http://pastebin.com/7xxtPQYb The only major difference is the use of the interactive display in the script, against the use of Figure and the GTK canvas in my application. I am using matplotlib 1.0.1 On 19 August 2011 10:28, Eric Firing wrote: > On 08/18/2011 09:53 PM, James McMurray wrote: > > Hi, > > > > I am having a problem where the colorbar labels will never appear > > vertically, even when their rotation is specified as "vertical". As you > > can see in the screenshot here: http://minus.com/lbOJyOljH this creates > > problems when the labels are cut off and generally looks unprofessional. > > > > I am creating the colorbars with code like: > > cbar1.set_label("Lifetime [$\mu$s]", rotation='vertical') > > I don't understand; even with no kwarg, the label on a vertical colorbar > will be vertical. It has been that way for as long as I can remember. > > What mpl version are you using? > Please provide a minimal standalone script showing the problem. > > Eric > > > > > > > And yet the specified rotation has no effect. > > > > Any help would be much appreciated, > > James > > > > > > > > > -- > > Get a FREE DOWNLOAD! and learn more about uberSVN rich system, > > user administration capabilities and model configuration. Take > > the hassle out of deploying and managing Subversion and the > > tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 > > > > > > > > ___ > > Matplotlib-users mailing list > > Matplotlib-users@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > -- > Get a FREE DOWNLOAD! and learn more about uberSVN rich system, > user administration capabilities and model configuration. Take > the hassle out of deploying and managing Subversion and the > tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Colorbar labels never appear vertically
After some testing, it appears to be caused by the use of LaTeX in the labels which then prevents it from being rotated (but only inside the GTK application). I have no idea why this is only occurring when it is not in interactive mode, but I guess for the time being I can just try not to use LaTeX. On 19 August 2011 10:57, James McMurray wrote: > I made this standalone script here: http://pastebin.com/AnKeCwiU and this > does not suffer from the issue. For comparison here is the plotting function > in my program: http://pastebin.com/7xxtPQYb > > The only major difference is the use of the interactive display in the > script, against the use of Figure and the GTK canvas in my application. > > I am using matplotlib 1.0.1 > > > On 19 August 2011 10:28, Eric Firing wrote: > >> On 08/18/2011 09:53 PM, James McMurray wrote: >> > Hi, >> > >> > I am having a problem where the colorbar labels will never appear >> > vertically, even when their rotation is specified as "vertical". As you >> > can see in the screenshot here: http://minus.com/lbOJyOljH this >> creates >> > problems when the labels are cut off and generally looks unprofessional. >> > >> > I am creating the colorbars with code like: >> > cbar1.set_label("Lifetime [$\mu$s]", rotation='vertical') >> >> I don't understand; even with no kwarg, the label on a vertical colorbar >> will be vertical. It has been that way for as long as I can remember. >> >> What mpl version are you using? >> Please provide a minimal standalone script showing the problem. >> >> Eric >> >> >> >> > >> > And yet the specified rotation has no effect. >> > >> > Any help would be much appreciated, >> > James >> > >> > >> > >> > >> -- >> > Get a FREE DOWNLOAD! and learn more about uberSVN rich system, >> > user administration capabilities and model configuration. Take >> > the hassle out of deploying and managing Subversion and the >> > tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 >> > >> > >> > >> > ___ >> > Matplotlib-users mailing list >> > Matplotlib-users@lists.sourceforge.net >> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> >> >> -- >> Get a FREE DOWNLOAD! and learn more about uberSVN rich system, >> user administration capabilities and model configuration. Take >> the hassle out of deploying and managing Subversion and the >> tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 >> ___ >> Matplotlib-users mailing list >> Matplotlib-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Highlight values outside colorbar limits
Hi, Is it possible to color values outside the colorbar limits in a different color than the colorbar itself. So for example, an otherwise greyscale plot could have the values outside the upperlimit in blue and those below the lower limit in red, so that these points are not confused with the legitimate data points (as they can be when they are just more black and white points as default). Thanks, James McMurray -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Highlight values outside colorbar limits
Okay, so using cm.set_over() and set_under works, but is there any way of adding the set colors to the edges of the colorbar? On 29 August 2011 15:47, James McMurray wrote: > Hi, > > Is it possible to color values outside the colorbar limits in a different > color than the colorbar itself. So for example, an otherwise greyscale plot > could have the values outside the upperlimit in blue and those below the > lower limit in red, so that these points are not confused with the > legitimate data points (as they can be when they are just more black and > white points as default). > > Thanks, > James McMurray > -- EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] discrete non-uniform intervals colorbar
I wish to make a color filled plot with the colors defined for discrete, non-uniform intervals. Something like: 0.0 -0.001 0.001-0.05 0.05-0.2 0.2-0.4 0.4-0.8 0.8-1.0 red blue green magenta yellowcyan with the colorbar labeled appropriately. I have seen discussions and solutions for discrete colors but not for non-uniform intervals + discrete. The last post I saw regarding this type of issue was august 2005 - and a solution was not resolved at that time. However, Eric has done a huge amount of work in the intervening time and a smarter person than myself might have a solution now. Note that I do not wish just to make contours - although that would be good - but to have a general mapping code that joins allows the color rmapping to be passed to colorbar. maybe some sub-class of scalarMappable that could work. Thanks for any help. --Jim - 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] [discrete non-uniform intervals colorbar
Eric, Thanks for the quick reply. I should have looked more closely at the examples for the contourf solution. As I indicated, my problem is a bit beyond contours. I have routines that fill polygons ( finite element mesh) using a specified color map. The ability to fill areas with the proper color is easy - getting the corresponding color bar has been the more interesting part. It is going to take some time to look over your suggestion to see how I could implement it in my application. Presently I sub-class scalarMappable, and set the appropriate values and pass this to colorbar(). However, I have not been able to figure out how to do this for non-uniform intervals. This is a long winded way of saying that getting pcolor and matshow to work may or may not solve my specific problem. Thanks again, --Jim On Apr 18, 2007, at 1:52 AM, Eric Firing wrote: > James Boyle wrote: >> I wish to make a color filled plot with the colors defined for >> discrete, non-uniform intervals. Something like: >> 0.0 -0.001 0.001-0.05 0.05-0.2 0.2-0.4 0.4-0.8 >> 0.8-1.0 >> red blue green magenta >> yellowcyan >> with the colorbar labeled appropriately. >> I have seen discussions and solutions for discrete colors but not >> for non-uniform intervals + discrete. >> The last post I saw regarding this type of issue was august 2005 >> - and a solution was not resolved at that time. >> However, Eric has done a huge amount of work in the intervening >> time and a smarter person than myself might have a solution now. >> Note that I do not wish just to make contours - although that >> would be good - but to have a general mapping code that joins >> allows the color rmapping to be passed to colorbar. >> maybe some sub-class of scalarMappable that could work. > > This is very easy for contourf, and is illustrated in the second > figure made by examples/contourf_demo.py. For your case above, it > would be something like > > levs = [0, 0.001, 0.05, 0.2, 0.4, 0.8, 1] > colors = ['r', 'b', 'g', 'm', 'y', 'c'] > contourf(z, levs, colors=colors) > colorbar() > > Unfortunately, although it *should* be just as easy for imshow or > pcolor, it is not at present; it can be done, probably in several > ways, but not in such a transparent way. Attached is a quick > attempt at something that might be close to what you need. The > right way to do this is to make some changes and additions to > colors.py and colorbar.py; I might get to that in a few days, or, > more likely, it might be a few weeks. > > Eric > >> Thanks for any help. >> --Jim > import pylab as P > import numpy > from matplotlib import colors > > class BoundaryNorm(colors.Normalize): > def __init__(self, boundaries): > self.vmin = boundaries[0] > self.vmax = boundaries[-1] > self.boundaries = boundaries > self.N = len(self.boundaries) > > def __call__(self, x, clip=False): > x = numpy.asarray(x) > ret = numpy.zeros(x.shape, dtype=numpy.int) > for i, b in enumerate(self.boundaries): > ret[numpy.greater_equal(x, b)] = i > ret[numpy.less(x, self.vmin)] = -1 > ret = numpy.ma.asarray(ret / float(self.N-1)) > return ret > > bounds = [0, 0.1, 0.5, 1] > cm = colors.ListedColormap(['r', 'g', 'b']) > > z = (numpy.arange(5)[:,None] * numpy.arange(8)[None,:]).astype > (numpy.float) > z = z / z.max() > > P.pcolor(z, cmap=cm, norm=BoundaryNorm(bounds)) > P.colorbar(boundaries=bounds) > P.show() - 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] color bar label?
What is the easiest way to put a label on the color bar. I am thinking of putting units either below or next to the bar. I do not see this in the examples or wiki. My first guess is to get hold of the axis for the colorbar and put a label using this - but this seems a bit roundabout. --Jim - 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] Basemap - coastlines overlay question
The code at the end of this message is a toy example which shows the problem I am encountering. OS X 10.4.9 basemap 0.9.5 (Numeric 24.2 and Numpy 1.0) python 2.5 I define a map projection using Basemap, and then plot a number of markers at various geographical locations. I would like the map coastlines to overlay the marker symbols, that is write over them as they pass through them. I cannot get the coastlines to overlay the markers, no matter what the calling sequence. The markers always obscure the coastlines. In the basemap/example contour_demo.py, the coastlines are called after contourf and the coastlines appear over the filled contours. So there seems that there is something different in the plot marker characteristics. I am probably missing something obvious - but what? --Jim import pylab from matplotlib.toolkits.basemap import Basemap rawindLocations =[(-12.425,130.891),(-11.3081,131.7651), (-12.5858,131.7609),(-11.40891,130.41669),(-13.2287,131.1355), (-12.4,129.8)] keyLat = -12.425 keyLon = 130.891 fig = pylab.figure(figsize = (7,10) ) ax = fig.add_axes([0.1,0.1,0.7,0.7]) m = Basemap(llcrnrlon=keyLon-5.0,llcrnrlat=keyLat-5.0,urcrnrlon=keyLon +5.0,urcrnrlat=keyLat +5.0,resolution='i',projection='merc',lon_0=130,lat_ts=0.,lat_0=-12.5) xmap,ymap = m([keyLon],[keyLat]) pts = m.plot(xmap, ymap,'gs') for p in rawindLocations: xmap,ymap = m(p[1],p[0]) pts = m.plot([xmap], [ymap],'rs',markersize=24) xmap,ymap = m([keyLon],[keyLat]) pts = m.plot(xmap, ymap,'ch',markersize=36) m.drawcoastlines() m.drawcountries() title = 'example' ax.set_title(title) fig.savefig('crap') fig.clf() - 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] 2nd y axis, same data
Hello, (for a 2-d plot) Any example code of how to label the 2nd y-axis using a different scale than the first y-axis for the same dataset? For example, how do you make a plot of distances with the left y-axis in kilometers and the right y-axis in miles? Thanks in advance for your help, James - 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 line spacing control
As a coincidence, just today I was trying to figure out how to increase the spacing between the lines in the title of my plot. I too, would like some means to control this. --Jim On Jul 10, 2007, at 10:48 AM, Jianfu Pan wrote: > John, > > Thanks for your prompt response. I think the option can be > useful. In my > case, the gap between the lines are really tight with "_" in the > first line > right on the top of characters in the second line. > > Regards, > Jianfu > > At 12:31 PM 7/10/2007, John Hunter wrote: >> On 7/10/07, Jianfu Pan <[EMAIL PROTECTED]> wrote: >>> Hi, >>> >>> I use Text() call of Figure() object for writing text. Because >>> my text is >>> long, I use line breaker (\n) to write multiple lines with a single >>> call. This works fine except the line spacing is really tight >>> and I wish I >>> could set a bigger line spacing. Does anyone know if this is >>> possible? Thanks for your time. >> >> Currently not, the pad between the newline is hard coded, but we >> could >> expose it as a parameter w/o too much work. >> >> JDH >> >> - >> >> 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 > > > -- > --- > 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 - 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] eliminating end labels on axes
I wish to produce a plot very much like that in the examples - ganged_plots.py. In these type of plots the tick labels on the end points of the y - axis tend to run into each other if nothing is done. In the example -ganged_plots.py, this issue is addressed by judicious use of ylim and defining the ytick values explicitly. In the example on the wiki, all the ytick -labels are just made invisible. I have not been able to figure out how to just make the first and last ytick labels vanish. I can make all the labels invisible, but I am unable to manipulate individual tick labels. 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 I vaguely recall that this was discussed before on the list - but I cannot locate the reference - if it exists. Thanks for any help. --Jim - 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] multiple (>2) y-axes
I wish to plot 3 lines on a single graph - each line requires a separate y scaling but shares a common x. The case for 2 such lines is handled by twinx as in the two_scales.py example. I have not found an example of 3 lines ( or greater). In the case of more than 2 scales the y axis scale would have to float, to the right or left of the y axes defined for the first 2 lines. Thanks for any help. ---Jim - 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] Stacked bar chart with dates on x axis
Hi, I have some time series data of server CPU usage (user, system, WIO, free, etc) and would like to plot this as a stacked bar chart, with dates / times on the x axis (as per plot_date for x, y series data). Is this possible? Cheers, James. - 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] Error bars on plot created with axes.plot(...)
Hi, I have written a module which implements a custom histogram class, with the plotting handled by a call to ax.plot(x, y, ...). The x and y values are massaged to create a conventional histogram binned look, for example: http://www.onlineclienttest.co.uk/invmass-hor-py.png What I would like to do is add custom error bars to each of the bin centroids. Clearly some form of ScatterError(x, y, yerr_up, yerr_down) where the scatter point itself is set to be non-visible would be ideal. Is there anything like this I could use? Regards, James. - 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] colorbar label every level
I am using the colorbar with a discrete set of intervals, the progression through the levels is not linear. Presently, the colorbar call labels every other level, this looks very nice, but unfortunately in my case one cannot infer the value of the unlabeled levels due to the non-linear scale. Is there any easy way to force a label for every level ? I am aware of the ticker - Locator, Formatter mechanism but I am looking for a very simple solution. If not I'll just do it. Thanks for any help. --Jim - 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
[Matplotlib-users] missing slice of pie()
It looks like pie() omits slices that are smaller than a few percent. In the following example, only one pie slice is drawn: >>> import pylab >>> pylab.pie([98,2]) >>> pylab.show() The missing pie slice has neither a color fill nor a boundary (the arc of the pie slice is missing). By contrast, the following works as expected: >>> pylab.pie([97,3]) It seems that the problem occurs for small slices, apparently the threshold is around 2-3%. Any ideas? Thanks in advance, James - 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
[Matplotlib-users] specifying colors in 'extend' option of contourf
I cannot get the contourf extended color map ranges to show up in the plot. the extend option of contourf states: extend = 'neither', 'both', 'min', 'max' Unless this is 'neither' (default), contour levels are automatically added to one or both ends of the range so that all data are included. These added ranges are then mapped to the special colormap values which default to the ends of the colormap range, but can be set via Colormap.set_under() and Colormap.set_over() methods The code at the of this message produces a plot with color bar extensions that are the end colors of the bone colormap and not red and green. The colorMap._rgba_over value is red and the colorMap._rgba_under value is green, but this is not reflected in the plot. Any idea what I am doing wrong? I am using matplotlib 0.91.1 --Jim figure() colorMap = cm.bone colorMap.set_over('r') colorMap.set_under('g') CS = contourf(X, Y, Z, 10,cmap=colorMap,origin=origin, extend = 'both') cbar = colorbar(CS) savefig('contourf_demo1') - 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
[Matplotlib-users] suggestion for Example plots
I have always felt that it would be useful to have available a collection of plots corresponding to the code in the examples file as part of the distribution. (for those examples that generate plots, of course) The plot names would be the same as the example code that generated them. It could be in an economical format (png?) so as to not take up a lot of space. For my own part, I tend to be lazy and would like a way to peruse the new capabilities before I decide to install the new release or wait for the next. This would also provide a complete gallery to help those considering adoption. It would also provide a verification for persons testing a new install that this is what the results of running the examples should be. just an idea. --Jim ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] 2d Gaussian kernel with pylab?
Hi, What's a good way to create a 2d gaussian kernel with pylab? I want a 9x9 matrix with 1.0 in the center, and 0.0 in the corners, and a nice gaussian distribution from the center out. Thanks! -Jim All the advantages of Linux Managed Hosting--Without the Cost and Risk! Fully trained technicians. The highest number of Red Hat certifications in the hosting industry. Fanatical Support. Click to learn more http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] 2D Gaussian Kernel with pylab?
Hi, What's a good way to create a 2d gaussian kernel with pylab? I want a 9x9 matrix with 1.0 in the center, and 0.0 in the corners, and a gaussian distribution from the center out. Thanks, -Jim All the advantages of Linux Managed Hosting--Without the Cost and Risk! Fully trained technicians. The highest number of Red Hat certifications in the hosting industry. Fanatical Support. Click to learn more http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] last version that worked well with py2exe?
Hi I read on the py2exe wiki that the 0.83 line creates huge distributions because of trouble excluding backends that are not wanted. ( http://starship.python.net/crew/theller/moin.cgi/MatPlotLib ) I do need to have a small distribution on windows. Which version of matplotlib was the last to play nicely with py2exe? Has anyone had any luck with 0.83.3 and excluding tk and gtk backends? (I'm using wx) I'm also getting a strange dependancy on the unicode version of wxPython, when I'm using the non-unicode version, and that's adding another 5MB onto my distro. Thanks, -Jim 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=lnk&kid=120709&bid=263057&dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] last version that worked well with py2exe?
On 6/28/06, Géza Groma <[EMAIL PROTECTED]> wrote: > Using Matplotlib 0.87.3 (wxAgg backend), NumPy 0.9.8, SciPy 0.4.9, > wxPython unicode.2.6.3.2, python 2.4.3 the following setup.py worked > well with py2exe 0.6.5 on Widows XP: > I followed your example, and had some luck. Thanks. My final distribution is 47MB in 840 files. Does anyone have an example that does even better? Last October, I used numarray + matplotlib in an almost identical project, and managed to bundle it into 11MB and four files. But I can't remember exactly the combination that I used. If I try to use a zip file (comment out the skip_archive) to reduce size and filecount, I get the error: File "matplotlib\backends\backend_wxagg.pyc", line 21, in ? File "matplotlib\figure.pyc", line 5, in ? File "matplotlib\artist.pyc", line 4, in ? File "matplotlib\transforms.pyc", line 215, in ? File "matplotlib\_transforms.pyc", line 1, in ? File "matplotlib\numerix\__init__.pyc", line 52, in ? File "numarray\__init__.pyc", line 42, in ? File "numarray\numarrayall.pyc", line 2, in ? File "numarray\generic.pyc", line 1120, in ? File "numarray\numarraycore.pyc", line 16, in ? File "numarray\_sort.pyc", line 12, in ? File "numarray\_sort.pyc", line 10, in __load File "numpy\__init__.pyc", line 35, in ? File "numpy\_import_tools.pyc", line 173, in __call__ File "numpy\_import_tools.pyc", line 68, in _init_info_modules File "", line 1, in ? File "numpy\random\__init__.pyc", line 3, in ? File "numpy\random\mtrand.pyc", line 12, in ? File "numpy\random\mtrand.pyc", line 10, in __load File "numpy.pxi", line 32, in mtrand AttributeError: 'module' object has no attribute 'dtype' and even in the working example where I do skip_archive, I get the warnings: The following modules appear to be missing ['FFT', 'LinearAlgebra', 'MA', 'MLab', 'Matrix', 'Numeric', 'Pyrex', 'Pyrex.Comp iler', 'RandomArray', 'backends.draw_if_interactive', 'backends.new_figure_manag er', 'backends.pylab_setup', 'backends.show', 'cephes', 'fcompiler.FCompiler', ' fcompiler.show_fcompilers', 'genapi', 'lib.add_newdoc', 'numerix.ArrayType', 'nu merix.Complex', 'numerix.Complex32', 'numerix.Complex64', 'numerix.Float', 'nume rix.Float32', 'numerix.Float64', 'numerix.Int', 'numerix.Int16', 'numerix.Int32' , 'numerix.Int8', 'numerix.NewAxis', 'numerix.UInt16', 'numerix.UInt32', 'numeri x.UInt8', 'numerix.absolute', 'numerix.add', 'numerix.allclose', 'numerix.alltru e', 'numerix.arange', 'numerix.arccos', 'numerix.arccosh', 'numerix.arcsin', 'nu merix.arcsinh', 'numerix.arctan', 'numerix.arctan2', 'numerix.arctanh', 'numerix .argmax', 'numerix.argmin', 'numerix.argsort', 'numerix.around', 'numerix.array' , 'numerix.arrayrange', 'numerix.asarray', 'numerix.asum', 'numerix.bitwise_and' , 'numerix.bitwise_or', 'numerix.bitwise_xor', 'numerix.ceil', 'numerix.choose', 'numerix.clip', 'numerix.compress', 'numerix.concatenate', 'numerix.conjugate', 'numerix.convolve', 'numerix.cos', 'numerix.cosh', 'numerix.cross_correlate', ' numerix.cumproduct', 'numerix.cumsum', 'numerix.diagonal', 'numerix.divide', 'nu merix.dot', 'numerix.equal', 'numerix.exp', 'numerix.fabs', 'numerix.fft.fft', ' numerix.fft.inverse_fft', 'numerix.floor', 'numerix.fmod', 'numerix.fromfunction ', 'numerix.fromstring', 'numerix.greater', 'numerix.greater_equal', 'numerix.hy pot', 'numerix.identity', 'numerix.indices', 'numerix.innerproduct', 'numerix.is contiguous', 'numerix.less', 'numerix.less_equal', 'numerix.log', 'numerix.log10 ', 'numerix.logical_and', 'numerix.logical_not', 'numerix.logical_or', 'numerix. logical_xor', 'numerix.matrixmultiply', 'numerix.maximum', 'numerix.minimum', 'n umerix.mlab.amax', 'numerix.mlab.amin', 'numerix.mlab.cov', 'numerix.mlab.diff', 'numerix.mlab.hanning', 'numerix.mlab.rand', 'numerix.mlab.std', 'numerix.mlab. svd', 'numerix.multiply', 'numerix.negative', 'numerix.nonzero', 'numerix.not_eq ual', 'numerix.nx', 'numerix.ones', 'numerix.outerproduct', 'numerix.pi', 'numer ix.power', 'numerix.product', 'numerix.put', 'numerix.putmask', 'numerix.rank', 'numerix.ravel', 'numerix.repeat', 'numerix.reshape', 'numerix.resize', 'numerix .searchsorted', 'numerix.shape', 'numerix.sin', 'numerix.sinh', 'numerix.size', 'numerix.sometrue', 'numerix.sort', 'numerix.sqrt', 'numerix.subtract', 'numerix .swapaxes', 'numerix.take', 'numerix.tan', 'numerix.tanh', 'numerix.trace', 'num erix.transpose', 'numerix.typecode', 'numerix.typecodes', 'numerix.where', 'nume rix.which', 'numerix.zeros', 'numpy.Complex', 'numpy.Complex32', 'numpy.Complex6 4', 'numpy.Float', 'numpy.Float32', 'numpy.Float64', 'numpy.Inf', 'numpy.Infinit y', 'numpy.Int', 'numpy.Int16', 'numpy.Int32', 'numpy.Int8', 'numpy.UInt16', 'nu mpy.UInt32', 'numpy.UInt8', 'numpy.absolute', 'numpy.add', 'numpy.amax', 'numpy. amin', 'numpy.arange', 'numpy.array', 'numpy.asarray', 'numpy.asarray_chkfinite' , 'numpy.cast', 'numpy.concatenate', 'numpy.conjugate', 'numpy.diag', 'numpy.dot ', 'numpy.exp', 'num
Re: [Matplotlib-users] last version that worked well with py2exe?
> > My final distribution is 47MB in 840 files. Does anyone > > have an example that does even better? > > I think PyInstaller is supposed to help with this problem: > http://pyinstaller.hpcf.upr.edu/ > But I have not used it. > > Cheers, > Alan Isaac Hi Alan, PyInstaller looks intriguing, but the traffic on their mailing list makes me think that it doesn't have enough users (& therefore developers) yet. I want to stay on the well-traveled-paths where I can find them. I think for now I'll use NSIS w/ py2exe to create a single executable that unpacks to a temporary directory and launches itself when it's double clicked. I've used this sucessfully in the past. ( something like this: http://wiki.wxpython.org/index.cgi/SmallApp ) I think what I'm really hoping for is to find a way to include just the core functionality of matplotlib, without pulling in numpy and scipy and all the bells and whistles. Of course, the real solution to my problem is to just start using all the bells and whistles (I'm happy to see the mathtext module that will work on systems that don't have TeX!) -Jim On 6/28/06, Alan G Isaac <[EMAIL PROTECTED]> wrote: > On Wed, 28 Jun 2006, James Carroll apparently wrote: > > > > > 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=lnk&kid=120709&bid=263057&dat=121642 > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > 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=lnk&kid=120709&bid=263057&dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] color bar with non-linear spacing
I am interested in producing a color map and accompanying colorbar with non-linear (arbitrary) spacing. My intent is like the attached color bar in which the increments are monotonic but vary in size. There might be an easy way to do this but it is not apparent to me. --Jim 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=lnk&kid=120709&bid=263057&dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] last version that worked well with py2exe?
> Understood. But do not overlook that PyInstaller is really > the current life of Gordon McMillan's Python Installer, > so it really is not a new kid on the block. I gave PyInstaller a try, and it seemed to be smart and easy at first, and created a single exe that was just 8MB. The problem is that when I run the exe, It gives me the following errors before it crashes: - Fatal Error: MSVCR71.DLL! - Fatal Error: colud not be extracted. - Fatal Error: Error loading Python DLL - a message box pointing to python24.dll in a temp dir. - Fatal Error: - "Please tell microsoft about this problem." [Don't send] moving msvcr71.dll and python24.dll to the same directory didn't change anything. I'll put some more time into trying it, but my first impression isn't good. Meanwhile, I've removed numarray entirely from the project, and am using matplotlib.rcParams['numerix'] = 'numpy' and py2exe + nsis is working pretty well. I have a working single executable that is 12MB, but it takes about 18 seconds to decompress & run. If I turn off the NSIS lzw compression, then it it is a 46MB executable, and runs in about 12 seconds. I might be trying to create my own C++ wxWidgets top level application and embed wxPython & matplot lib in that. (has anyone ever had luck doing this?) Thanks, -Jim 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=lnk&kid=120709&bid=263057&dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib, numpy and py2exe
Hi Werner, I got this problem too, and I actually updated the py2exe wiki on what to do when you see it. The problem is that there are multiple _sort modules (_sort.pyd in numpy and others in the different numer* packages.) Only some of them have dtype. See the last section (seciton 5) of http://starship.python.net/crew/theller/moin.cgi/MatPlotLib My real solution to it was to remove all the other num* packages from the system and just have numpy and scipy installed. This ensured that I wasn't pulling in the other packges by accident. -Jim On 7/6/06, Werner F. Bruhin <[EMAIL PROTECTED]> wrote: > I finally managed to build it without getting py2exe errors. > > Needed to include package "numpy" and remove "distutils" package from > numpy as py2exe was failing on "tests" - maybe this is not the right > thing to do as I still get run time error when running the exe. > > Here is the exception I currently get: > Thu Jul 06 17:43:19 2006 > Traceback (most recent call last): >File "appwine.pyo", line 1333, in OnToolbarChart >File "frameplotmpl.pyo", line 16, in ? >File "matplotlib\numerix\__init__.pyo", line 66, in ? >File "numpy\__init__.pyo", line 35, in ? >File "numpy\_import_tools.pyo", line 173, in __call__ >File "numpy\_import_tools.pyo", line 68, in _init_info_modules >File "", line 1, in ? >File "numpy\random\__init__.pyo", line 3, in ? >File "numpy\random\mtrand.pyo", line 12, in ? >File "numpy\random\mtrand.pyo", line 10, in __load >File "numpy.pxi", line 32, in mtrand > AttributeError: 'module' object has no attribute 'dtype' > > As mtrand is a .pyd I run out of things to try. > > Any hints on how to get around this one would be appreciated, otherwise > I guess I will go back an use Numeric instead. > > Werner > > > 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=lnk&kid=120709&bid=263057&dat=121642 > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > 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=lnk&kid=120709&bid=263057&dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] extend for colorbar
I am using matplotlib 0.87.3 The documentation of colorbar in color.py seems to indicate that one should be able to create a color bar with pointed ends, the fill color of the ends corresponding to the over and under colors. I have not been able to get this to work. I have set the colormap.set_under and set_over values but no success. If this does work could someone (Eric?) post an example, of how it is done. I feel that I am missing something simple. Thanks for any help. --Jim - 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=lnk&kid=120709&bid=263057&dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] extend for colorbar
Thanks, Eric Ok, I ran the image_masked.py and all went OK BUT if I change line 34 of image_masked.py: im = imshow(Zm, interpolation='bilinear', cmap=palette, norm = colors.normalize(vmin = -1.0, vmax = 1.0, clip = False), origin='lower', extent=[-3,3,-3,3]) to im = contourf(Zm,cmap=palette) I do not get the over/under pointers on the end of the colorbar. Does this feature not work with contourf - Or am I doing something wrong. --Jim On Aug 21, 2006, at 5:13 PM, Eric Firing wrote: > Jim, > > Look at examples/image_masked.py. I think that is the only example > with pointed ends, and I think it was present as-is in 0.87.3. > > Eric > > James Boyle wrote: >> I am using matplotlib 0.87.3 >> The documentation of colorbar in color.py seems to indicate that one >> should be able to create a color bar with pointed ends, the fill >> color of the ends corresponding to the over and under colors. >> I have not been able to get this to work. I have set the >> colormap.set_under and set_over values but no success. >> If this does work could someone (Eric?) post an example, of how it is >> done. I feel that I am missing something simple. >> Thanks for any help. >> --Jim - 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=lnk&kid=120709&bid=263057&dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Basemap - quiver scaling
when I call quiver in the Basemap toolkit, the scale keyword has the effect of eliminating all vectors, no matter what value I assign (except None). I am using matplotlib 0.87.3 - Basemap 0.9 In any case the exact effect of the scale parameter is obscure - how does is scale? units/inch, units/gridbox ??? Thanks for any help. --Jim the calls I use are below: mercMap = Basemap(llcrnrlon=120.,llcrnrlat=-20,urcrnrlon=200.,urcrnrlat=20.,\ resolution='c',area_thresh=1.,projection='merc',\ lon_0=160.,lat_ts=0.) istride = 3 mercMap.quiver(x[::istride,::istride],y[::istride,::istride],uERA[:: istride,::istride],vERA[::istride,::istride],scale=None) - 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=lnk&kid=120709&bid=263057&dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Set Z data on pcolor.
Hi All, I wish to make a 3d volume with a series of slices through it. I have X-Z data at 15 different Y planes. In MATLAB, I would make a pcolor plot, then set the Z data to the original ydata, and the Y data to a constant. This works fine. I would like to achieve a similar result in matplotlib, but I cannot figure out anyway to do it. Any help would be appreciated. James -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Set X,Y,and Z data for a pcolormesh
This worked brilliantly! Thank you so much! Secondary question now, is this: I have a contourf and a polygon made with ax.add_collection3d(a3.art3d.Poly3DCollection(verts, facecolors=[.5,.5,.5], linewidths=1,edgecolor='k',zorder=0)) How do I change it so the contourf is on top of the polygon? By default it seems to plot the polygon on top. I tried zorder but that did nothing. Ta -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] backend_wx and 0.98.0
My app uses the wx backend, so I happened to notice that the backend_wx doesn't seem to work with matplotlib 0.98.0. Running the 0.98 example embedding_in_wx.py shows the problem. Only a bit of the lines get plotted. The pan up/down zoom in/out all show various error messages. When i revert back to 0.91.3 and run the same 0.91 example it works fine. Not a big deal for me (perhaps the only person still using the wx backend), i'm in the process of switching my app to qt4 and the embedding_in_qt4.py example works fine in 0.98. Jim - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] backend_wx and 0.98.0
On Fri, 13 Jun 2008, John Hunter wrote: > On Thu, Jun 12, 2008 at 9:21 PM, James A. Benson > wrote: >> >> My app uses the wx backend, so I happened to notice >> that the backend_wx doesn't seem to work with >> matplotlib 0.98.0. Running the 0.98 example embedding_in_wx.py >> shows the problem. Only a bit of the lines get plotted. The >> pan up/down zoom in/out all show various error messages. >> When i revert back to 0.91.3 and run the same 0.91 example >> it works fine. > > Hey James, we were discussing problems with the wx backend on 0.98 > yesterday on the devel list, and Ken offered to take a look at them, > so it is possible we will have those fixed for the next bugfix > release. What wx version are you using? > Sorry, I forgot to include that important detail. I see the problem on a Linux F8 machine with wx version 2.8.7.1 > Note that unless you are running over an x11 connection, there is > little reason to prefer wx over wxagg, which has better rendering and > more features. Over an x11 connection, wxagg is slow because it has > to pass the who bitmap over the wire, but otherwise it works great. > > JDH > Thanks for the advice and later comments on this thread from Michael. Sounds like i'm definitely doing the right thing by switching from the wx backend to perhaps any other backend. I'm going with the qt4 backend. Thanks, Jim - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Autonomous display of image/plot/figure
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I'm not sure if this is the right venue for this question. I've searched the archives, but without success so far. If this is covered there (or elsewhere on the web), I'd apprciate a pointer to it so it doesn't duplicate bandwidth here. Anyway, what I'd like to do is have a python script which reads data from a file, displays an image/plot/whatever made from the data, and then exits, keeping the image displayed. I'm running Fedora 8, python 2.5.1, and matplotlib 0.91.2-1.fc8 from the yum repository. Backend is set to GTKAgg in my matplotlibrc file. My initial attempt used the "double fork" method from the python cookbook: - -Code follows-- if __name__ == "__main__": #From Python Cookbook try: pid = os.fork() if pid > 0: # Exit first parent sys.exit(0) except OSError, e: print >>sys.stderr, "fork #1 failed: %d (%s)" %(e.errno, e.strerror) sys.exit(1) # Decouple from parent environment #os.chdir("/") os.setsid() os.umask(0) # Do second fork try: pid = os.fork() if pid > 0: # Exit from second parent; print eventual PID before exiting print "Image PID %d" % pid sys.exit(0) except OSError, e: print >>sys.stderr, "fork #2 failed: %d (%s)"%(e.errno, e.strerror) sys.exit(1) # Start the main loop to display image main() - --END CODE-- The main() function reads the values appropriately into the variable "myarr", and then calls imshow and show: - Code follows --- : : pylab.imshow(myarr) pylab.show() - --END CODE-- . . . and then exits. All works well until I try to kill the figure/image by clicking on the X in the upper-right corner. It disappears alright, but the process remains running, and I have to manually kill it with the kill -SIGTERM command. I'd like the process to die when I close the window. I'm really an application programmer, not a system programmer, and usually don't delve this deeply into process management, so I'm probably doing something extremely ignorant. Help is appreciated. Thanks! James -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQFIcor8xOXthSHeGJIRAm/aAKC/SPQzocHigz2glpvtBJc0BcMU3ACfUTe0 PM0fby8/z3YJcAj+Llb++ho= =NgA/ -END PGP SIGNATURE- - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Fwd: Re: Autonomous display of image/plot/figure
Thanks for the suggestion, Michael. Reading it led to a bit of a forehead slap. Unfortunately, that didn't work either. Curiously, it appears that the "show()" command does not return. - CODE SECTION - #!/usr/local/bin/python import os,sys import pylab def main(): x = pylab.linspace(-10,10,100) y = pylab.sin(x) pylab.plot(x,y) sys.stderr.write("Begun.") pylab.show() sys.stderr.write("Done.") if __name__ == "__main__": main() END CODE - When executed from the command line: $ ./test.py & . . . the plot displays; clicking on the X closes it, but the process keeps on running. When executed as an argument to python: $ python test.py & . . . the same behavior (except it's a python process which hangs). The two sys.stderr.write() statements are for debugging. The first one executes; the second does not. My conclusion is that the show() command does not return. -- When I operate interactively, the command "pylab.plot(x,y)" opens a widow labeled "Figure 1". . . . then . . . the command "show()" writes the plot to that window (i.e., sine plot). Clicking the X in the figure window causes the window to disappear, but the "show()" command fails to return. -- So . . . I figure that the lack of show() returning is the root problem. Any suggestions? I'm running Fedora 8, python 2.5.1, and matplotlib 0.91.2-1.fc8 from the yum repository. Backend is set to GTKAgg in my matplotlibrc file. James --- On Monday 07 July 2008 17:29:16 you wrote: > Why do you want to "fork" the process? If you just run it in the > background it should have the desired effect: > > > from pylab import * > x = linspace(-10,10,100) # or load data from a file. > y = sin(x) > plot(x,y) > show() > > > $ python tst.py& > > Process remains in background running until the user closes the plot > window, at which point it terminates. > > Michael. > > On 7 Jul 2008, at 2:30 PM, James K. Gruetzner wrote: > > -BEGIN PGP SIGNED MESSAGE- > > Hash: SHA1 > > > > I'm not sure if this is the right venue for this question. I've > > searched the > > archives, but without success so far. If this is covered there (or > > elsewhere > > on the web), I'd apprciate a pointer to it so it doesn't duplicate > > bandwidth > > here. > > > > Anyway, what I'd like to do is have a python script which reads > > data from a > > file, displays an image/plot/whatever made from the data, and then > > exits, > > keeping the image displayed. > > > > I'm running Fedora 8, python 2.5.1, and matplotlib 0.91.2-1.fc8 > > from the yum > > repository. Backend is set to GTKAgg in my matplotlibrc file. > > > > My initial attempt used the "double fork" method from the python > > cookbook: > > > > - -Code follows-- > > if __name__ == "__main__": > > > > #From Python Cookbook > > try: > > pid = os.fork() > > if pid > 0: > > # Exit first parent > > sys.exit(0) > > except OSError, e: > > print >>sys.stderr, "fork #1 failed: %d (%s)" %(e.errno, > > e.strerror) > > sys.exit(1) > > > > # Decouple from parent environment > > #os.chdir("/") > > os.setsid() > > os.umask(0) > > > > # Do second fork > > try: > > pid = os.fork() > > if pid > 0: > > # Exit from second parent; print eventual PID before exiting > > print "Image PID %d" % pid > > sys.exit(0) > > except OSError, e: > > print >>sys.stderr, "fork #2 failed: %d (%s)"%(e.errno, > > e.strerror) > > sys.exit(1) > > > > # Start the main loop to display image > > main() > > > > - --END CODE-- > > > > The main() function reads the values appropriately into the > > variable "myarr", > > and then calls imshow and show: > > > > - Code follows --- > > > > > > pylab.imshow(myarr) > > pylab.show() > > - --END CODE-- > > > > . . . and then exits. > > > > All works well until I try to kill the figure/image by clicking on > > the X in > > the upper-right corner. It disappears alright, but the process > > remains > > running, and I have to manually kill
Re: [Matplotlib-users] Fwd: Re: Autonomous display of image/plot/figure
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thursday 10 July 2008 18:50:12 you wrote: > James K. Gruetzner wrote: > >>> I'm running Fedora 8, python 2.5.1, and matplotlib 0.91.2-1.fc8 from > >>> the yum repository. Backend is set to GTKAgg in my matplotlibrc file. > >> > >> (On this list top-posting is frowned upon -- it makes the conversation > >> difficult to follow.) > > > > I understand. Sorry. Each list is different: I'm new here, and will > > try remember. > > No problem. Also, don't forget reply-to-all, so that the whole of the > list can chime in here. :) Arrrgh Almost all my other lists have that as default, so I'm out of the habit of checking. > >> Your analysis is correct, the call to show() activates the GUI mainloop > >> and does not return until the window is closed. Within ipython there is > >> some magic that occurs that runs the mainloop in a separate thread. > >> What do you need to do after the call to show()? > > In my current situation, I need to extract and display data (images) > > independently from several different files as part of debugging a larger > > application. (I'm really not reading a file into the original array, but > > running some shell commands using os.popen2(...) to eventually populate > > the array: that part works.)The upshot is that in the course of a > > few hours, I may have to display (and kill) a large number of images. > > The current "hang" means that I have an effective memory leak, and I'd > > have to keep track of Process IDs and manually kill them every so often. > > Were the pylab.show() command to return after closing the window > > (clicking on the X), then a backgrounded or daemon process should > > terminate. But it doesn't. This seems to be the same problem causing > > Dragan S.'s problem. > > I'm not sure if this is a bug or a feature, but would assuredly like to > > find a way to kill the leak. > I'm not sure about the lack of returning after the call show(), though > it does sound like a bug. What I *do* know is that multiple calls to > show() is frowned upon (if not just completely unsupported). What you > probably want to look at is the dynamic_image_gtkagg.py example (in the > examples/ directory). Since you're already using GtkAgg, it should be > *really* easy to adapt the example to fit your needs. I've personally > adapted it to do a live data display of a simulation run. I don't really need any live interaction or a live data display; I just want the thang to stop running (i.e., the process to terminate) when the figure window is closed. Unfortunately, the dynamic_image_gtkagg.py example has the same problem. It's final line is "show()". When run as a background process, everything displays well --- but when the window is closed (click on X), the process fails to terminate. So . . . the root cause is that show() does not return when the shown image is closed. > If you *need* it to wait for user interaction before continuing, there might > be a little bit more work, but I don't think it'd be much. You could > probably instead look at some of the Matplotlib UI widgets, like in the > buttons.py example. I really don't need user interaction per se, I may have to go that route an establish some sort of "close window and exit" event. Hmmm: another learning opportunity . . . . :-) The show() function is defined in .../matplotlib/backends/backend_gtk.py and looks to be calling gtk.main(), which, according to .../gtk-2.0/gtk/__init__.py appears to be deprecated in favor of mainloop(). And that's as far as I can go in this: I'm not graphics whiz, and, in fact, having reached somewhat beyond my skill level, can't even figure out how to trace the mainloop call back further. I would think that the gtk mainloop would terminate when the window closes (which termination should propagate back up the stack), but apparently that doesn't happen. > Ryan > > -- > Ryan May > Graduate Research Assistant > School of Meteorology > University of Oklahoma Thanks again for your help thus far. James -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQFId5ChxOXthSHeGJIRAqj4AKDG8RGxoQYl5va2olVUV2WQ1zjyOQCeImlr AT+d5Fl2FuF9yWxLaJWbjEg= =wZPg -END PGP SIGNATURE- - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Fwd: Re: Autonomous display of image/plot/figure
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Monday 14 July 2008 21:22:31 you wrote: > >>> I would think that the gtk mainloop would terminate when the window > >>> closes (which termination should propagate back up the stack), but > >>> apparently that doesn't happen. > >> > >> I'm not sure I'm following you at the moment. Are you calling show() > >> once and closing the figure doesn't cause it to return? or are you > >> trying to call show() multiple times from a single script and subsequent > >> calls to show() fail to return? > > > > Hi, Ryan, > > > > Thanks for your continued help. > > > > I am calling show() once, and closing the figure doesn't cause it to > > return? I've verified the lack of return using debug sys.stderr.write() > > statements, as well as by following show() with a sys.exit() command. > > (Getting this back on the full list...) > > This sounds like a bug to me, specific to your set up. I just ran a > script (for my own sanity) and closing the figure, resulted in the > script exiting and returning to the command prompt. Do you happen to > have a small complete example that replicates your problems that you > could post here? > > Also, what are your versions of matplotlib and PyGtk (you are using > GtkAgg, right)? Also, what OS are you running? > > Devs, what do you think? > > Ryan > -- > Ryan May > Graduate Research Assistant > School of Meteorology > University of Oklahoma Thanks, Ryan, The requested info is below. Thanks again. James - - SMALL COMPLETE EXAMPLE CODE FOLLOWS - #!/usr/bin/python # File: test.py import os,sys import pylab as PL import numpy as N def main(): fig = PL.figure(1) x = N.arange(120.0)*2*N.pi/120.0 x = PL.resize(x, (100,120)) y = N.arange(100.0)*2*N.pi/100.0 y = N.resize(y, (120,100)) y = N.transpose(y) z = N.sin(x) + N.cos(y) PL.imshow( z , cmap=PL.cm.jet)#, interpolation='nearest') sys.stderr.write("Begun.") PL.show() sys.stderr.write("Done.") sys.exit(0) if __name__ == "__main__": - END OF SAMPLE CODE --- Sample output: - --- BEGIN -- $ ./test.py Begun. - --- COMMENTS: -- The image displays. I click on the X; the image disappears. Nothing happens in the terminal output. In the terminal window I type C. - --- BEGIN -- ^CTraceback (most recent call last): File "./test.py", line 59, in main() File "./test.py", line 25, in main PL.show() File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtk.py", line 71, in show gtk.main() KeyboardInterrupt $ - -- END OF OUTPUT CODE -- The same behavior occurs when run from within an interactive session. python version: 2.5.1 (4251:54863, Jun 15 2008, 23:59:20) Matplotlib version: 0.91.2 PyGTK version: 2.12.0-2.fc8 In ~/.matplotlib/matplotlibrc: backend : GTKAgg OS: Fedora 8 Linux kernel: 2.6.25.6-27.fc8 -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQFIfKh4xOXthSHeGJIRAvbzAKCF9U7EJ4oM2JyQjKokOBZAv6PSlwCfZV3t I5jSycQj8dAqI0QGkewAw3o= =vdPu -END PGP SIGNATURE- - 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=100&url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Fwd: Re: Autonomous display of image/plot/figure
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Tuesday 15 July 2008 07:48:45 John Hunter wrote: > On Tue, Jul 15, 2008 at 8:39 AM, James K. Gruetzner <[EMAIL PROTECTED]> wrote: > > -BEGIN PGP SIGNED MESSAGE- > > Hash: SHA1 > > > > On Monday 14 July 2008 21:22:31 you wrote: > >> >>> I would think that the gtk mainloop would terminate when the window > >> >>> closes (which termination should propagate back up the stack), but > >> >>> apparently that doesn't happen. > >> >> > >> >> I'm not sure I'm following you at the moment. Are you calling show() > >> >> once and closing the figure doesn't cause it to return? or are you > >> >> trying to call show() multiple times from a single script and > >> >> subsequent calls to show() fail to return? > >> > > >> > Hi, Ryan, > >> > > >> > Thanks for your continued help. > >> > > >> > I am calling show() once, and closing the figure doesn't cause it to > >> > return? I've verified the lack of return using debug > >> > sys.stderr.write() statements, as well as by following show() with a > >> > sys.exit() command. > >> > >> (Getting this back on the full list...) > >> > >> This sounds like a bug to me, specific to your set up. I just ran a > >> script (for my own sanity) and closing the figure, resulted in the > >> script exiting and returning to the command prompt. Do you happen to > >> have a small complete example that replicates your problems that you > >> could post here? > >> > >> Also, what are your versions of matplotlib and PyGtk (you are using > >> GtkAgg, right)? Also, what OS are you running? > >> > >> Devs, what do you think? > >> > >> Ryan > >> -- > >> Ryan May > >> Graduate Research Assistant > >> School of Meteorology > >> University of Oklahoma > > > > Thanks, Ryan, The requested info is below. > > Thanks again. > > I am not seeing any problems on the 91 branch or the 98 trunk. Below > is my command and output (the shell returns when I close the window > with a click) > > [EMAIL PROTECTED]:svn> python ~/test.py --verbose-helpful -dGTKAgg > $HOME=/home/titan/johnh > CONFIGDIR=/home/titan/johnh/.matplotlib > matplotlib data path > /home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/mpl-data > loaded rc file /home/titan/johnh/.matplotlib/matplotlibrc > matplotlib version 0.91.4 > verbose.level helpful > interactive is False > units is False > platform is sunos5 > numerix numpy 1.2.0.dev5410 > Using fontManager instance from > /home/titan/johnh/.matplotlib/fontManager.cache backend GTKAgg version > 2.6.0 > [EMAIL PROTECTED]:svn> Hi, John, Here's my equivalent: $ python ./test.py --verbose-helpful -dGTKAgg $HOME=/home/jkgruet CONFIGDIR=/home/jkgruet/.matplotlib matplotlib data path /usr/lib/python2.5/site-packages/matplotlib/mpl-data loaded rc file /home/jkgruet/.matplotlib/matplotlibrc matplotlib version 0.91.2 verbose.level helpful interactive is True units is False platform is linux2 numerix numpy 1.1.0 Using fontManager instance from /home/jkgruet/.matplotlib/fontManager.cache backend GTKAgg version 2.12.0 Begun. . . . at which point it hangs, even after the window is closed. I see that I have a older matplotlib and numpy versions. Those are the same versions as in Fedora 9, so upgrading there won't help. OTOH, my GTKAgg version is 2.12,0, not 2.6.0. I'm fairly sure that is where the problem lies, or, more likely, in GTK itself, where I have installed: gtk+.i3861:1.2.10-59.fc8 gtk2.i3862.12.8-2.fc8 This is verified by testing several backends: GTKAgg: fails to return when X is clicked GTK: fails to return when X is clicked GTKCairo: fails to return when X is clicked WxAgg:displays and returns immediately (no need to click any X !!! ) QtAgg:returns when X is clicked; TkAgg:returns when X is clicked; FltkAgg: "ImportError: No module named fltk", although fltk is installed WX: "NotImplementedError" from .../matplotlib/image.py in draw: renderer.draw_Image(...) So . . . for my purposes, I think I'll just use QtAgg or TkAgg. I'm not sure how I would file a bug report against GTK, however, or even *if* I should file one given my utter ignorance of gtk. I appreciate all the help shown on the list.
Re: [Matplotlib-users] [matplotlib-devel] What would you like to see in a book about Matplotlib?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Great discussion. I think this tangent indicates a need for a section to explain both the history of pylab, matplotlib.pyplot, and how they relate. (I'm still confused at what exactly the difference is.) My perspective is that of a scientist doing numerical analysis who needs to visualize computational results and compare it to experimental data. I normally don't have time to get into the interesting computer science essoterica: what I need are - a toolkit of HOWTOs; - a solid reference to the various classes and functions; and - a comprehensive index. I also echo the request for a consistency in style: e.g., always use the OO style as a basis, *supplementing* (i.e., duplicating) with a MATLAB-style as needed. When doing dev and programming work in python, I find myself constantly refering to Martelli's "Python in a Nutshell" (2nd ed., but often using the index from the 1st ed. because it's soo much better). At times I also find Martelli & Ascher's "Python Cookbook" invaluable. I think that a good reference to functions with liberal use of code snippets, combined with a chapter of short cookbook examples, would be most useful for the Matplotlib book. Tell the gent who floated you the proposal that I'm looking forward to purchasing the book. Oh, and please hurry up with the publication!:-) James On Monday 05 January 2009 17:48:43 Christopher Barker wrote: > Sandro Tosi wrote: > > So you suggest to start from matplotlib.pyplot and not from pylab? > > actually, I think matpoltlib.pyplot still has all of pylab in it, just > not all of numpy also. So yes, do that, but what I meant was to focus on > using the OO interface, rather than the state machine interface: > > rather than 'gca', 'gcf', etc, store references to the figures and axis, > etc: > > this kind of thing: > > fig = plt.Figure() > > ax = fig.add_subplot(111) > ax.plot([1,2,3]) > > ax.set_title('hi mom') > > ax.grid(True) > > ax.set_xlabel('time') > ax.set_ylabel('volts') > > While we are at it, discourage the use of "import *" ! > > -Chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQFJZMs1xOXthSHeGJIRAjFeAKC5vxJUaUfS+ePtyW2/ehBfL/GtRQCfVI63 WNT4U8fOaaLL5ijsi4JTz3g= =SpGy -END PGP SIGNATURE- -- Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users