axes_grid1.inset_axes frame background color

Hello,

I'm trying to modify the following script to no avail:
http://matplotlib.github.com/examples/axes_grid/demo_colorbar_with_inset_locator.html

I'd like to have a white background behind the inset colorbar that adjusts automatically to figure resizing. I'm thinking of doing this by adding a Rectangle patch with the appropriate axes coordinates. What's the easiest way get those coordinates (sufficiently big to include the ticklabels) & draw the patch?

Thanks,

···

--
---------------
Scott T. Henderson
http://www.geo.cornell.edu/eas/gstudent/sth54/contact.html

There is no easy way to do it (the extent of axes including the labels
is determined only when the plot is drawn).
And most straight forward way is to define your own artist.
Attached is an one example of such artist. I think it is good to have
such an artist class in matplotlib and I may able to push some
generalized version of this into matplotlib.

On the other hand, your reason to draw a white box is to improve the
visibility of tick labels, I recommend you to use path_effect.

from matplotlib.patheffects import withStroke
plt.setp(axins1.xaxis.get_majorticklabels(),
         path_effects=[withStroke(foreground="w", linewidth=3)])

IHTH,

-JJ

rrer.py (1.55 KB)

···

On Thu, Aug 16, 2012 at 12:39 AM, Scott Henderson <sth54@...163...> wrote:

Hello,

I'm trying to modify the following script to no avail:
http://matplotlib.github.com/examples/axes_grid/demo_colorbar_with_inset_locator.html

I'd like to have a white background behind the inset colorbar that
adjusts automatically to figure resizing. I'm thinking of doing this by
adding a Rectangle patch with the appropriate axes coordinates. What's
the easiest way get those coordinates (sufficiently big to include the
ticklabels) & draw the patch?

Thanks,

--
---------------
Scott T. Henderson
http://www.geo.cornell.edu/eas/gstudent/sth54/contact.html

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options