Re: [matplotlib-devel] Problems with new PyQt4 API
Hi Benjamin, Hi List, sorry for the backwards patch, here the forward one: --- backend_qt4_orig.py 2011-03-02 16:16:38.257797767 +0100 +++ backend_qt4.py 2011-03-02 16:17:19.526831397 +0100 @@ -395,8 +395,9 @@ filters.append(filter) filters = ';;'.join(filters) -fname = QtGui.QFileDialog.getSaveFileName( -self, "Choose a filename to save to", start, filters, selectedFilter) +fname, _ = QtGui.QFileDialog.getSaveFileNameAndFilter( +self, "Choose a filename to save to", start, filters, +selectedFilter) if fname: try: self.canvas.print_figure( unicode(fname) ) It is done against a rather old version of matplotlib (the 0.99.3, the newest in kubuntu...) but the code hasn't changed since then, acording to github, so only the line numbers are wrong. The second patch I sent is now obsolete, as you hinted to the patch on github. I had followed the link on the matplotlib web site (http://matplotlib.sourceforge.net/) which links still to some subversion repository once you click onto "source code" Could please someone update that link to github? Or is there a new matplotlib website as well (google didn't find one). Greetings Martin -- Max-Born-Institut Max-Born-Straße 2a 12489 Berlin +49 30 6392 1234 -- Free Software Download: 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. http://p.sf.net/sfu/splunk-dev2dev ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
[matplotlib-devel] bug 3165422, color cycles even if kwarg 'color' is set
Hey, i just fixed this bug: http://sourceforge.net/tracker/?func=detail&aid=3165422&group_id=80706&atid=560720 It's a one-liner. I think it's overkill to start a pull request for it. --- a/lib/matplotlib/axes.py +++ b/lib/matplotlib/axes.py @@ -247,7 +247,7 @@ class _process_plot_var_args: def _makeline(self, x, y, kw, kwargs): kw = kw.copy() # Don't modify the original kw. -if not 'color' in kw: +if not 'color' in kw and not 'color' in kwargs.keys(): kw['color'] = self.color_cycle.next() # (can't use setdefault because it always evaluates # its second argument) it's also attached. Or do you want to use a pull request? kind regards maximilian diff --git a/lib/matplotlib/axes.py b/lib/matplotlib/axes.py index f47eaa4..b192e5b 100644 --- a/lib/matplotlib/axes.py +++ b/lib/matplotlib/axes.py @@ -247,7 +247,7 @@ class _process_plot_var_args: def _makeline(self, x, y, kw, kwargs): kw = kw.copy() # Don't modify the original kw. -if not 'color' in kw: +if not 'color' in kw and not 'color' in kwargs.keys(): kw['color'] = self.color_cycle.next() # (can't use setdefault because it always evaluates # its second argument) signature.asc Description: OpenPGP digital signature -- Free Software Download: 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. http://p.sf.net/sfu/splunk-dev2dev ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Problems with new PyQt4 API
On Thu, Mar 3, 2011 at 3:15 AM, Martin Teichmann wrote: > Hi Benjamin, Hi List, > > sorry for the backwards patch, here the forward one: > > > --- backend_qt4_orig.py 2011-03-02 16:16:38.257797767 +0100 > +++ backend_qt4.py 2011-03-02 16:17:19.526831397 +0100 > @@ -395,8 +395,9 @@ > filters.append(filter) > filters = ';;'.join(filters) > > -fname = QtGui.QFileDialog.getSaveFileName( > -self, "Choose a filename to save to", start, filters, > selectedFilter) > +fname, _ = QtGui.QFileDialog.getSaveFileNameAndFilter( > +self, "Choose a filename to save to", start, filters, > +selectedFilter) > if fname: > try: > self.canvas.print_figure( unicode(fname) ) > > > > It is done against a rather old version of matplotlib (the 0.99.3, the > newest in kubuntu...) but the code hasn't changed since then, > acording to github, so only the line numbers are wrong. > > The second patch I sent is now obsolete, as you hinted to the > patch on github. I had followed the link on the matplotlib > web site (http://matplotlib.sourceforge.net/) which links still to > some subversion repository once you click onto "source code" > Could please someone update that link to github? Or is there > a new matplotlib website as well (google didn't find one). > > Greetings > > Martin > > -- > Max-Born-Institut > Max-Born-Straße 2a > 12489 Berlin > +49 30 6392 1234 > Martin, Thank you for double-checking your patches. I will see about getting it added into mpl today. As for the sourceforge/github confusion, we are currently in a transition phase. Our repository is now hosted on github, but the official website and trackers are still sourceforge. Sorry for any confusion there. The (un)official new website will be http://matplotlib.github.com. Thank you for helping to make matplotlib better! Ben Root -- Free Software Download: 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. http://p.sf.net/sfu/splunk-dev2dev ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Problems with new PyQt4 API
On Thu, Mar 3, 2011 at 9:36 AM, Benjamin Root wrote: > As for the sourceforge/github confusion, we are currently in a transition > phase. Our repository is now hosted on github, but the official website and > trackers are still sourceforge. Sorry for any confusion there. The > (un)official new website will be http://matplotlib.github.com. With particular emphasis on UNofficial. I put that site up to make the git/github developer docs available right away, and to investigate whether we might want to host the homepage at github. There has been no discussion of switching, let alone a decision to do so. -- Free Software Download: 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. http://p.sf.net/sfu/splunk-dev2dev ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Problems with new PyQt4 API
On Thu, Mar 3, 2011 at 3:15 AM, Martin Teichmann wrote: > Hi Benjamin, Hi List, > > sorry for the backwards patch, here the forward one: > > > --- backend_qt4_orig.py 2011-03-02 16:16:38.257797767 +0100 > +++ backend_qt4.py 2011-03-02 16:17:19.526831397 +0100 > @@ -395,8 +395,9 @@ > filters.append(filter) > filters = ';;'.join(filters) > > -fname = QtGui.QFileDialog.getSaveFileName( > -self, "Choose a filename to save to", start, filters, > selectedFilter) > +fname, _ = QtGui.QFileDialog.getSaveFileNameAndFilter( > +self, "Choose a filename to save to", start, filters, > +selectedFilter) > if fname: > try: > self.canvas.print_figure( unicode(fname) ) > > > > It is done against a rather old version of matplotlib (the 0.99.3, the > newest in kubuntu...) but the code hasn't changed since then, > acording to github, so only the line numbers are wrong. > > The second patch I sent is now obsolete, as you hinted to the > patch on github. I had followed the link on the matplotlib > web site (http://matplotlib.sourceforge.net/) which links still to > some subversion repository once you click onto "source code" > Could please someone update that link to github? Or is there > a new matplotlib website as well (google didn't find one). > > Greetings > > Martin > > -- > Max-Born-Institut > Max-Born-Straße 2a > 12489 Berlin > +49 30 6392 1234 > Martin, Just for completeness, I wanted to include a link to some sort of reference indicating a need to change the function. I can not find any documentation that says that we need to change from getSaveFileName() to getSaveFileNameAndFilter(). Can you please provide a source explaining the need for this change? Thanks, Ben Root -- Free Software Download: 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. http://p.sf.net/sfu/splunk-dev2dev ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
[matplotlib-devel] Bug in Draggable Legend
Hi all, I found a small bug in the Draggable Legend feature when you single-click on a legend, but don't drag it. It raises a TypeError. Here's code to reproduce. Try dragging the legend, then single-click the legend. #!/usr/bin/env python import matplotlib as mpl import pylab fig = pylab.figure() ax = fig.add_subplot(111) ax.plot(range(10), range(10), c='r', marker='^', picker=5, label='Ramp') legn = ax.legend() legn.draggable() pylab.show() Here's the stacktrace when I single-click: Exception in Tkinter callback Traceback (most recent call last): File "C:\Python26\lib\lib-tk\Tkinter.py", line 1410, in __call__ return self.func(*args) File "C:\Python26\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 312, in button_release_event FigureCanvasBase.button_release_event(self, x, y, num, guiEvent=event) File "C:\Python26\lib\site-packages\matplotlib\backend_bases.py", line 1561, in button_release_event self.callbacks.process(s, event) File "C:\Python26\lib\site-packages\matplotlib\cbook.py", line 262, in process proxy(*args, **kwargs) File "C:\Python26\lib\site-packages\matplotlib\cbook.py", line 188, in __call__ return mtd(*args, **kwargs) File "C:\Python26\lib\site-packages\matplotlib\offsetbox.py", line 1466, in on_release self.finalize_offset() File "C:\Python26\lib\site-packages\matplotlib\legend.py", line 51, in finalize_offset loc_in_canvas = self.get_loc_in_canvas() File "C:\Python26\lib\site-packages\matplotlib\offsetbox.py", line 1512, in get_loc_in_canvas ox, oy = offsetbox._offset TypeError: 'instancemethod' object is not iterable Jim -- Free Software Download: 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. http://p.sf.net/sfu/splunk-dev2dev ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Bug in Draggable Legend
I just committed a change that I believe that fixes this problem. https://github.com/matplotlib/matplotlib/commit/be420a34031c9c50813bc5be5f01a3cfb49639a1 Regards, -JJ On Fri, Mar 4, 2011 at 12:58 AM, James Kitchen wrote: > Hi all, > > I found a small bug in the Draggable Legend feature when you single-click on a > legend, but don't drag it. It raises a TypeError. > > Here's code to reproduce. Try dragging the legend, then single-click the > legend. > > #!/usr/bin/env python > import matplotlib as mpl > import pylab > > fig = pylab.figure() > ax = fig.add_subplot(111) > ax.plot(range(10), range(10), c='r', marker='^', picker=5, label='Ramp') > legn = ax.legend() > legn.draggable() > pylab.show() > > > Here's the stacktrace when I single-click: > > Exception in Tkinter callback > Traceback (most recent call last): > File "C:\Python26\lib\lib-tk\Tkinter.py", line 1410, in __call__ > return self.func(*args) > File "C:\Python26\lib\site-packages\matplotlib\backends\backend_tkagg.py", > line 312, in button_release_event > FigureCanvasBase.button_release_event(self, x, y, num, guiEvent=event) > File "C:\Python26\lib\site-packages\matplotlib\backend_bases.py", line 1561, > in button_release_event > self.callbacks.process(s, event) > File "C:\Python26\lib\site-packages\matplotlib\cbook.py", line 262, in > process > proxy(*args, **kwargs) > File "C:\Python26\lib\site-packages\matplotlib\cbook.py", line 188, in > __call__ > return mtd(*args, **kwargs) > File "C:\Python26\lib\site-packages\matplotlib\offsetbox.py", line 1466, in > on_release > self.finalize_offset() > File "C:\Python26\lib\site-packages\matplotlib\legend.py", line 51, in > finalize_offset > loc_in_canvas = self.get_loc_in_canvas() > File "C:\Python26\lib\site-packages\matplotlib\offsetbox.py", line 1512, in > get_loc_in_canvas > ox, oy = offsetbox._offset > TypeError: 'instancemethod' object is not iterable > > Jim > > > > > > -- > Free Software Download: 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. http://p.sf.net/sfu/splunk-dev2dev > ___ > Matplotlib-devel mailing list > Matplotlib-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > -- Free Software Download: 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. http://p.sf.net/sfu/splunk-dev2dev ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Bug in Draggable Legend
On Thu, Mar 3, 2011 at 10:30 AM, Jae-Joon Lee wrote: > I just committed a change that I believe that fixes this problem. > > > https://github.com/matplotlib/matplotlib/commit/be420a34031c9c50813bc5be5f01a3cfb49639a1 > > Regards, > > -JJ > > Confirmed that it fixes the problem for me on the GTKAgg backend as well. Ben Root -- Free Software Download: 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. http://p.sf.net/sfu/splunk-dev2dev ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Bug in Draggable Legend
Looks like that fixed it. Thanks! Jim From: Benjamin Root To: Jae-Joon Lee Cc: James Kitchen ; matplotlib-devel@lists.sourceforge.net Sent: Thu, March 3, 2011 11:40:32 AM Subject: Re: [matplotlib-devel] Bug in Draggable Legend On Thu, Mar 3, 2011 at 10:30 AM, Jae-Joon Lee wrote: I just committed a change that I believe that fixes this problem. > >https://github.com/matplotlib/matplotlib/commit/be420a34031c9c50813bc5be5f01a3cfb49639a1 > > >Regards, > >-JJ > > > Confirmed that it fixes the problem for me on the GTKAgg backend as well. Ben Root -- Free Software Download: 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. http://p.sf.net/sfu/splunk-dev2dev ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
[matplotlib-devel] patch to add legend.frameon to rcParams
I noticed that this didn't exist and I never seem to want a frame anyway so here's a patch. I wasn't sure if anything in doc/ needed to be changed... I don't really like the name "legend.frameon". I'd rather have "legend.frame" or "legend.useframe". If people would accept changing the name of the keyword, then this patch probably shouldn't be committed. M diff --git a/lib/matplotlib/axes.py b/lib/matplotlib/axes.py index f47eaa4..a14421f 100644 --- a/lib/matplotlib/axes.py +++ b/lib/matplotlib/axes.py @@ -4318,7 +4318,7 @@ class Axes(martist.Artist): settings. *frameon*: [ True | False ] -if True, draw a frame. Default is True +if True, draw a frame around the legend. *fancybox*: [ None | False | True ] if True, draw a frame with a round fancybox. If None, use rc diff --git a/lib/matplotlib/legend.py b/lib/matplotlib/legend.py index 9a838fd..33425b4 100644 --- a/lib/matplotlib/legend.py +++ b/lib/matplotlib/legend.py @@ -166,7 +166,7 @@ class Legend(Artist): title = None, # set a title for the legend bbox_to_anchor = None, # bbox that the legend will be anchored. bbox_transform = None, # transform for the bbox - frameon = True, # draw frame + frameon = None, # draw frame ): """ - *parent* : the artist that contains the legend @@ -184,7 +184,7 @@ class Legend(Artist): numpoints the number of points in the legend for line scatterpoints the number of points in the legend for scatter plot scatteryoffsetsa list of yoffsets for scatter symbols in legend -frameonif True, draw a frame (default is True) +frameonif True, draw a frame around the legend fancybox if True, draw a frame with a round fancybox. If None, use rc shadow if True, draw a shadow behind legend ncol number of columns @@ -359,7 +359,8 @@ in the normalized axes coordinate. self._set_artist_props(self.legendPatch) -self._drawFrame = frameon +if frameon is None: +self._drawFrame = rcParams["legend.frameon"] # init with null renderer self._init_legend_box(handles, labels) diff --git a/lib/matplotlib/rcsetup.py b/lib/matplotlib/rcsetup.py index f3198d8..91579a3 100644 --- a/lib/matplotlib/rcsetup.py +++ b/lib/matplotlib/rcsetup.py @@ -458,6 +458,7 @@ defaultParams = { 'legend.fontsize': ['large', validate_fontsize], 'legend.markerscale' : [1.0, validate_float], # the relative size of legend markers vs. original 'legend.shadow': [False, validate_bool], +'legend.frameon' : [True, validate_bool], # whether or not to draw a frame around legend # the following dimensions are in fraction of the font size diff --git a/matplotlibrc.template b/matplotlibrc.template index 67933f9..7a888b9 100644 --- a/matplotlibrc.template +++ b/matplotlibrc.template @@ -249,6 +249,7 @@ backend : %(backend)s #legend.handletextsep : 0.02 # the space between the legend line and legend text #legend.axespad : 0.02 # the border between the axes and legend edge #legend.shadow: False +#legend.frameon : True # whether or not to draw a frame around legend ### FIGURE # See http://matplotlib.sourceforge.net/api/figure_api.html#matplotlib.figure.Figure -- What You Don't Know About Data Connectivity CAN Hurt You This paper provides an overview of data connectivity, details its effect on application quality, and explores various alternative solutions. http://p.sf.net/sfu/progress-d2d___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Problems with new PyQt4 API
On Thu, Mar 3, 2011 at 10:22 AM, Benjamin Root wrote: > Just for completeness, I wanted to include a link to some sort of reference > indicating a need to change the function. I can not find any documentation > that says that we need to change from getSaveFileName() to > getSaveFileNameAndFilter(). Can you please provide a source explaining the > need for this change? Try here: http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/python_v3.html#qfiledialog -- What You Don't Know About Data Connectivity CAN Hurt You This paper provides an overview of data connectivity, details its effect on application quality, and explores various alternative solutions. http://p.sf.net/sfu/progress-d2d ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Problems with new PyQt4 API
On Thursday, March 3, 2011, Darren Dale wrote: > On Thu, Mar 3, 2011 at 10:22 AM, Benjamin Root wrote: >> Just for completeness, I wanted to include a link to some sort of reference >> indicating a need to change the function. I can not find any documentation >> that says that we need to change from getSaveFileName() to >> getSaveFileNameAndFilter(). Can you please provide a source explaining the >> need for this change? > > Try here: > http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/python_v3.html#qfiledialog > Exactly. That's all I found too. Nothing indicates that we need to change anything. We are throwing away the second part of the tuple which has the returned filter. The only reason I see for the new function is so the coder can get back the filter string, which we don't seem to use. Am I missing something? Ben Root -- What You Don't Know About Data Connectivity CAN Hurt You This paper provides an overview of data connectivity, details its effect on application quality, and explores various alternative solutions. http://p.sf.net/sfu/progress-d2d ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel