On 1 July 2011 16:52, marz_cyclone <m...@meteo.uni-koeln.de> wrote:
> i'm trying to get the bounding box of a map plotted with basemap to place a
> colorbar. in this reduced example from the example directory of basemap, the
> colorbar is set to the hight of the axes of the plot.
>
...
>
> what i'm interested in is the bounding box of m, the real plotting area, so
> i can scale the colorbar axes to that height or width.

I don't have time to find the Basemap example data files and run your
example, but I normally do it like this (which works fine for me -
it's not clear what problem you're seeing?):

    # create new figure
    fig = plt.figure()
    ax = fig.add_axes(...)

    curr_map = Basemap(..., ax=ax, ...)

    im = curr_map.imshow(...)

    # setup colorbar axes and draw colorbar
    bbox = ax.get_position()
    l,b,w,h = bbox.bounds
    cax = fig.add_axes([l+w+0.05, b, 0.05, h],frameon=False)
    fig.colorbar(im, cax=cax)

Maybe using the pyplot functions to add the colorbar axes and plot the
colorbar is causing some side-effects you don't expect?

Cheers,
Scott

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to