Re: [Matplotlib-users] Strange issue when using Matplotlib with PyQt4
Hello, Yes, the problem was really related to my version of matplot: i used matplot 0.98.5.2-4.fc11 before. I tried it with the latest svn revision (r7279) and it worked. Thanks, Lukas Am Dienstag 21 Juli 2009 21:02:03 schrieb Darren Dale: > On Tue, Jul 21, 2009 at 3:01 PM, Darren Dale wrote: > > On Tue, Jul 21, 2009 at 2:47 PM, Lukas Hetzenecker wrote: > >> Hello, > >> the matplotlib widget has an incorrect default size (the left one in the > >> attatched screenshot). > >> I couldn't reproduce this behaviour with any Qt widget - so it seems > >> that this is specific to matplotlib. But as I'm not really sure of the > >> cause I posted it to both lists. > > > > Please keep in mind that these are both heavily subscribed lists. It > > would be better not to burden the pyqt list with suspected matplotlib > > problems. > > > > What versions of qt, pyqt and matplotlib are you using? I have > > qt-4.5.2, PyQt-4.5.2, and an up to date matplotlib svn checkout, and I > > don't see a problem. Maybe recent changes in svn have fixed the > > problem, you could try downloading backend_qt4.py and > > backend_qt4agg.py from > > http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/ > >lib/matplotlib/backends/ if you can't build an svn checkout. > > Forgot the attachment. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] adjusting the height of rectangle legend handles
The height of the box will scale with the font size. If you want to change the height independent of the font size, you need to manually adjust the properties of the individual legend handles. l = legend() patches = l.get_patches() # list of legend handles whose type is matplotlib.Patch. for p in patches: p.set_height(20) # height in point. you can also adjust y positionwith set_y method. Note that y=0 is the baseline. Regards, -JJ On Tue, Jul 21, 2009 at 3:30 PM, Chuck Pepe-Ranney wrote: > I know that there is a keyword argument for adjusting the width of legend > handles but how would I reduce the height of rectangle label handles? > > -Chuck > > -- > > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] adjusting the height of rectangle legend handles
I know that there is a keyword argument for adjusting the width of legend handles but how would I reduce the *height* of rectangle label handles? -Chuck -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Colorbar not working with specgram
davide lasagna wrote: > Hello everybody, > this is my first post in this list. > > I'm plotting a spectrogram with > > Pxx, freqs, bins, im = specgram(y, nfft=256, f_sampling=12000) > > and i want to add a colorbar with > > colorbar() > > > The problem is that the color scale seems to be wrong with respect to > the data in Pxx, i.e. Pxx is of the order of 1e-2 while in the colorbar > i have tick values spanning from -20 to -180. What is the problem?? specgram and psd plot power in decibels: 10*log10(Pxx). Because they involve heavy computation and application-specific choices, like the decibel scale, they really should not be axes methods. You can make a function plot the spectrogram however you like by looking at the source code in the Axes.specgram method (the pyplot specgram function is just a thin wrapper for this method), which is using mlab.specgram to do the calculation and is then just scaling and plotting. Eric > > Thanks in advance! > > > Davide > > > -- > Enter the BlackBerry Developer Challenge > This is your chance to win up to $100,000 in prizes! For a limited time, > vendors submitting new applications to BlackBerry App World(TM) will have > the opportunity to enter the BlackBerry Developer Challenge. See full prize > details at: http://p.sf.net/sfu/Challenge > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Strange issue when using Matplotlib with PyQt4
On Tue, Jul 21, 2009 at 2:47 PM, Lukas Hetzenecker wrote: > Hello, > the matplotlib widget has an incorrect default size (the left one in the > attatched screenshot). > I couldn't reproduce this behaviour with any Qt widget - so it seems that this > is specific to matplotlib. But as I'm not really sure of the cause I posted it > to both lists. Please keep in mind that these are both heavily subscribed lists. It would be better not to burden the pyqt list with suspected matplotlib problems. What versions of qt, pyqt and matplotlib are you using? I have qt-4.5.2, PyQt-4.5.2, and an up to date matplotlib svn checkout, and I don't see a problem. Maybe recent changes in svn have fixed the problem, you could try downloading backend_qt4.py and backend_qt4agg.py from http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/lib/matplotlib/backends/ if you can't build an svn checkout. Darren -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Strange issue when using Matplotlib with PyQt4
Hello, the matplotlib widget has an incorrect default size (the left one in the attatched screenshot). I couldn't reproduce this behaviour with any Qt widget - so it seems that this is specific to matplotlib. But as I'm not really sure of the cause I posted it to both lists. Lukas Am Dienstag 21 Juli 2009 20:31:55 schrieb Darren Dale: > On Tue, Jul 21, 2009 at 12:06 PM, Lukas Hetzenecker wrote: > > Sorry for annoying you, but I attatched a new example to this message: > > I've rewritten the PyQt4-example from the website to draw the Figure in a > > tab widget. The same happens ;) > > In your original post, you said: > > "the widget in the Tab is incorrectly sized. > If I embed the FigureCanvas in a QTabWidget the widget is to big, but if I > put it in a QWidget it is shown correctly." > > Could you be more specific? What does "incorrectly sized" mean? What > do you mean by the widget is "too big", as opposed to "shown > correctly"? Is this really a PyQt issue, or is it specific to > matplotlib? If the latter we should continue the discussion on the mpl > mailing list instead of cross-posting. > > Darren <>-- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Strange issue when using Matplotlib with PyQt4
On Tue, Jul 21, 2009 at 12:06 PM, Lukas Hetzenecker wrote: > Sorry for annoying you, but I attatched a new example to this message: I've > rewritten the PyQt4-example from the website to draw the Figure in a tab > widget. The same happens ;) In your original post, you said: "the widget in the Tab is incorrectly sized. If I embed the FigureCanvas in a QTabWidget the widget is to big, but if I put it in a QWidget it is shown correctly." Could you be more specific? What does "incorrectly sized" mean? What do you mean by the widget is "too big", as opposed to "shown correctly"? Is this really a PyQt issue, or is it specific to matplotlib? If the latter we should continue the discussion on the mpl mailing list instead of cross-posting. Darren -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] speeding-up griddata()
Robert C, Robert K, folks, messing with the nice delaunay/testfuncs.py to time linear_interpolate_grid nn_interpolate_grid and nn_interpolate_unstructured in _delaunay, I see linear ~ 100 times faster than the nn_ s: # from: trigrid Ntri=1000 Ngrid=100 run: 21 Jul 2009 17:33 mac 10.4.11 ppc time: 0.027 sec trigrid: build Triangulation 1000 time: 0.0059 sec trigrid 100 "linear" corners: 0 1 2 1 time: 0.5 sec trigrid 100 "nn_grid" corners: 0 1 2 1 time: 0.49 sec trigrid 100 "nn_unstruct" corners: 0 1 2 1 Correct me: if all 3 methods do gridpoint-to-triangle in the same way, then the huge diff is in find-neighboring-triangles (6 on average ?), not in gridpoint-to-triangle ? This is with the _delaunay.so that comes with the mac 98.5.3 egg, however that was compiled (-O3 ?) What to do ? 1) does it matter, how many people care ? (all who believe in telekinesis, raise my right hand) 2) natgrid ? don't see it in matplotlib.sf.net 3) stick with fast linear, smooth the triangle planes a la 3t^2 - 2t^3 or fancier smoothing In any case, add griddata( ... method = "linear" / "nn" ... ) so users have a choice. Can a real user or two tell us about the flow, with some rough numbers for Ntri Ngrid Npix -- Ntri = nr original sample points, say 1000 Ngrid 100 x 100 Npix 800 x 600 ? (Ntri -> Ngrid slowly and accurately, then Ngrid -> Npix w fast inaccurate image interpolation ? hmm.) cheers -- denis -- View this message in context: http://www.nabble.com/speeding-up-griddata%28%29-tp24467055p24591133.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
Re: [Matplotlib-users] Problems with autofmt_xdate()
On Tue, Jul 21, 2009 at 10:51 AM, Domenico Nappo wrote: > "C:\Python25\Lib\site-packages\matplotlib\backends\backend_gtkagg.py", line > 14, in > from matplotlib.backends._gtkagg import agg_to_gtk_drawable > ImportError: No module named _gtkagg > > I have the suspect that matplotlib windows support simply doesn't exist:) > I'll try prepackaged windows distributions like EPD or Python(x,y) and hope > this will solve this issue... I'm pretty sure they do not package mpl with the gtk backend, but Christoph Gohlke has a version that does http://www.lfd.uci.edu/~gohlke/#pythonlibs -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] interactive graphing, without ipython
Hi Blaine, let me first of all give you the reference to some documentation about the usage of show: http://matplotlib.sourceforge.net/faq/howto_faq.html#use-show Furthermore I may recommend you to replace your call of show in 'p' by a call of draw, which will yield the expected behaviour in ipythons pylab mode. Hopefully these hints are helpful to you. best regards Matthias On Monday 20 July 2009 19:36:24 Blaine Booher wrote: > hey everyone, > I have an interactive python application that I am using pylab with. I > am having a problem where I can only create a graph ONE time. all other > calls to plot() and show() cause nothing to happen. > > I have used ipython -pylab as well, but the problem I am having with > ipython is that all the graphs will show up AFTER i close my interactive > shell. Of course, ipython works interatively every time I 'plot' or 'show' > at the ipython command line. > > Is this a backend issue? Does anyone else have this problem? > > issue can be summarized as such: > >>>from pylab import * > >>>def p(): > > plot([1,2], [1,2]) > show() > > >>>p() // works fine. graph pops up. > >>>p() //returns nothing, no graph shows up > >>>p() //same as above > > I am on Debian Lenny, pylab .98.3-5 > > Blaine -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] I really can't get into hist() barstacked
Hi all, I'd like to do a histogram with barstacked style. Well, I'm not able to make it in any way :( - what is the format of the the data to pass? - what's the value of bins? (related to the above question, I suppose) for example, let's say I want to plot this series s1 = 2,3,6,3,1 s2 = 1,2,2,4,1 s3 = 4,1,0,3,7 what's the format of data to pass to hist() ? by row? by column? Thanks a lot in advance, -- Sandro Tosi (aka morph, morpheus, matrixhasu) My website: http://matrixhasu.altervista.org/ Me at Debian: http://wiki.debian.org/SandroTosi -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Problems with autofmt_xdate()
Thanks for your reply, anyway. I've tried to change the backend to GTKAgg and now when I startt ipython -pylab I receive: Traceback (most recent call last): File "C:\Python25\scripts\ipython.py", line 28, in IPython.Shell.start().mainloop() File "C:\Python25\Lib\site-packages\IPython\Shell.py", line 1233, in start return shell(user_ns = user_ns) File "C:\Python25\Lib\site-packages\IPython\Shell.py", line 1108, in __init__ shell_class=MatplotlibMTShell) File "C:\Python25\Lib\site-packages\IPython\Shell.py", line 793, in __init__ on_kill=[mainquit]) File "C:\Python25\Lib\site-packages\IPython\ipmaker.py", line 103, in make_IPython embedded=embedded,**kw) File "C:\Python25\Lib\site-packages\IPython\Shell.py", line 639, in __init__ user_ns,user_global_ns,b2 = self._matplotlib_config(name,user_ns,user_global_ns) File "C:\Python25\Lib\site-packages\IPython\Shell.py", line 559, in _matplotlib_config import matplotlib.pylab as pylab File "C:\Python25\Lib\site-packages\matplotlib\pylab.py", line 253, in from matplotlib.pyplot import * File "C:\Python25\Lib\site-packages\matplotlib\pyplot.py", line 75, in new_figure_manager, draw_if_interactive, show = pylab_setup() File "C:\Python25\Lib\site-packages\matplotlib\backends\__init__.py", line 25, in pylab_setup globals(),locals(),[backend_name]) File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_gtkagg.py", line 14, in from matplotlib.backends._gtkagg import agg_to_gtk_drawable ImportError: No module named _gtkagg I have the suspect that matplotlib windows support simply doesn't exist:) I'll try prepackaged windows distributions like EPD or Python(x,y) and hope this will solve this issue... Thanks again. 2009/7/21 Jae-Joon Lee > As the warning message indicates, I think this is a backend issue. > The recommended backend (for screen display) is the Agg family, e.g., > TkAgg, GTKAgg, etc. > > I rarely use Windows and I never used matplotlib on Windows, so there > is not much I can help. > I'm not sure which backend is available on Windows, but try some other > backend. > > http://matplotlib.sourceforge.net/faq/installing_faq.html#what-is-a-backend > > Also, please check out the binary installer for windows, > > http://matplotlib.sourceforge.net/faq/installing_faq.html#windows-questions > > Regards, > > -JJ > > > On Tue, Jul 21, 2009 at 4:01 AM, Domenico Nappo > wrote: > > Hi JJ, > > thanks for your reply. > > Let me say first that I've some problems with installation, I think: when > I > > try to run ipython -pylab I got the following: > > C:\Documents and Settings\user>ipython -pylab > > Traceback (most recent call last): > > File "C:\Python25\scripts\ipython.py", line 28, in > > IPython.Shell.start().mainloop() > > File "C:\Python25\Lib\site-packages\IPython\Shell.py", line 1233, in > start > > return shell(user_ns = user_ns) > > File "C:\Python25\Lib\site-packages\IPython\Shell.py", line 1108, in > > __init__ > > shell_class=MatplotlibMTShell) > > File "C:\Python25\Lib\site-packages\IPython\Shell.py", line 793, in > > __init__ > > on_kill=[mainquit]) > > File "C:\Python25\Lib\site-packages\IPython\ipmaker.py", line 103, in > > make_IPython > > embedded=embedded,**kw) > > File "C:\Python25\Lib\site-packages\IPython\Shell.py", line 639, in > > __init__ > > user_ns,user_global_ns,b2 = > > self._matplotlib_config(name,user_ns,user_global_ns) > > File "C:\Python25\Lib\site-packages\IPython\Shell.py", line 559, in > > _matplotlib_config > > import matplotlib.pylab as pylab > > File "C:\Python25\Lib\site-packages\matplotlib\pylab.py", line 253, in > > > > from matplotlib.pyplot import * > > File "C:\Python25\Lib\site-packages\matplotlib\pyplot.py", line 75, in > > > > new_figure_manager, draw_if_interactive, show = pylab_setup() > > File "C:\Python25\Lib\site-packages\matplotlib\backends\__init__.py", > line > > 25, in pylab_setup > > globals(),locals(),[backend_name]) > > File > "C:\Python25\Lib\site-packages\matplotlib\backends\backend_gtk.py", > > line 25, in > > from matplotlib.backends.backend_gdk import RendererGDK, > FigureCanvasGDK > > File > "C:\Python25\lib\site-packages\matplotlib\backends\backend_gdk.py", > > line 29, in > > from matplotlib.backends._backend_gdk import pixbuf_get_pixels_array > > ImportError: No module named _backend_gdk > > > > If I comment the import statement for _backend_gdk in backend_gdk.py, > > ipython runs well. > > Below, the code: > > In [20]: > > > X=load('E:\\user\\Applicazioni\\EFGExtractor\\dataJan03Dec08.matplotlibtest',converters={0:strpdate2num('%Y-%m-%d')}) > > > > In [21]: time = X[:,0] > > > > In [22]: time > > Out[22]: array([ 731216., 731217., 731218., ..., 733040., 733041., > 733042.]) > > > > In [23]: data = X[:,1] > > > > In [24]: data > > Out[24]: array([ 150., 140., 142., ..., 92., 84., 76.]) > > > > > > In [30]: fig = figure() > > > > In [31]: ax = fig.add_subplot(111) > > > > In [32]: ax.plot_date(time
Re: [Matplotlib-users] Problems with autofmt_xdate()
As the warning message indicates, I think this is a backend issue. The recommended backend (for screen display) is the Agg family, e.g., TkAgg, GTKAgg, etc. I rarely use Windows and I never used matplotlib on Windows, so there is not much I can help. I'm not sure which backend is available on Windows, but try some other backend. http://matplotlib.sourceforge.net/faq/installing_faq.html#what-is-a-backend Also, please check out the binary installer for windows, http://matplotlib.sourceforge.net/faq/installing_faq.html#windows-questions Regards, -JJ On Tue, Jul 21, 2009 at 4:01 AM, Domenico Nappo wrote: > Hi JJ, > thanks for your reply. > Let me say first that I've some problems with installation, I think: when I > try to run ipython -pylab I got the following: > C:\Documents and Settings\user>ipython -pylab > Traceback (most recent call last): > File "C:\Python25\scripts\ipython.py", line 28, in > IPython.Shell.start().mainloop() > File "C:\Python25\Lib\site-packages\IPython\Shell.py", line 1233, in start > return shell(user_ns = user_ns) > File "C:\Python25\Lib\site-packages\IPython\Shell.py", line 1108, in > __init__ > shell_class=MatplotlibMTShell) > File "C:\Python25\Lib\site-packages\IPython\Shell.py", line 793, in > __init__ > on_kill=[mainquit]) > File "C:\Python25\Lib\site-packages\IPython\ipmaker.py", line 103, in > make_IPython > embedded=embedded,**kw) > File "C:\Python25\Lib\site-packages\IPython\Shell.py", line 639, in > __init__ > user_ns,user_global_ns,b2 = > self._matplotlib_config(name,user_ns,user_global_ns) > File "C:\Python25\Lib\site-packages\IPython\Shell.py", line 559, in > _matplotlib_config > import matplotlib.pylab as pylab > File "C:\Python25\Lib\site-packages\matplotlib\pylab.py", line 253, in > > from matplotlib.pyplot import * > File "C:\Python25\Lib\site-packages\matplotlib\pyplot.py", line 75, in > > new_figure_manager, draw_if_interactive, show = pylab_setup() > File "C:\Python25\Lib\site-packages\matplotlib\backends\__init__.py", line > 25, in pylab_setup > globals(),locals(),[backend_name]) > File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_gtk.py", > line 25, in > from matplotlib.backends.backend_gdk import RendererGDK, FigureCanvasGDK > File "C:\Python25\lib\site-packages\matplotlib\backends\backend_gdk.py", > line 29, in > from matplotlib.backends._backend_gdk import pixbuf_get_pixels_array > ImportError: No module named _backend_gdk > > If I comment the import statement for _backend_gdk in backend_gdk.py, > ipython runs well. > Below, the code: > In [20]: > X=load('E:\\user\\Applicazioni\\EFGExtractor\\dataJan03Dec08.matplotlibtest',converters={0:strpdate2num('%Y-%m-%d')}) > > In [21]: time = X[:,0] > > In [22]: time > Out[22]: array([ 731216., 731217., 731218., ..., 733040., 733041., 733042.]) > > In [23]: data = X[:,1] > > In [24]: data > Out[24]: array([ 150., 140., 142., ..., 92., 84., 76.]) > > > In [30]: fig = figure() > > In [31]: ax = fig.add_subplot(111) > > In [32]: ax.plot_date(time, data, '-') > Out[32]: [] > > In [33]: show() > > In [34]: fig.autofmt_xdate() > > > In [37]: > C:\Python25\lib\site-packages\matplotlib\backends\backend_gdk.py:148: > UserWarning: backend_gdk: unable to draw text at angles other than 0 or 90 > 'other than 0 or 90') > This time I've noticed the warning above: "unable to draw text at angles > other than 0 or 90" > Thanks in advance for any clarification... > 2009/7/17 Jae-Joon Lee >> >> Please post a simple, standalone script that reproduces your problem, >> so that we can track down what is causing the problem. I don't think >> there has been any report of a similar issue (but not sure). As far as >> I know, autofmt_xdata only adjusts the alignment and rotation of the >> ticklabels and does not change the font property. >> >> -JJ >> >> >> On Thu, Jul 16, 2009 at 10:55 AM, Domenico >> Nappo wrote: >> > Whenever I try to use autofmt_xdate() on a Figure(), dates on x axis >> > disappear...I guess this is related with something concerning font >> > management... >> > Anyone experienced this kind of issues? >> > >> > I use most recent versions of matplotlib, numpy, gtk2, pygtk on a Python >> > 2.5 >> > platform (installed via binaries on a window xp machine). >> > >> > >> > -- >> > Enter the BlackBerry Developer Challenge >> > This is your chance to win up to $100,000 in prizes! For a limited time, >> > vendors submitting new applications to BlackBerry App World(TM) will >> > have >> > the opportunity to enter the BlackBerry Developer Challenge. See full >> > prize >> > details at: http://p.sf.net/sfu/Challenge >> > ___ >> > Matplotlib-users mailing list >> > Matplotlib-users@lists.sourceforge.net >> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > >> > > > ---
[Matplotlib-users] setting user defined color map as default
Hi, I just created a hsv-like color map with gray levels only, now I'd like to use this as default color map. But how? Calling it like hsv() does not work and I did not find a hint in the documentation how to set a user defined color map interactively as default color map. Cheers Philipp -- View this message in context: http://www.nabble.com/setting-user-defined-color-map-as-default-tp24587528p24587528.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users