Basemap AxesGrid

is there a way for using Basemap with AxisGrid?

did someone try something like:

grid = AxisGrid()
for i in range(4):
    grid[i].scatter(with underlying Basemap)

?

thank you and best regards, yoshi

is there a way for using Basemap with AxisGrid?

did someone try something like:

grid = AxisGrid()
for i in range(4):
    grid[i].scatter(with underlying Basemap)

the common thing is probably something like:

fig = pl.figure()
for i in range(4):
    fig.add_subplot(2,2,i)
    bm = Basemap()
    x, y = bm(lon, lat)
    pl.scatter(x, y, ..., vmin=globalmin, vmax=globalmax)

that works nice, but how do i plot a global colorbar then?

i think this is a common thing, i want to compare one
map with different scatter plots on it ...

someone did something like that before?

thank you and best regards, yoshi

Why not something like this:

fig = plt.figure()
grid = AxesGrid(…)
bm = Basemap(…)
for ax in grid :
x, y = bm(lon, lat)
ax.scatter(x, y, vmin=globalmin, vmax=globalmax)

I do variations of this all the time.

Ben Root

···

On Mon, Nov 7, 2011 at 1:40 PM, Yoshi Rokuko <yoshi@…3676…> wrote:

is there a way for using Basemap with AxisGrid?

did someone try something like:

grid = AxisGrid()

for i in range(4):

grid[i].scatter(with underlying Basemap)

the common thing is probably something like:

fig = pl.figure()

for i in range(4):

fig.add_subplot(2,2,i)

bm = Basemap()

x, y = bm(lon, lat)

pl.scatter(x, y, ..., vmin=globalmin, vmax=globalmax)

that works nice, but how do i plot a global colorbar then?

+-------------------------- Benjamin Root -----------+

Why not something like this:

fig = plt.figure()
grid = AxesGrid(...)
bm = Basemap(...)
for ax in grid :
    x, y = bm(lon, lat)
    ax.scatter(x, y, vmin=globalmin, vmax=globalmax)

I do variations of this all the time.

Thanks for the tip, this is not going to work because
Basemap() draws a map onto i want to plot, however you
pointed me in the right direction - Basemap() has an
ax=... option:

fig = plt.figure()
grid = AxesGrid(...)
for ax in grid:
    bm = Basemap(..., ax=ax)
    bm.draw...
    x, y = bm(lon, lat)
    im = ax.scatter(x, y, vmin=...)

grid.cbar_axes[0].colorbar(im)

this works in principle, but however i can't increase
the size of the grid.

even if i try something like:

fig = plt.figure(1, (15,18))
fig.subplots_adjust(left=0.01, bottom=0.01,
                    right=0.99, top=0.99)
grid = AxesGrid(fig, 132,
                nrows_ncols = (2, 2),
                axes_pad = 0.1,
                cbar_location = "top",
                cbar_mode="single",
               )
i get a small grid in the center with lots of white
space around.

someone knows about that?

Best regards, yoshi

+----------------------------- Yoshi Rokuko -----------+

this works in principle, but however i can't increase
the size of the grid.

even if i try something like:

fig = plt.figure(1, (15,18))
fig.subplots_adjust(left=0.01, bottom=0.01,
                    right=0.99, top=0.99)
grid = AxesGrid(fig, 132,
                nrows_ncols = (2, 2),
                axes_pad = 0.1,
                cbar_location = "top",
                cbar_mode="single",
               )
i get a small grid in the center with lots of white
space around.

here is an example of what i mean:
http://rokuko.net/to-small.png

best regards, yoshi

PS
done with:

fig = plt.figure(1, (15,25))
fig.subplots_adjust(left=0.1, bottom=0.1,
                    right=.9, top=.9)
grid = AxesGrid(fig, 132,
                nrows_ncols = (3, 2),
                axes_pad = 0.1,
                cbar_location = "top",
                cbar_mode="single",
               )
for ax in grid:
    <...>
grid.cbar_axes[0].colorbar(im)
plt.savefig('to-small.png')

grid = AxesGrid(fig, 132,
                nrows_ncols = (3, 2),
                axes_pad = 0.1,
                cbar_location = "top",
                cbar_mode="single",
               )

solved by using:

grid = AxesGrid(fig, 111,
                ...)

best regards, yoshi