From: Benjamin R. <ben...@ou...> - 2013-03-24 22:14:59
|
So, for plot(), scatter() and other plotting functions, we can provide a label= kwarg so that a legend() can automatically populate the legend, making it extremely easy and convenient for making legends. But for image-based (scalar mappable) type plotting functions like imshow() and contourf(), the label kwarg doesn't do anything useful, but the colorbar() is sort of analogous to a legend(), but for scalar mappables. Does it make sense to others for the following to be equivalent: > plt.imshow(z) > cbar = plt.colorbar() > cbar.set_label('foobar') > plt.imshow(z, label='foobar') > plt.colorbar() I found that it is a small change to make this work, I just wanted to know if others think this makes sense before putting in the time to add documentation, modify examples and such. Cheers! Ben Root |
From: Eric F. <ef...@ha...> - 2013-03-25 07:03:57
|
On 2013/03/24 12:14 PM, Benjamin Root wrote: > So, for plot(), scatter() and other plotting functions, we can provide a > label= kwarg so that a legend() can automatically populate the legend, > making it extremely easy and convenient for making legends. But for > image-based (scalar mappable) type plotting functions like imshow() and > contourf(), the label kwarg doesn't do anything useful, but the > colorbar() is sort of analogous to a legend(), but for scalar mappables. > > Does it make sense to others for the following to be equivalent: > > > plt.imshow(z) > > cbar = plt.colorbar() > > cbar.set_label('foobar') > > > plt.imshow(z, label='foobar') > > plt.colorbar() > I understand your argument, but it feels a bit odd. To me it would be more natural for colorbar() itself to accept a label kwarg. I have no idea why I didn't do that long ago. The two ideas are not mutually exclusive. Eric > > I found that it is a small change to make this work, I just wanted to > know if others think this makes sense before putting in the time to add > documentation, modify examples and such. > > Cheers! > Ben Root > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_mar > > > > _______________________________________________ > Matplotlib-devel mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > |
From: Phil E. <pel...@gm...> - 2013-03-25 09:54:02
|
In general I like the idea, but I'm not sure what behaviour I would expect in this case: plt.imshow(z, label='foobar') plt.imshow(z, label='wibble') plt.colorbar() I suppose it is an analogous problem to: plt.imshow(z, cmap='hot') plt.imshow(z, cmap='jet') plt.colorbar() Which produces a colorbar for the [current scalar mappable]/gci. On that basis, I've just convinced myself that your proposal is a good idea, so +1 from me. On 25 March 2013 07:03, Eric Firing <ef...@ha...> wrote: > On 2013/03/24 12:14 PM, Benjamin Root wrote: > > So, for plot(), scatter() and other plotting functions, we can provide a > > label= kwarg so that a legend() can automatically populate the legend, > > making it extremely easy and convenient for making legends. But for > > image-based (scalar mappable) type plotting functions like imshow() and > > contourf(), the label kwarg doesn't do anything useful, but the > > colorbar() is sort of analogous to a legend(), but for scalar mappables. > > > > Does it make sense to others for the following to be equivalent: > > > > > plt.imshow(z) > > > cbar = plt.colorbar() > > > cbar.set_label('foobar') > > > > > plt.imshow(z, label='foobar') > > > plt.colorbar() > > > > I understand your argument, but it feels a bit odd. To me it would be > more natural for colorbar() itself to accept a label kwarg. I have no > idea why I didn't do that long ago. > > The two ideas are not mutually exclusive. > > Eric > > > > > I found that it is a small change to make this work, I just wanted to > > know if others think this makes sense before putting in the time to add > > documentation, modify examples and such. > > > > Cheers! > > Ben Root > > > > > > > ------------------------------------------------------------------------------ > > Everyone hates slow websites. So do we. > > Make your web apps faster with AppDynamics > > Download AppDynamics Lite for free today: > > http://p.sf.net/sfu/appdyn_d2d_mar > > > > > > > > _______________________________________________ > > Matplotlib-devel mailing list > > Mat...@li... > > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > > > > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_mar > _______________________________________________ > Matplotlib-devel mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > |
From: Benjamin R. <ben...@ou...> - 2013-03-25 13:07:15
|
On Mon, Mar 25, 2013 at 3:03 AM, Eric Firing <ef...@ha...> wrote: > On 2013/03/24 12:14 PM, Benjamin Root wrote: > > So, for plot(), scatter() and other plotting functions, we can provide a > > label= kwarg so that a legend() can automatically populate the legend, > > making it extremely easy and convenient for making legends. But for > > image-based (scalar mappable) type plotting functions like imshow() and > > contourf(), the label kwarg doesn't do anything useful, but the > > colorbar() is sort of analogous to a legend(), but for scalar mappables. > > > > Does it make sense to others for the following to be equivalent: > > > > > plt.imshow(z) > > > cbar = plt.colorbar() > > > cbar.set_label('foobar') > > > > > plt.imshow(z, label='foobar') > > > plt.colorbar() > > > > I understand your argument, but it feels a bit odd. To me it would be > more natural for colorbar() itself to accept a label kwarg. I have no > idea why I didn't do that long ago. > > The two ideas are not mutually exclusive. > > Eric > > Indeed, it isn't. The way to make this work is to allow ColorbarBase to accept a label kwarg. That's basically all that is needed. Most of the work would go into documentation and updating examples. Ben |
From: Damon M. <dam...@gm...> - 2013-03-25 16:08:18
|
On Mon, Mar 25, 2013 at 2:03 AM, Eric Firing <ef...@ha...> wrote: > On 2013/03/24 12:14 PM, Benjamin Root wrote: >> So, for plot(), scatter() and other plotting functions, we can provide a >> label= kwarg so that a legend() can automatically populate the legend, >> making it extremely easy and convenient for making legends. But for >> image-based (scalar mappable) type plotting functions like imshow() and >> contourf(), the label kwarg doesn't do anything useful, but the >> colorbar() is sort of analogous to a legend(), but for scalar mappables. >> >> Does it make sense to others for the following to be equivalent: >> >> > plt.imshow(z) >> > cbar = plt.colorbar() >> > cbar.set_label('foobar') >> >> > plt.imshow(z, label='foobar') >> > plt.colorbar() >> > > I understand your argument, but it feels a bit odd. To me it would be > more natural for colorbar() itself to accept a label kwarg. I have no > idea why I didn't do that long ago. > > The two ideas are not mutually exclusive. Yeah, I agree with Eric here; plt.colorbar(label='foo') feels more intuitive to me. > > Eric > >> >> I found that it is a small change to make this work, I just wanted to >> know if others think this makes sense before putting in the time to add >> documentation, modify examples and such. >> >> Cheers! >> Ben Root >> >> >> ------------------------------------------------------------------------------ >> Everyone hates slow websites. So do we. >> Make your web apps faster with AppDynamics >> Download AppDynamics Lite for free today: >> http://p.sf.net/sfu/appdyn_d2d_mar >> >> >> >> _______________________________________________ >> Matplotlib-devel mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel >> > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_mar > _______________________________________________ > Matplotlib-devel mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel -- Damon McDougall http://www.damon-is-a-geek.com Institute for Computational Engineering Sciences 201 E. 24th St. Stop C0200 The University of Texas at Austin Austin, TX 78712-1229 |