Alright, so I dug the sources a bit and found the snippet

========================== *snip* ==========================
        cb = cbar.Colorbar(cax, mappable, **kw)

        def on_changed(m):
            #print 'calling on changed', m.get_cmap().name

        self.cbid = mappable.callbacksSM.connect('changed', on_changed)
        mappable.set_colorbar(cb, cax)
========================== *snap* ==========================

I guess what happens is that a Colorbar is created, and a callback
function registered which adapts this very color bar whenever there is
a change in color maps/limits.
Well. -- I reckon that means that at the moment there's no way to tell
if a ScalarMappable has a color bar associated or not. :/ -- At least
I don't see how it would be possible to dig up on_changed( ) from the
list of callbacks and extract cb from it.

Aaand everybody: "Fea-ture request, fea-ture request!"
get_colorbar() for ScalarMappables :)


On Mon, Feb 15, 2010 at 7:58 PM, Nico Schlömer <> wrote:
>> As far as I can see, it is the other way around, i.e., mappables
>> (e.g., images) know about the colorbar they are connected.
> Well yeah, that'd be even better. I'll check out the API. -- Hints
> would still be appreciated of course.
> --Nico

SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
Matplotlib-users mailing list

Reply via email to