On Mon, Feb 15, 2010 at 12:25 PM, Nico Schlömer <nico.schloe...@gmail.com> wrote: > Well, it's related to the TikZ converter I'm writing. After having > created the plot, the script is of course totally oblivious to what > exact commands were used. > I was thinking that there is still some sort of bond between the color > bar and its parent plot after their creation, e.g., for when the color > map of the main plot is changed. -- Is that not the case?
I doubt it. 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. But I hope some other developers can confirm (or dispute) this. For this kind of work, you need to understand some of internals of matplotlib, and I recommend you to go through the matplotlib sources. Regards, -JJ > > --Nico > > > > On Mon, Feb 15, 2010 at 6:16 PM, Jae-Joon Lee <lee.j.j...@gmail.com> wrote: >> Is there any reason that you need to find out which axes is a color >> bar axes from the list of axes? Can you just keep references to >> colorbars you create? >> >> cbar = colorbar() >> cax = cbar.ax >> >> cax is the axes instance of the colobar you just created. >> >> Regards, >> >> -JJ >> >> >> On Mon, Feb 15, 2010 at 12:04 PM, Nico Schlömer >> <nico.schloe...@gmail.com> wrote: >>> Hi, >>> >>> when plotting a color bar with a plot in matplotlib, the color bar >>> gets treated internally as Axes. >>> >>> With two main plots, each of which comes with a color bar, one structurally >>> gets >>> >>> <class 'matplotlib.figure.Figure'> >>> <class 'matplotlib.axes.Axes'> >>> <class 'matplotlib.axes.Axes'> >>> <class 'matplotlib.axes.Axes'> >>> <class 'matplotlib.axes.Axes'> >>> >>> (that is, a Figure has for childres Axes). To find out which one of >>> those is a color bar, I basically inspect their children an look for >>> Arrays with shape (256,), which is what color bars look like. That's >>> ugly of course, but it kind of works(tm). :) >>> >>> I'm having problems, though, with associating color bars with the >>> specific plot. Can I rely on the rule that an Axes -- if it has a >>> color bar --, is immediately followed by the corresponding (color bar) >>> Axes environment? Are there any other properties I could check to >>> identify color bars? (Tried get_label to no avail.) >>> >>> Cheers, >>> 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 >>> http://p.sf.net/sfu/solaris-dev2dev >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Matplotlib-users@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >> > ------------------------------------------------------------------------------ SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users