1

I'm creating a map with basemap and would like to put a graph in the same figure. Until now I did this:

m = Basemap(projection='merc',llcrnrlat=-32.5,urcrnrlat=-10,llcrnrlon=-57.5,urcrnrlon=-40,lat_ts=20,resolution='c')
x, y = m(lon, lat) # compute map proj coordinates.
parallels = np.arange(-50.,20,5.)
meridians = np.arange(-90.,0.,5.)
m.drawparallels(parallels,labels=[1,0,0,0],fontsize=10)
m.drawmeridians(meridians,labels=[0,0,0,1],fontsize=10)
m.scatter(x,y,s=abs(100.*np.array(correlacoes[i])),c=correlacoes[i],norm=mc.Normalize(vmin=-1.0,vmax=1.0))
m.drawcoastlines()
m.colorbar()
pyl.title(nomvar + ' cp ' + str(i+1) + '   v.e. %5.2f' % varexp[i])
pyl.savefig(dir_pro+projeto+arquivo + '_cp%3.3i' % (i+1) + '.png')   
pyl.clf()    
pyl.plot(indicesfs,fs[i])
pyl.title(nomvar + ' cp ' + str(i+1) + '   v.e. %5.2f' % varexp[i])
pyl.savefig(dir_pro+projeto+arquivo + '_fs%3.3i' % (i+1) + '.png')   
pyl.clf()

But in this way I have two figures, and I would like to put both (graph and map) in the same figure Is there any way to adjust the map and graph position and obtain this? Thanks!

2 Answers 2

1

I might be misunderstanding your question but you can use subplot() in matplotlib to produce multiple plots on the same figure.

Sign up to request clarification or add additional context in comments.

Comments

0

Did you try using m.plot() instead of pyl.plot()? (and no clf() in between)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.