#!/usr/bin/env python

from mpl_toolkits.basemap import Basemap, cm

import matplotlib.pyplot as plt

import matplotlib as mpl

import numpy as np

data = np.loadtxt("gridded_data.txt")

m = Basemap(projection='cyl',llcrnrlat=-90,urcrnrlat=90,\
            llcrnrlon=-180,urcrnrlon=180,resolution='c')

m.drawcoastlines()

m.drawlsmask(land_color='white',ocean_color='white',lakes=True)

m.drawparallels([-90,-60,-30,0,30,60,90],labels=[1,0,0,0],fontsize=10)

m.drawmeridians([-180,-120,-60,0,60,120,180],labels=[0,0,0,1],fontsize=10)

m.drawmapboundary(fill_color='aqua')

img = m.imshow(data, interpolation='none', cmap='jet' )

m.colorbar(img)

plt.title('Plot gridded data on a map')

plt.savefig('gridded_data_global_map.png', pad_inches=0.5, bbox_inches='tight')

plt.show()

About / Au sujet de

Ben
Created:
15 juin 2016 22:20:42

Updated:
15 juin 2016 22:20:42

License / Licence

MIT License

Abstract / Résumé