matplotlib subplot2grid and projection

Hi Everyone,

I am working on a weather conditions plot containing wind speed and
direction. For that I use a custom polar projection. Now updated from
Matplotlib 0.99 to 1.0 to use the subplot2grid feature.

Now, after trying and searching for hours, I seem to be too dumb to combine
my custom projection and subplot2grid. Before it did this way:

ax1=plt.figure().add_subplot(111, projection='northpolar')

But now I need sth like:

ax2 = plt.subplot2grid((5,5), (2,3), colspan=2, rowspan=3)

subplot2grid doesn't like a projection keyword.
How can I implement my projection?

Thanks!
BB

···

--
View this message in context: http://old.nabble.com/matplotlib-subplot2grid-and-projection-tp29268717p29268717.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Thanks for reporting.
This is now fixed in r8581(maint branch) and r8582(trunk).
Meanwhile, you may define your own subplot2grid function and use it instead.

from matplotlib.gridspec import GridSpec
from matplotlib.pyplot import gcf, draw_if_interactive, delaxes

def mysubplot2grid(shape, loc, rowspan=1, colspan=1, **kwargs):

    fig = gcf()
    s1, s2 = shape
    subplotspec = GridSpec(s1, s2).new_subplotspec(loc,
                                                   rowspan=rowspan,
                                                   colspan=colspan)
    a = fig.add_subplot(subplotspec, **kwargs)
    bbox = a.bbox
    byebye =
    for other in fig.axes:
        if other==a: continue
        if bbox.fully_overlaps(other.bbox):
            byebye.append(other)
    for ax in byebye: delaxes(ax)

    draw_if_interactive()
    return a

You can use this function as

ax = mysubplot2grid((3,3), (0,0), colspan=2, rowspan=2, projection="polar")

Regards,

-JJ

···

On Tue, Jul 27, 2010 at 2:06 AM, bbarton <bastian.barton@...380...> wrote:

Hi Everyone,

I am working on a weather conditions plot containing wind speed and
direction. For that I use a custom polar projection. Now updated from
Matplotlib 0.99 to 1.0 to use the subplot2grid feature.

Now, after trying and searching for hours, I seem to be too dumb to combine
my custom projection and subplot2grid. Before it did this way:

ax1=plt.figure().add_subplot(111, projection='northpolar')

But now I need sth like:

ax2 = plt.subplot2grid((5,5), (2,3), colspan=2, rowspan=3)

subplot2grid doesn't like a projection keyword.
How can I implement my projection?

Thanks!
BB

--
View this message in context: http://old.nabble.com/matplotlib-subplot2grid-and-projection-tp29268717p29268717.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options