|
29 | 29 | ax = fig.add_axes([0.1,0.1,0.7,0.7])
|
30 | 30 | # plot image over map.
|
31 | 31 | im = m.imshow(topoin,plt.cm.jet)
|
32 |
| -# get axes position, add colorbar axes to right of this. |
33 |
| -pos = ax.get_position() |
34 |
| -l, b, w, h = pos.bounds |
35 |
| -cax = plt.axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes. |
36 |
| -plt.colorbar(cax=cax) # draw colorbar |
37 |
| -plt.axes(ax) # make the original axes current again |
| 32 | +m.colorbar() # draw colorbar |
38 | 33 | m.drawcoastlines()
|
39 | 34 | #m.drawcountries()
|
40 | 35 | #m.drawstates()
|
|
128 | 123 | topodat = m.transform_scalar(topoin,lons,lats,nx,ny)
|
129 | 124 | # plot image over map.
|
130 | 125 | im = m.imshow(topodat,plt.cm.jet)
|
131 |
| -# get current axis instance. |
132 |
| -ax = plt.gca() |
133 |
| -pos = ax.get_position() |
134 |
| -l, b, w, h = pos.bounds |
135 |
| -cax = plt.axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes. |
136 |
| -plt.colorbar(cax=cax) # draw colorbar |
137 |
| -plt.axes(ax) # make the original axes current again |
| 126 | +m.colorbar() # draw colorbar |
138 | 127 | m.drawcoastlines()
|
139 | 128 | # draw parallels
|
140 | 129 | delat = 2.
|
|
160 | 149 | topodat = m.transform_scalar(topoin,lons,lats,nx,ny)
|
161 | 150 | # plot image over map.
|
162 | 151 | im = m.imshow(topodat,plt.cm.jet)
|
163 |
| -# get current axis instance. |
164 |
| -ax = plt.gca() |
165 |
| -pos = ax.get_position() |
166 |
| -l, b, w, h = pos.bounds |
167 |
| -cax = plt.axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes. |
168 |
| -plt.colorbar(cax=cax) # draw colorbar |
169 |
| -plt.axes(ax) # make the original axes current again |
| 152 | +m.colorbar() # draw colorbar |
170 | 153 | m.drawcoastlines()
|
171 | 154 | m.drawcountries()
|
172 | 155 | # draw parallels
|
|
193 | 176 | topodat = m.transform_scalar(topoin,lons,lats,nx,ny)
|
194 | 177 | # plot image over map.
|
195 | 178 | im = m.imshow(topodat,plt.cm.jet)
|
196 |
| -# get current axis instance. |
197 |
| -ax = plt.gca() |
198 |
| -pos = ax.get_position() |
199 |
| -l, b, w, h = pos.bounds |
200 |
| -cax = plt.axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes. |
201 |
| -plt.colorbar(cax=cax) # draw colorbar |
202 |
| -plt.axes(ax) # make the original axes current again |
| 179 | +m.colorbar() # draw colorbar |
203 | 180 | m.drawcoastlines()
|
204 | 181 | # draw parallels
|
205 | 182 | delat = 20.
|
|
224 | 201 | topodat = m.transform_scalar(topoin,lons,lats,nx,ny)
|
225 | 202 | # plot image over map.
|
226 | 203 | im = m.imshow(topodat,plt.cm.jet)
|
227 |
| -# get current axis instance. |
228 |
| -ax = plt.gca() |
229 |
| -pos = ax.get_position() |
230 |
| -l, b, w, h = pos.bounds |
231 |
| -cax = plt.axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes. |
232 |
| -plt.colorbar(cax=cax) # draw colorbar |
233 |
| -plt.axes(ax) # make the original axes current again |
| 204 | +m.colorbar() # draw colorbar |
234 | 205 | m.drawcoastlines()
|
235 | 206 | m.drawcountries()
|
236 | 207 | m.drawstates()
|
|
254 | 225 | topodat = m.transform_scalar(topoin,lons,lats,nx,ny)
|
255 | 226 | # plot image over map.
|
256 | 227 | im = m.imshow(topodat,plt.cm.jet)
|
257 |
| -# get current axis instance. |
258 |
| -ax = plt.gca() |
259 |
| -pos = ax.get_position() |
260 |
| -l, b, w, h = pos.bounds |
261 |
| -cax = plt.axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes. |
262 |
| -plt.colorbar(cax=cax) # draw colorbar |
263 |
| -plt.axes(ax) # make the original axes current again |
| 228 | +m.colorbar() # draw colorbar |
264 | 229 | m.drawcoastlines()
|
265 | 230 | m.drawcountries()
|
266 | 231 | # draw parallels
|
|
285 | 250 | nx = int((m.xmax-m.xmin)/40000.)+1; ny = int((m.ymax-m.ymin)/40000.)+1
|
286 | 251 | topodat = m.transform_scalar(topoin,lons,lats,nx,ny)
|
287 | 252 | ax = fig.add_axes([0.1,0.1,0.7,0.7])
|
288 |
| -# plot image over map. |
289 | 253 | im = m.imshow(topodat,plt.cm.jet)
|
290 |
| -pos = ax.get_position() |
291 |
| -l, b, w, h = pos.bounds |
292 |
| -cax = plt.axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes. |
293 |
| -plt.colorbar(cax=cax) # draw colorbar |
294 |
| -plt.axes(ax) # make the original axes current again |
| 254 | +m.colorbar() # draw colorbar |
295 | 255 | m.drawcoastlines()
|
296 | 256 | m.drawcountries()
|
297 | 257 | m.drawstates()
|
|
318 | 278 | nx = int((m.xmax-m.xmin)/40000.)+1; ny = int((m.ymax-m.ymin)/40000.)+1
|
319 | 279 | topodat = m.transform_scalar(topoin,lons,lats,nx,ny)
|
320 | 280 | ax = fig.add_axes([0.1,0.1,0.7,0.7])
|
321 |
| -# plot image over map. |
322 | 281 | im = m.imshow(topodat,plt.cm.jet)
|
323 |
| -pos = ax.get_position() |
324 |
| -l, b, w, h = pos.bounds |
325 |
| -cax = plt.axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes. |
326 |
| -plt.colorbar(cax=cax) # draw colorbar |
327 |
| -plt.axes(ax) # make the original axes current again |
| 282 | +m.colorbar(pad='10%') # draw colorbar |
328 | 283 | m.drawcoastlines()
|
329 | 284 | m.drawcountries()
|
330 | 285 | m.drawstates()
|
|
355 | 310 | # plot image over map.
|
356 | 311 | im = m.imshow(topodat,plt.cm.jet)
|
357 | 312 | im.set_clim(-4000.,3000.) # adjust range of colors.
|
358 |
| -pos = ax.get_position() |
359 |
| -l, b, w, h = pos.bounds |
360 |
| -cax = plt.axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes. |
361 |
| -plt.colorbar(cax=cax) # draw colorbar |
362 |
| -plt.axes(ax) # make the original axes current again |
| 313 | +m.colorbar(pad='10%') # draw colorbar |
363 | 314 | m.drawcoastlines()
|
364 | 315 | m.drawcountries()
|
365 | 316 | # draw parallels
|
|
390 | 341 | ax = fig.add_axes([0.1,0.1,0.7,0.7])
|
391 | 342 | # plot image over map.
|
392 | 343 | im = m.imshow(topodat,plt.cm.jet)
|
393 |
| -pos = ax.get_position() |
394 |
| -l, b, w, h = pos.bounds |
395 |
| -cax = plt.axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes. |
396 |
| -plt.colorbar(cax=cax) # draw colorbar |
397 |
| -plt.axes(ax) # make the original axes current again |
| 344 | +m.colorbar(pad='12%') # draw colorbar |
398 | 345 | m.drawcoastlines()
|
399 | 346 | m.drawcountries()
|
400 | 347 | #m.fillcontinents()
|
|
421 | 368 | ax = fig.add_axes([0.1,0.1,0.7,0.7])
|
422 | 369 | # plot image over map.
|
423 | 370 | im = m.imshow(topodat,plt.cm.jet)
|
424 |
| -pos = ax.get_position() |
425 |
| -l, b, w, h = pos.bounds |
426 |
| -cax = plt.axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes. |
427 |
| -plt.colorbar(cax=cax) # draw colorbar |
428 |
| -plt.axes(ax) # make the original axes current again |
| 371 | +m.colorbar(pad='12%') # draw colorbar |
429 | 372 | m.drawcoastlines()
|
430 | 373 | m.drawcountries()
|
431 | 374 | m.drawstates()
|
|
453 | 396 | ax = fig.add_axes([0.1,0.1,0.7,0.7])
|
454 | 397 | # plot image over map.
|
455 | 398 | im = m.imshow(topodat,plt.cm.jet)
|
456 |
| -pos = ax.get_position() |
457 |
| -l, b, w, h = pos.bounds |
458 |
| -cax = plt.axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes. |
459 |
| -plt.colorbar(cax=cax) # draw colorbar |
460 |
| -plt.axes(ax) # make the original axes current again |
| 399 | +m.colorbar(pad='12%') # draw colorbar |
461 | 400 | m.drawcoastlines()
|
462 | 401 | m.drawcountries()
|
463 | 402 | m.drawstates()
|
|
494 | 433 | # and values outside projection limb would be handled transparently
|
495 | 434 | # - see contour_demo.py)
|
496 | 435 | im = m.imshow(topo,palette,norm=colors.normalize(clip=False))
|
497 |
| -pos = ax.get_position() |
498 |
| -l, b, w, h = pos.bounds |
499 |
| -cax = plt.axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes. |
500 |
| -plt.colorbar(cax=cax) # draw colorbar |
501 |
| -plt.axes(ax) # make the original axes current again |
| 436 | +m.colorbar() # draw colorbar |
502 | 437 | # draw coastlines and political boundaries.
|
503 | 438 | m.drawcoastlines()
|
504 | 439 | # draw parallels and meridians (labelling is
|
|
535 | 470 | # and values outside projection limb would be handled transparently
|
536 | 471 | # - see contour_demo.py)
|
537 | 472 | im = m.imshow(topo,palette,norm=colors.normalize(clip=False))
|
538 |
| -pos = ax.get_position() |
539 |
| -l, b, w, h = pos.bounds |
540 |
| -cax = plt.axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes. |
541 |
| -plt.colorbar(cax=cax) # draw colorbar |
542 |
| -plt.axes(ax) # make the original axes current again |
| 473 | +m.colorbar() # draw colorbar |
543 | 474 | # draw coastlines and political boundaries.
|
544 | 475 | m.drawcoastlines()
|
545 | 476 | # draw parallels and meridians (labelling is
|
|
563 | 494 | # plot image over map with pcolormesh.
|
564 | 495 | x,y = m(*np.meshgrid(lonsin,latsin))
|
565 | 496 | p = m.pcolormesh(x,y,topodatin,shading='flat')
|
566 |
| -pos = ax.get_position() |
567 |
| -l, b, w, h = pos.bounds |
568 |
| -cax = plt.axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes. |
569 |
| -plt.colorbar(cax=cax) # draw colorbar |
570 |
| -plt.axes(ax) # make the original axes current again |
| 497 | +m.colorbar(location='bottom') # draw colorbar |
571 | 498 | # draw coastlines and political boundaries.
|
572 | 499 | m.drawcoastlines()
|
573 | 500 | # draw parallels and meridians
|
|
590 | 517 | # plot image over map with pcolormesh.
|
591 | 518 | x,y = m(*np.meshgrid(lonsin,latsin))
|
592 | 519 | p = m.pcolormesh(x,y,topodatin,shading='flat')
|
593 |
| -pos = ax.get_position() |
594 |
| -l, b, w, h = pos.bounds |
595 |
| -cax = plt.axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes. |
596 |
| -plt.colorbar(cax=cax) # draw colorbar |
597 |
| -plt.axes(ax) # make the original axes current again |
| 520 | +m.colorbar(location='bottom') # draw colorbar |
598 | 521 | # draw coastlines and political boundaries.
|
599 | 522 | m.drawcoastlines()
|
600 | 523 | # draw parallels and meridians
|
|
617 | 540 | # plot image over map with pcolormesh.
|
618 | 541 | x,y = m(*np.meshgrid(lonsin,latsin))
|
619 | 542 | p = m.pcolormesh(x,y,topodatin,shading='flat')
|
620 |
| -pos = ax.get_position() |
621 |
| -l, b, w, h = pos.bounds |
622 |
| -cax = plt.axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes. |
623 |
| -plt.colorbar(cax=cax) # draw colorbar |
624 |
| -plt.axes(ax) # make the original axes current again |
| 543 | +m.colorbar(location='bottom') # draw colorbar |
625 | 544 | # draw coastlines and political boundaries.
|
626 | 545 | m.drawcoastlines()
|
627 | 546 | # draw parallels and meridians
|
|
644 | 563 | # plot image over map with pcolormesh.
|
645 | 564 | x,y = m(*np.meshgrid(lonsin,latsin))
|
646 | 565 | p = m.pcolormesh(x,y,topodatin,shading='flat')
|
647 |
| -pos = ax.get_position() |
648 |
| -l, b, w, h = pos.bounds |
649 |
| -cax = plt.axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes. |
650 |
| -plt.colorbar(cax=cax) # draw colorbar |
651 |
| -plt.axes(ax) # make the original axes current again |
| 566 | +m.colorbar(location='bottom') # draw colorbar |
652 | 567 | # draw coastlines and political boundaries.
|
653 | 568 | m.drawcoastlines()
|
654 | 569 | # draw parallels and meridians
|
|
671 | 586 | # plot image over map with pcolormesh.
|
672 | 587 | x,y = m(*np.meshgrid(lonsin,latsin))
|
673 | 588 | p = m.pcolormesh(x,y,topodatin,shading='flat')
|
674 |
| -pos = ax.get_position() |
675 |
| -l, b, w, h = pos.bounds |
676 |
| -cax = plt.axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes. |
677 |
| -plt.colorbar(cax=cax) # draw colorbar |
678 |
| -plt.axes(ax) # make the original axes current again |
| 589 | +m.colorbar(location='bottom') # draw colorbar |
679 | 590 | # draw coastlines and political boundaries.
|
680 | 591 | m.drawcoastlines()
|
681 | 592 | # draw parallels and meridians
|
|
697 | 608 | # plot image over map with pcolormesh.
|
698 | 609 | x,y = m(*np.meshgrid(lonsin,latsin))
|
699 | 610 | p = m.pcolormesh(x,y,topodatin,shading='flat')
|
700 |
| -pos = ax.get_position() |
701 |
| -l, b, w, h = pos.bounds |
702 |
| -cax = plt.axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes. |
703 |
| -plt.colorbar(cax=cax) # draw colorbar |
704 |
| -plt.axes(ax) # make the original axes current again |
| 611 | +m.colorbar() # draw colorbar |
705 | 612 | # draw coastlines and political boundaries.
|
706 | 613 | m.drawcoastlines()
|
707 | 614 | # draw parallels and meridians
|
|
0 commit comments