I've managed to work around the problem by: - always allocating the requested size to the various widgets - not rotating annotation labels vertically.
This was just by trial and error, but it seems to work now...? Dave. -- David Snowdon d...@snowdon.id.au http://www.snowdon.id.au On 14/05/2009, at 2:12 AM, matplotlib-users-requ...@lists.sourceforge.net wrote: > Send Matplotlib-users mailing list submissions to > matplotlib-users@lists.sourceforge.net > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > or, via email, send a message with subject or body 'help' to > matplotlib-users-requ...@lists.sourceforge.net > > You can reach the person managing the list at > matplotlib-users-ow...@lists.sourceforge.net > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Matplotlib-users digest..." > > > Today's Topics: > > 1. Re: contour overlapping (Armin Moser) > 2. Re: Subplots (Matthias Michler) > 3. Re: Subplots (Stefanie L?ck) > 4. Re: Matplotlib crashes my GTK program (Jo?o Lu?s Silva) > 5. Re: contour overlapping (Armin Moser) > 6. Re: contour overlapping (Bala subramanian) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Wed, 13 May 2009 14:06:01 +0200 > From: Armin Moser <armin.mo...@student.tugraz.at> > Subject: Re: [Matplotlib-users] contour overlapping > To: Bala subramanian <bala.biophys...@gmail.com> > Cc: matplotlib-users@lists.sourceforge.net > Message-ID: <4a0ab7a9.3070...@student.tugraz.at> > Content-Type: text/plain; charset=ISO-8859-1 > > Bala subramanian schrieb: >> Dear Matthias, >> >> Thank you for the information. Could you please provide me a small >> example >> of such overlapping. > Look at > http://matplotlib.sourceforge.net/examples/pylab_examples/contour_image.html > > or any other contour example from this page: > http://matplotlib.sourceforge.net/examples/index.html > > Armin > > > > ------------------------------ > > Message: 2 > Date: Wed, 13 May 2009 14:16:21 +0200 > From: Matthias Michler <matthiasmich...@gmx.net> > Subject: Re: [Matplotlib-users] Subplots > To: matplotlib-users@lists.sourceforge.net > Message-ID: <200905131416.21942.matthiasmich...@gmx.net> > Content-Type: text/plain; charset="utf-8" > > Hello Stefanie, > > I think the problem is that you try to initialise a subplot with > subplot(112) > which is not possible, because the first to numbers in 112 define > the subplot > structure / geometry (here 1 by 1) and the last number give the > index of the > subplot. > In general you could use N x M (N rows and M columns) for subplots by > subplot(N,M,index) > where 'index' would be a number between 1 and N * M. > > best regards Matthias > > On Wednesday 13 May 2009 14:02:57 Stefanie L?ck wrote: >> Hello! >> >> I'm trying to draw several plots on after the other in a >> wxScrolledPanel >> but I got the error message: >> >> Traceback (most recent call last): >> File "D:\Eigene Datein\Python\current\RNAiscan\Test\sample.py", >> line 96, >> in <m odule> >> frame = MyFrame() >> File "D:\Eigene Datein\Python\current\RNAiscan\Test\sample.py", >> line 56, >> in __ init__ >> self.plot_data(self.fig) >> File "D:\Eigene Datein\Python\current\RNAiscan\Test\sample.py", >> line 90, >> in pl ot_data >> a = figure.add_subplot(id) >> File "C:\python25\lib\site-packages\matplotlib\figure.py", line >> 689, in >> add_su bplot >> a = subplot_class_factory(projection_class)(self, *args, **kwargs) >> File "C:\python25\lib\site-packages\matplotlib\axes.py", line >> 7207, in >> __init_ _ >> raise ValueError( 'Subplot number exceeds total subplots') >> ValueError: Subplot number exceeds total subplots >> >> Here's my code: >> >> # -*- coding: latin1 -*- >> import sys >> >> import wx >> import wx.lib.scrolledpanel as SP >> from wx.lib.mixins.listctrl import CheckListCtrlMixin >> >> from matplotlib.backends.backend_wx import FigureCanvasWx >> from matplotlib.figure import Figure >> import matplotlib.numerix as numpy >> >> from pylab import array, arange, sin, cos, exp, pi, randn, normpdf, >> meshgrid, \ convolve >> >> d = {1: (' Contig5535', '230 '), 2: (' Contig5534', '3240 '), 3: (' >> test', >> '574')} >> >> class CheckListCtrl(wx.ListCtrl, CheckListCtrlMixin): >> def __init__(self, parent): >> wx.ListCtrl.__init__(self, parent, -1, >> style=wx.LC_REPORT|wx.LC_VRULES|wx.LC_HRULES|wx.LC_SORT_ASCENDING) >> CheckListCtrlMixin.__init__(self) >> self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated) >> >> def OnItemActivated(self, evt): >> self.ToggleItem(evt.m_itemIndex) >> >> def OnCheckItem(self, index, flag): >> data = self.GetItemData(index) >> title = d[data][1] >> if flag: >> what = "checked" >> else: >> what = "unchecked" >> >> class MyFrame(wx.Frame): >> >> def __init__(self): >> wx.Frame.__init__(self, None, -1, "My Frame", size=(300, 300)) >> self.panel = SP.ScrolledPanel(self, -1) >> >> self.list = CheckListCtrl(self.panel) >> self.list.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL)) >> >> vbox = wx.BoxSizer(wx.VERTICAL) >> >> self.fig = Figure() >> self.canvas = FigureCanvasWx(self.panel, -1, self.fig) >> self.plot_data(self.fig) >> vbox.Add(self.list,0, wx.EXPAND) >> vbox.Add(self.canvas, 1, wx.LEFT|wx.TOP|wx.GROW) >> >> self.panel.SetSizer(vbox) >> self.panel.SetAutoLayout(1) >> self.panel.SetupScrolling() >> >> self.list.InsertColumn(0, "ID") >> self.list.InsertColumn(1, "Nr. of Hits") >> for key, data in d.iteritems(): >> index = self.list.InsertStringItem(sys.maxint, data[0]) >> self.list.SetStringItem(index, 1, data[1]) >> #self.list.SetStringItem(index, 2, data[2]) >> self.list.SetItemData(index, key) >> self.list.SetColumnWidth(0, wx.LIST_AUTOSIZE) >> self.list.SetColumnWidth(1, 100) >> self.Show() >> >> def plot_data(self, figure): >> liste2 = ['Contig5535_range.txtcounts.txt', >> 'Contig5534_range.txtcounts.txt'] id = 111 >> >> for q in liste2: >> f = open(q, 'r') >> data = f.readlines() >> liste3 = [] >> liste4 = [] >> for line in data: >> line = line.strip() >> x = line.split(" ") >> liste3.append(int(x[0])) >> liste4.append(int(x[1])) >> >> a = figure.add_subplot(id) >> a.plot(liste3,liste4) >> id = id + 1 >> >> if __name__ == '__main__': >> app = wx.PySimpleApp() >> frame = MyFrame() >> frame.Show(True) >> app.MainLoop() >> >> Has someone an idea how to solve this? >> Thank in advance >> Stefanie > > > > > > ------------------------------ > > Message: 3 > Date: Wed, 13 May 2009 15:14:34 +0200 > From: Stefanie L?ck <lu...@ipk-gatersleben.de> > Subject: Re: [Matplotlib-users] Subplots > To: "Matthias Michler" <matthiasmich...@gmx.net>, > <matplotlib-users@lists.sourceforge.net> > Message-ID: <009801c9d3cc$c2c3f0e0$1022a...@ipkgatersleben.de> > Content-Type: text/plain; format=flowed; charset="UTF-8"; > reply-type=original > > Thanks a lot! Problem solved! > Stefanie > ----- Original Message ----- > From: "Matthias Michler" <matthiasmich...@gmx.net> > To: <matplotlib-users@lists.sourceforge.net> > Sent: Wednesday, May 13, 2009 2:16 PM > Subject: Re: [Matplotlib-users] Subplots > > >> Hello Stefanie, >> >> I think the problem is that you try to initialise a subplot with >> subplot(112) >> which is not possible, because the first to numbers in 112 define the >> subplot >> structure / geometry (here 1 by 1) and the last number give the >> index of >> the >> subplot. >> In general you could use N x M (N rows and M columns) for subplots by >> subplot(N,M,index) >> where 'index' would be a number between 1 and N * M. >> >> best regards Matthias >> >> On Wednesday 13 May 2009 14:02:57 Stefanie L?ck wrote: >>> Hello! >>> >>> I'm trying to draw several plots on after the other in a >>> wxScrolledPanel >>> but I got the error message: >>> >>> Traceback (most recent call last): >>> File "D:\Eigene Datein\Python\current\RNAiscan\Test\sample.py", >>> line >>> 96, >>> in <m odule> >>> frame = MyFrame() >>> File "D:\Eigene Datein\Python\current\RNAiscan\Test\sample.py", >>> line >>> 56, >>> in __ init__ >>> self.plot_data(self.fig) >>> File "D:\Eigene Datein\Python\current\RNAiscan\Test\sample.py", >>> line >>> 90, >>> in pl ot_data >>> a = figure.add_subplot(id) >>> File "C:\python25\lib\site-packages\matplotlib\figure.py", line >>> 689, in >>> add_su bplot >>> a = subplot_class_factory(projection_class)(self, *args, >>> **kwargs) >>> File "C:\python25\lib\site-packages\matplotlib\axes.py", line >>> 7207, in >>> __init_ _ >>> raise ValueError( 'Subplot number exceeds total subplots') >>> ValueError: Subplot number exceeds total subplots >>> >>> Here's my code: >>> >>> # -*- coding: latin1 -*- >>> import sys >>> >>> import wx >>> import wx.lib.scrolledpanel as SP >>> from wx.lib.mixins.listctrl import CheckListCtrlMixin >>> >>> from matplotlib.backends.backend_wx import FigureCanvasWx >>> from matplotlib.figure import Figure >>> import matplotlib.numerix as numpy >>> >>> from pylab import array, arange, sin, cos, exp, pi, randn, normpdf, >>> meshgrid, \ convolve >>> >>> d = {1: (' Contig5535', '230 '), 2: (' Contig5534', '3240 '), 3: (' >>> test', >>> '574')} >>> >>> class CheckListCtrl(wx.ListCtrl, CheckListCtrlMixin): >>> def __init__(self, parent): >>> wx.ListCtrl.__init__(self, parent, -1, >>> style=wx.LC_REPORT|wx.LC_VRULES|wx.LC_HRULES|wx.LC_SORT_ASCENDING) >>> CheckListCtrlMixin.__init__(self) >>> self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated) >>> >>> def OnItemActivated(self, evt): >>> self.ToggleItem(evt.m_itemIndex) >>> >>> def OnCheckItem(self, index, flag): >>> data = self.GetItemData(index) >>> title = d[data][1] >>> if flag: >>> what = "checked" >>> else: >>> what = "unchecked" >>> >>> class MyFrame(wx.Frame): >>> >>> def __init__(self): >>> wx.Frame.__init__(self, None, -1, "My Frame", size=(300, >>> 300)) >>> self.panel = SP.ScrolledPanel(self, -1) >>> >>> self.list = CheckListCtrl(self.panel) >>> self.list.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, >>> wx.NORMAL)) >>> >>> vbox = wx.BoxSizer(wx.VERTICAL) >>> >>> self.fig = Figure() >>> self.canvas = FigureCanvasWx(self.panel, -1, self.fig) >>> self.plot_data(self.fig) >>> vbox.Add(self.list,0, wx.EXPAND) >>> vbox.Add(self.canvas, 1, wx.LEFT|wx.TOP|wx.GROW) >>> >>> self.panel.SetSizer(vbox) >>> self.panel.SetAutoLayout(1) >>> self.panel.SetupScrolling() >>> >>> self.list.InsertColumn(0, "ID") >>> self.list.InsertColumn(1, "Nr. of Hits") >>> for key, data in d.iteritems(): >>> index = self.list.InsertStringItem(sys.maxint, data[0]) >>> self.list.SetStringItem(index, 1, data[1]) >>> #self.list.SetStringItem(index, 2, data[2]) >>> self.list.SetItemData(index, key) >>> self.list.SetColumnWidth(0, wx.LIST_AUTOSIZE) >>> self.list.SetColumnWidth(1, 100) >>> self.Show() >>> >>> def plot_data(self, figure): >>> liste2 = ['Contig5535_range.txtcounts.txt', >>> 'Contig5534_range.txtcounts.txt'] id = 111 >>> >>> for q in liste2: >>> f = open(q, 'r') >>> data = f.readlines() >>> liste3 = [] >>> liste4 = [] >>> for line in data: >>> line = line.strip() >>> x = line.split(" ") >>> liste3.append(int(x[0])) >>> liste4.append(int(x[1])) >>> >>> a = figure.add_subplot(id) >>> a.plot(liste3,liste4) >>> id = id + 1 >>> >>> if __name__ == '__main__': >>> app = wx.PySimpleApp() >>> frame = MyFrame() >>> frame.Show(True) >>> app.MainLoop() >>> >>> Has someone an idea how to solve this? >>> Thank in advance >>> Stefanie >> >> >> >> ------------------------------------------------------------------------------ >> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! >> Your >> production scanning environment may not be a perfect world - but >> thanks to >> Kodak, there's a perfect scanner to get the job done! With the NEW >> KODAK >> i700 >> Series Scanner you'll get full speed at 300 dpi even with all image >> processing features enabled. http://p.sf.net/sfu/kodak-com >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > > > > ------------------------------ > > Message: 4 > Date: Wed, 13 May 2009 14:37:44 +0100 > From: Jo?o Lu?s Silva <jsi...@fc.up.pt> > Subject: Re: [Matplotlib-users] Matplotlib crashes my GTK program > To: matplotlib-users@lists.sourceforge.net > Message-ID: <gueied$80...@ger.gmane.org> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > David Snowdon wrote: >> Hi all, >> >> This will probably end up being my very silly mistake, but at the >> moment, Matplotlib crashes my program with an X error whenever my >> window >> isn't expanded far enough. >> >> For those interested, it is a front-end for the strategy and analysis >> software for the Sunswift solar car (http://www.sunswift.com). I >> attach >> a screenshot (when it is expanded to the full screen, and therefore >> works) in case it helps. >> >> >> da...@daves:~/projects/sunswift/carsoft/scanalysis$ python -c "import >> matplotlib; print matplotlib.__version__" >> 0.91.2 >> > > I read the code you sent. You shouldn't import pylab (neither > pyplot?), > although you don't seem to be using it. Maybe the paint_event is > firing > when it shouldn't? > > Aside from that, my only advice would be to update matplotlib to the > latest version. > > JLS > > > > > ------------------------------ > > Message: 5 > Date: Wed, 13 May 2009 17:33:11 +0200 > From: Armin Moser <armin.mo...@student.tugraz.at> > Subject: Re: [Matplotlib-users] contour overlapping > To: Bala subramanian <bala.biophys...@gmail.com>, > matplotlib-users@lists.sourceforge.net > Message-ID: <4a0ae837.4050...@student.tugraz.at> > Content-Type: text/plain; charset=ISO-8859-1 > > Bala subramanian schrieb: >> hai Armin, >> >> I looked through the examples. I could not find any example of >> overlapping >> two differnet countours on the same plot. > I think the first example filled contours does exactly that. You > want to > show two contours over each other in the same plot. > You just have to substitute the Z in cset_1 with matrix_1 and in > cset_2 > with matrix_2. Of course it will be helpful to use different > colormaps. > E.g. a grey one for the underlying contour and a colored for the top > one. > > x = arange(5) > y = arange(5) > x,y = meshgrid(x,y) > Z = x**2+y**2 > #contourf(Z,cmap=cm.binary) # filled contours gray > contour(Z) # not filled contours colored > error = rand(x.shape[0],x.shape[1]) # to generate a new Z > Z = (x+error)**2+(y+error)**2 > contour(Z) # colored not filled contours > > Armin > > > > ------------------------------ > > Message: 6 > Date: Wed, 13 May 2009 18:12:53 +0200 > From: Bala subramanian <bala.biophys...@gmail.com> > Subject: Re: [Matplotlib-users] contour overlapping > To: Armin Moser <armin.mo...@student.tugraz.at> > Cc: matplotlib-users@lists.sourceforge.net > Message-ID: > <288df32a0905130912w42fe4df3me9874e7df8fe9...@mail.gmail.com> > Content-Type: text/plain; charset="iso-8859-1" > > Armin, > I tried this but what happens is it is not overlapping, actually > when i call > contour function for the second time with matrix2, the plot is > updated with > contour of matrix 2. > > contour(matrix1) > contour(matrix2). > > What i finally get is the contour of matrix 2 as the final plot. > What i am > trying to do is that, i shd have one plot, with upper left panel for > matrix1 > and lower right panel for matrix2 with their separation along the > diagonal. > I have attached an example picture like which i am trying to make. > > Bala > > On Wed, May 13, 2009 at 5:33 PM, Armin Moser > <armin.mo...@student.tugraz.at>wrote: > >> Bala subramanian schrieb: >>> hai Armin, >>> >>> I looked through the examples. I could not find any example of >> overlapping >>> two differnet countours on the same plot. >> I think the first example filled contours does exactly that. You >> want to >> show two contours over each other in the same plot. >> You just have to substitute the Z in cset_1 with matrix_1 and in >> cset_2 >> with matrix_2. Of course it will be helpful to use different >> colormaps. >> E.g. a grey one for the underlying contour and a colored for the >> top one. >> >> x = arange(5) >> y = arange(5) >> x,y = meshgrid(x,y) >> Z = x**2+y**2 >> #contourf(Z,cmap=cm.binary) # filled contours gray >> contour(Z) # not filled contours colored >> error = rand(x.shape[0],x.shape[1]) # to generate a new Z >> Z = (x+error)**2+(y+error)**2 >> contour(Z) # colored not filled contours >> >> Armin >> > -------------- next part -------------- > An HTML attachment was scrubbed... > -------------- next part -------------- > A non-text attachment was scrubbed... > Name: Pictur.png > Type: image/png > Size: 138920 bytes > Desc: not available > > ------------------------------ > > ------------------------------------------------------------------------------ > The NEW KODAK i700 Series Scanners deliver under ANY circumstances! > Your > production scanning environment may not be a perfect world - but > thanks to > Kodak, there's a perfect scanner to get the job done! With the NEW > KODAK i700 > Series Scanner you'll get full speed at 300 dpi even with all image > processing features enabled. http://p.sf.net/sfu/kodak-com > > ------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > End of Matplotlib-users Digest, Vol 36, Issue 31 > ************************************************ ------------------------------------------------------------------------------ The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users