On 19-Jun-08, at 11:30 AM, John Hunter wrote: > On Wed, Jun 18, 2008 at 2:42 PM, David Warde-Farley <[EMAIL PROTECTED] > > wrote: > >> One more related thing: is there any way to retrieve the size of a >> textbox >> in figure coordinates, something like >> ax.get_ymajorticklabels[0].get_width()? > > This is not very easy since the renderer is not known until the figure > is drawn. After the window is drawn and the text instance knows its > renderer, you can call t.get_window_extent(). So you would likely > want to connect to the "on_draw" method and get the window extent > there, and then do something with it, eg move the left of the canvas > over. Here is a recursive, iterative solution that will gradually > move the left of the subplot over until the label fits w/o going > outside the figure border (requires 0.98):: > > * snip *
Hi John, (apologies for sending twice, forgot to CC the list) Thanks again for the help. I was wondering about the code you posted -- what's the problem with say, using bbox.xmin to adjust left only once? Or else perhaps get_text_width_height from the renderer? Wouldn't that yield the desired effect without the iterative procedure, since you'd immediately know (roughly) how much to push the subplot over? Thanks, David ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users