from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt # setup Lambert Conformal basemap. # set resolution=None to skip processing of boundary datasets. m = Basemap(width=12000000,height=9000000,projection='lcc', resolution=None,lat_1=10,lat_2=30,lat_0=22.6,lon_0=120.3) m.bluemarble() plt.show() # ============================================================================= # from mpl_toolkits.basemap import Basemap # import matplotlib.pyplot as plt # import numpy as np # # setup Lambert Conformal basemap. # m = Basemap(width=12000000,height=9000000,projection='lcc', # resolution='c',lat_1=45.,lat_2=55,lat_0=50,lon_0=-107.) # # draw coastlines. # m.drawcoastlines() # # draw a boundary around the map, fill the background. # # this background will end up being the ocean color, since # # the continents will be drawn on top. # m.drawmapboundary(fill_color='aqua') # # fill continents, set lake color same as ocean color. # m.fillcontinents(color='coral',lake_color='aqua') # # draw parallels and meridians. # # label parallels on right and top # # meridians on bottom and left # parallels = np.arange(0.,81,10.) # # labels = [left,right,top,bottom] # m.drawparallels(parallels,labels=[False,True,True,False]) # meridians = np.arange(10.,351.,20.) # m.drawmeridians(meridians,labels=[True,False,False,True]) # plt.show() # ============================================================================= # ============================================================================= # from mpl_toolkits.basemap import Basemap # import matplotlib.pyplot as plt # import numpy as np # # set up orthographic map projection with # # perspective of satellite looking down at 50N, 100W. # # use low resolution coastlines. # map = Basemap(projection='ortho',lat_0=45,lon_0=-100,resolution='l') # # draw coastlines, country boundaries, fill continents. # map.drawcoastlines(linewidth=0.25) # map.drawcountries(linewidth=0.25) # map.fillcontinents(color='coral',lake_color='aqua') # # draw the edge of the map projection region (the projection limb) # map.drawmapboundary(fill_color='aqua') # # draw lat/lon grid lines every 30 degrees. # map.drawmeridians(np.arange(0,360,30)) # map.drawparallels(np.arange(-90,90,30)) # # make up some data on a regular lat/lon grid. # nlats = 73; nlons = 145; delta = 2.*np.pi/(nlons-1) # lats = (0.5*np.pi-delta*np.indices((nlats,nlons))[0,:,:]) # lons = (delta*np.indices((nlats,nlons))[1,:,:]) # wave = 0.75*(np.sin(2.*lats)**8*np.cos(4.*lons)) # mean = 0.5*np.cos(2.*lats)*((np.sin(2.*lats))**2 + 2.) # # compute native map projection coordinates of lat/lon grid. # x, y = map(lons*180./np.pi, lats*180./np.pi) # # contour data over the map. # cs = map.contour(x,y,wave+mean,15,linewidths=1.5) # plt.title('contour lines over filled continent background') # plt.show() # ============================================================================= # ============================================================================= # from mpl_toolkits.basemap import Basemap # import matplotlib.pyplot as plt # # worldmap = Basemap(projection='ortho', lat_0=22.6, lon_0=120.3) # worldmap.drawmapboundary(fill_color="aqua") # worldmap.fillcontinents(color='#9af0e3', lake_color='blue') # worldmap.drawcoastlines() # # x, y = worldmap(120.3, 22.6) # x2, y2 = (50, 20) # # plt.annotate('KaoHsiung', xy = (x, y), xycoords='data', # xytext=(x2, y2), textcoords='offset points', color='r', # arrowprops=dict(arrowstyle="fancy", color='g')) # # x2, y2 = worldmap(100, 10) # plt.annotate('KaoHsiung', xy=(x,y), xycoords='data', # xytext=(x2, y2), textcoords='data', # arrowprops=dict(arrowstyle="->")) # # plt.show() # ============================================================================= # ============================================================================= # from mpl_toolkits.basemap import Basemap # import matplotlib.pyplot as plt # map = Basemap(llcrnrlon=3.75,llcrnrlat=39.75,urcrnrlon=4.35,urcrnrlat=40.15, epsg=5520) # #http://server.arcgisonline.com/arcgis/rest/services # map.arcgisimage(service='ESRI_Imagery_World_2D', xpixels = 1500, verbose= True) # plt.show() # ============================================================================= # ============================================================================= # from mpl_toolkits.basemap import Basemap # import matplotlib.pyplot as plt # map = Basemap(llcrnrlon=-10.5,llcrnrlat=33,urcrnrlon=10.,urcrnrlat=46., # resolution='i', projection='cass', lat_0 = 39.5, lon_0 = 0.) # map.bluemarble() # map.drawcoastlines() # plt.show() # ============================================================================= # ============================================================================= # from mpl_toolkits.basemap import Basemap # import matplotlib.pyplot as plt # map = Basemap(projection='ortho', # lat_0=22.6, lon_0=120.3) # map.drawmapboundary(fill_color='aqua') # map.fillcontinents(color='coral',lake_color='aqua') # map.drawcountries() # plt.show() # ============================================================================= # ============================================================================= # from mpl_toolkits.basemap import Basemap # import matplotlib.pyplot as plt # map = Basemap(projection='ortho', # lat_0=0, lon_0=0) # map.drawlsmask(land_color = "#ddaa66", # ocean_color="#7777ff", # resolution = 'l') # plt.show() # ============================================================================= # ============================================================================= # from mpl_toolkits.basemap import Basemap # import matplotlib.pyplot as plt # plt.figure(0) # map = Basemap(projection='ortho',lon_0=0,lat_0=0,resolution='c') # map.drawmapboundary() # plt.figure(1) # map = Basemap(projection='sinu',lon_0=0,resolution='c') # map.drawmapboundary(fill_color='aqua') # plt.show() # ============================================================================= # ============================================================================= # from mpl_toolkits.basemap import Basemap # import matplotlib.pyplot as plt # map = Basemap(projection='aeqd', # lon_0=0.0, lat_0=0, # width=25000000, height=25000000) # map.drawmeridians(range(0, 360, 20)) # plt.show() # ============================================================================= # ============================================================================= # from mpl_toolkits.basemap import Basemap # import matplotlib.pyplot as plt # map = Basemap(llcrnrlon=-93.,llcrnrlat=40.,urcrnrlon=-75.,urcrnrlat=50., # resolution='i', projection='tmerc', lat_0 = 40., lon_0 = -80) # map.drawmapboundary(fill_color='aqua') # map.fillcontinents(color='#ddaa66', lake_color='#0000ff') # map.drawcountries() # map.drawrivers(color='#0000ff') # plt.show() # ============================================================================= # ============================================================================= # from mpl_toolkits.basemap import Basemap # import matplotlib.pyplot as plt # map = Basemap(width=12000000,height=9000000, # rsphere=(6378137.00,6356752.3142),\ # resolution='l',area_thresh=1000.,projection='lcc',\ # lat_1=45.,lat_2=55,lat_0=50,lon_0=-107.) # map.drawmapboundary(fill_color='aqua') # map.fillcontinents(color='#ddaa66', lake_color='aqua') # map.drawcountries() # map.drawstates(color='0.5') # plt.show() # ============================================================================= # ============================================================================= # from mpl_toolkits.basemap import Basemap # import matplotlib.pyplot as plt # map = Basemap(llcrnrlon=-10.5,llcrnrlat=33,urcrnrlon=10.,urcrnrlat=46., # resolution='i', projection='cass', lat_0 = 39.5, lon_0 = 0.) # map.etopo() # map.drawcoastlines() # plt.show() # ============================================================================= # ============================================================================= # from mpl_toolkits.basemap import Basemap # import matplotlib.pyplot as plt # map = Basemap(llcrnrlon=-10.5,llcrnrlat=33,urcrnrlon=10.,urcrnrlat=46., # resolution='i', projection='cass', lat_0 = 39.5, lon_0 = 0.) # map.shadedrelief() # map.drawcoastlines() # plt.show() # ============================================================================= # ============================================================================= # from mpl_toolkits.basemap import Basemap # import matplotlib.pyplot as plt # map = Basemap(llcrnrlon=-10.5,llcrnrlat=35,urcrnrlon=4.,urcrnrlat=44., # resolution='i', projection='tmerc', lat_0 = 39.5, lon_0 = -3.25) # map.drawmapboundary(fill_color='aqua') # map.fillcontinents(color='#cc9955',lake_color='aqua') # map.drawcoastlines() # map.drawmapscale(-7., 35.8, -3.25, 39.5, 500, barstyle='fancy') # map.drawmapscale(-0., 35.8, -3.25, 39.5, 500, fontsize = 14) # plt.show() # ============================================================================= # ============================================================================= # from mpl_toolkits.basemap import Basemap # import matplotlib.pyplot as plt # map = Basemap(projection='merc', # lat_0=0, lon_0=0, # llcrnrlon=-20.,llcrnrlat=0.,urcrnrlon=180.,urcrnrlat=80.) # map.drawmapboundary(fill_color='aqua') # map.fillcontinents(color='coral',lake_color='aqua') # map.drawcoastlines() # x, y = map.gcpoints(2.3, 48.9, 139.7, 35.6, 300) # print(x, y) # map.plot(x, y) # plt.show() # ============================================================================= # ============================================================================= # from mpl_toolkits.basemap import Basemap # import matplotlib.pyplot as plt # map = Basemap(projection='merc', # lat_0=0, lon_0=0, # llcrnrlon=-20.,llcrnrlat=0.,urcrnrlon=180.,urcrnrlat=80.) # map.drawmapboundary(fill_color='aqua') # map.fillcontinents(color='coral',lake_color='aqua') # map.drawcoastlines() # map.drawparallels(range(0, 90, 20)) # map.drawmeridians(range(0, 180, 20)) # #Paris-Tokyo # map.drawgreatcircle(2.3, 48.9, 139.7, 35.6,linewidth=2,color='r') # #Tokyo-Dubai # map.drawgreatcircle(139.7, 35.6, 55.2, 25.0,linewidth=2,color='r') # #Dubai-Paris # map.drawgreatcircle(55.2, 25.0, 2.3, 48.9,linewidth=2,color='r') # plt.show() # ============================================================================= # ============================================================================= # from mpl_toolkits.basemap import Basemap # import matplotlib.pyplot as plt # map = Basemap(projection='gnom', # width=15.e6,height=15.e6, # lat_0=70, lon_0=80) # map.drawmapboundary(fill_color='aqua') # map.fillcontinents(color='coral',lake_color='aqua') # map.drawcoastlines() # map.drawparallels(range(0, 90, 20)) # map.drawmeridians(range(0, 360, 20)) # #Paris-Tokyo # map.drawgreatcircle(2.3, 48.9, 139.7, 35.6,linewidth=2,color='r') # #Tokyo-Dubai # map.drawgreatcircle(139.7, 35.6, 55.2, 25.,linewidth=2,color='r') # #Dubai-Paris # map.drawgreatcircle(55.2, 25., 2.3, 48.9,linewidth=2,color='r') # plt.show() # ============================================================================= # ============================================================================= # from mpl_toolkits.basemap import Basemap # import matplotlib.pyplot as plt # map = Basemap(projection='aeqd', lon_0 = 10, lat_0 = 50, resolution='h') # x, y = map(0, 0) # print(map.is_land(x, y)) # ============================================================================= # ============================================================================= # from mpl_toolkits.basemap import Basemap # import matplotlib.pyplot as plt # from matplotlib.path import Path # import numpy as np # map = Basemap(projection='aeqd', lon_0 = 10, lat_0 = 50, resolution='h') # lons = [0., 0., 16., 76.] # lats = [0., 41., 19., 51.] # x, y = map(lons, lats) # locations = np.c_[x, y] # polygons = [Path(p.boundary) for p in map.landpolygons] # result = np.zeros(len(locations), dtype=bool) # for polygon in polygons: # result += np.array(polygon.contains_points(locations)) # print(result) # ============================================================================= # ============================================================================= # from mpl_toolkits.basemap import Basemap # import matplotlib.pyplot as plt # import numpy as np # fig=plt.figure(figsize=(9, 3)) # map = Basemap(width=12000000,height=8000000, # resolution='l',projection='stere', # lat_ts=50,lat_0=50,lon_0=-107.) # lons, lats, x, y = map.makegrid(30, 30, returnxy=True) # ax = fig.add_subplot(121) # ax.set_title('The regular grid') # map.scatter(x, y, marker='o') # map.drawcoastlines() # ax = fig.add_subplot(122) # ax.set_title('Projection changed') # map = Basemap(width=12000000,height=9000000,projection='aeqd', # lat_0=50.,lon_0=-105.) # x, y = map(lons, lats) # map.scatter(x, y, marker='o') # map.drawcoastlines() # plt.show() # ============================================================================= # ============================================================================= # from mpl_toolkits.basemap import Basemap # import matplotlib.pyplot as plt # from datetime import datetime # map = Basemap(projection='vandg',lon_0=0,resolution='c') # map.drawmapboundary(fill_color="#7777ff") # map.fillcontinents(color="#ddaa66",lake_color="#7777ff") # map.drawcoastlines() # map.nightshade(datetime.now(), delta=0.2) # plt.show() # ============================================================================= # ============================================================================= # from mpl_toolkits.basemap import Basemap # import matplotlib.pyplot as plt # import numpy as np # fig=plt.figure(figsize=(9, 3)) # map = Basemap(projection='sinu', # lat_0=0, lon_0=0) # lons = np.linspace(-180, 180, 10) # lats = np.linspace(-90, 90, 10) # lons, lats = np.meshgrid(lons, lats) # v10 = np.ones((lons.shape)) * 15 # u10 = np.zeros((lons.shape)) # u10_rot, v10_rot, x, y = map.rotate_vector(u10, v10, lons, lats, returnxy=True) # ax = fig.add_subplot(121) # ax.set_title('Without rotation') # map.drawmapboundary(fill_color='aqua') # map.fillcontinents(color='#cc9955', lake_color='aqua', zorder = 0) # map.drawcoastlines(color = '0.15') # map.barbs(x, y, u10, v10, # pivot='middle', barbcolor='#333333') # ax = fig.add_subplot(122) # ax.set_title('Rotated vectors') # map.drawmapboundary(fill_color='#9999FF') # map.fillcontinents(color='#ddaa66', lake_color='#9999FF', zorder = 0) # map.drawcoastlines(color = '0.15') # map.barbs(x, y, u10_rot, v10_rot, # pivot='middle', barbcolor='#ff7777') # plt.show() # ============================================================================= # ============================================================================= # from mpl_toolkits.basemap import Basemap # import matplotlib.pyplot as plt # fig = plt.figure() # map = Basemap(projection='ortho', # lat_0=0, lon_0=0) # map.drawlsmask(land_color = "#ddaa66", # ocean_color="#7777ff", # resolution = 'c') # x1, y1 = map(-60, -30) # x2, y2 = map(0, 0) # x3, y3 = map(45, 45) # plt.plot([x1, x2, x3], [y1, y2, y3], color='k', linestyle='-', linewidth=2) # ax1 = fig.add_axes([0.1, 0., 0.15, 0.15]) # ax1.set_xticks([]) # ax1.set_yticks([]) # ax1.plot([x1, x2, x3], [y1, y2, y3], color='k', linestyle='-', linewidth=2) # map.set_axes_limits(ax=ax1) # ax2 = fig.add_axes([0.3, 0., 0.15, 0.15]) # ax2.set_xticks([]) # ax2.set_yticks([]) # ax2.plot([x1, x2, x3], [y1, y2, y3], color='k', linestyle='-', linewidth=2) # ax3 = fig.add_axes([0.5, 0., 0.15, 0.15]) # ax3.set_xticks([]) # ax3.set_yticks([]) # map.plot([x1, x2, x3], [y1, y2, y3], color='k', linestyle='-', linewidth=2, ax=ax3) # plt.show() # ============================================================================= # ============================================================================= # from mpl_toolkits.basemap import Basemap # import matplotlib.pyplot as plt # import numpy as np # map = Basemap(projection='sinu', # lat_0=0, lon_0=0) # lons = np.arange(30, 390, 30) # lats = np.arange(0, 100, 10) # data = np.indices((lats.shape[0], lons.shape[0])) # data = data[0] + data[1] # print(data) # print(lons) # lons, data = map.shiftdata(lons, datain = data, lon_0=0) # print(lons) # llons, llats = np.meshgrid(lons, lats) # x, y = map(llons, llats) # map.contourf(x, y, data) # map.drawcoastlines() # plt.show() # ============================================================================= # ============================================================================= # from mpl_toolkits.basemap import Basemap # from mpl_toolkits.basemap import shiftgrid # import matplotlib.pyplot as plt # import numpy as np # map = Basemap(projection='sinu', # lat_0=0, lon_0=0) # lons = np.arange(30, 410, 30) # lons[1] = 70 # lats = np.arange(0, 100, 10) # data = np.indices((lats.shape[0], lons.shape[0])) # data = data[0] + data[1] # print(data) # print(lons) # data, lons = shiftgrid(180., data, lons, start=False) # print(data) # print(lons) # llons, llats = np.meshgrid(lons, lats) # x, y = map(llons, llats) # map.contourf(x, y, data) # map.drawcoastlines() # plt.show() # ============================================================================= # ============================================================================= # from mpl_toolkits.basemap import Basemap # import matplotlib.pyplot as plt # map = Basemap(projection='ortho', # lat_0=0, lon_0=0) # map.drawmapboundary(fill_color='aqua') # map.fillcontinents(color='coral',lake_color='aqua') # map.drawcoastlines() # for lon in range(0, 360, 20): # for lat in range(-60, 90, 30): # map.tissot(lon, lat, 4, 50) # plt.show() # ============================================================================= # ============================================================================= # from mpl_toolkits.basemap import Basemap # import matplotlib.pyplot as plt # import numpy as np # fig=plt.figure(figsize=(9, 3)) # map = Basemap(projection='robin', # lat_0=0, lon_0=0) # lons = np.arange(-180, 190, 60) # lats = np.arange(-90, 100, 30) # data = np.indices((lats.shape[0], lons.shape[0])) # data = data[0] + data[1] # llons, llats = np.meshgrid(lons, lats) # ax = fig.add_subplot(121) # ax.set_title('Without transform_scalar') # x, y = map(llons, llats) # map.pcolormesh(x, y, data, cmap='Paired') # map.drawcoastlines() # ax = fig.add_subplot(122) # ax.set_title('Applying transform_scalar') # data_interp, x, y = map.transform_scalar(data, lons, lats, 50, 30, returnxy=True,masked=True) # map.pcolormesh(x, y, data_interp, cmap='Paired') # map.drawcoastlines() # plt.show() # ============================================================================= # ============================================================================= # from mpl_toolkits.basemap import Basemap # import matplotlib.pyplot as plt # import numpy as np # map = Basemap(projection='sinu',lat_0=0, lon_0=0) # lons = np.linspace(-180, 180, 8) # lats = np.linspace(-90, 90, 8) # v10 = np.ones((lons.shape)) * 15 # u10 = np.zeros((lons.shape)) # u10, v10 = np.meshgrid(u10, v10) # u10_rot, v10_rot, x_rot, y_rot = map.transform_vector(u10, v10,lons, lats,15, 15,returnxy=True) # map.drawmapboundary(fill_color='#9999FF') # map.fillcontinents(color='#ddaa66', lake_color='#9999FF', zorder = 0) # map.drawcoastlines(color = '0.15') # #Drawing the original points # lons, lats = np.meshgrid(lons, lats) # x, y = map(lons, lats) # map.barbs(x, y, u10, v10, # pivot='middle', barbcolor='#333333') # #Drawing the rotated & interpolated points # map.barbs(x_rot, y_rot, u10_rot, v10_rot, # pivot='middle', barbcolor='#ff5555') # plt.show() # ============================================================================= # ============================================================================= # import matplotlib.pyplot as plt # from mpl_toolkits.basemap import Basemap # fig = plt.figure() # ax = fig.add_subplot(211) # ax.set_title("Hammer projection") # map = Basemap(projection='hammer', lon_0 = 10, lat_0 = 50) # map.drawmapboundary(fill_color='aqua') # map.fillcontinents(color='coral',lake_color='aqua') # map.drawcoastlines() # ax = fig.add_subplot(212) # ax.set_title("Robinson projection") # map = Basemap(projection='robin', lon_0 = 10, lat_0 = 50) # map.drawmapboundary(fill_color='aqua') # map.fillcontinents(color='coral',lake_color='aqua') # map.drawcoastlines() # plt.show() # ============================================================================= # ============================================================================= # import matplotlib.pyplot as plt # from mpl_toolkits.basemap import Basemap # fig, axes = plt.subplots(2, 1) # axes[0].set_title("Hammer projection") # map = Basemap(projection='hammer', lon_0 = 10, lat_0 = 50, ax=axes[0]) # map.drawmapboundary(fill_color='aqua') # map.fillcontinents(color='coral',lake_color='aqua') # map.drawcoastlines() # axes[1].set_title("Robinson projection") # map = Basemap(projection='robin', lon_0 = 10, lat_0 = 50, ax=axes[1]) # map.drawmapboundary(fill_color='aqua') # map.fillcontinents(color='coral',lake_color='aqua') # map.drawcoastlines() # plt.show() # ============================================================================= # ============================================================================= # import matplotlib.pyplot as plt # from mpl_toolkits.basemap import Basemap # from matplotlib.path import Path # import matplotlib.patches as patches # fig = plt.figure() # ax1 = plt.subplot2grid((2,2), (0,0)) # ax2 = plt.subplot2grid((2,2), (1,0)) # ax3 = plt.subplot2grid((2,2), (0,1), rowspan=2) # map1 = Basemap(projection='ortho', lon_0 = 0, lat_0 = 40, ax=ax1) # map1.drawmapboundary(fill_color='#9999FF') # map1.fillcontinents(color='#ddaa66',lake_color='#9999FF') # map1.drawcoastlines() # map2 = Basemap(projection='cyl', llcrnrlon=-15,llcrnrlat=30,urcrnrlon=15.,urcrnrlat=50., resolution='i', ax=ax2) # map2.drawmapboundary(fill_color='#9999FF') # map2.fillcontinents(color='#ddaa66',lake_color='#9999FF') # map2.drawcoastlines() # map3 = Basemap(llcrnrlon= -1., llcrnrlat=37.5, urcrnrlon=4.5, urcrnrlat=44.5, # resolution='i', projection='tmerc', lat_0 = 39.5, lon_0 = 3, ax=ax3) # map3.drawmapboundary(fill_color='#9999FF') # map3.fillcontinents(color='#ddaa66',lake_color='#9999FF') # map3.drawcoastlines() # #Drawing the zoom rectangles: # lbx1, lby1 = map1(*map2(map2.xmin, map2.ymin, inverse= True)) # ltx1, lty1 = map1(*map2(map2.xmin, map2.ymax, inverse= True)) # rtx1, rty1 = map1(*map2(map2.xmax, map2.ymax, inverse= True)) # rbx1, rby1 = map1(*map2(map2.xmax, map2.ymin, inverse= True)) # verts1 = [ # (lbx1, lby1), # left, bottom # (ltx1, lty1), # left, top # (rtx1, rty1), # right, top # (rbx1, rby1), # right, bottom # (lbx1, lby1), # ignored # ] # codes2 = [Path.MOVETO, # Path.LINETO, # Path.LINETO, # Path.LINETO, # Path.CLOSEPOLY, # ] # path = Path(verts1, codes2) # patch = patches.PathPatch(path, facecolor='r', lw=2) # ax1.add_patch(patch) # lbx2, lby2 = map2(*map3(map3.xmin, map3.ymin, inverse= True)) # ltx2, lty2 = map2(*map3(map3.xmin, map3.ymax, inverse= True)) # rtx2, rty2 = map2(*map3(map3.xmax, map3.ymax, inverse= True)) # rbx2, rby2 = map2(*map3(map3.xmax, map3.ymin, inverse= True)) # verts2 = [ # (lbx2, lby2), # left, bottom # (ltx2, lty2), # left, top # (rtx2, rty2), # right, top # (rbx2, rby2), # right, bottom # (lbx2, lby2), # ignored # ] # codes2 = [Path.MOVETO, # Path.LINETO, # Path.LINETO, # Path.LINETO, # Path.CLOSEPOLY, # ] # path = Path(verts2, codes2) # patch = patches.PathPatch(path, facecolor='r', lw=2) # ax2.add_patch(patch) # plt.show() # ============================================================================= # ============================================================================= # from mpl_toolkits.basemap import Basemap # import matplotlib.pyplot as plt # from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes # from mpl_toolkits.axes_grid1.inset_locator import mark_inset # import numpy as np # fig = plt.figure() # ax = fig.add_subplot(111) # map = Basemap(projection='cyl', # lat_0=0, lon_0=0) # map.drawmapboundary(fill_color='#7777ff') # map.fillcontinents(color='#ddaa66', lake_color='#7777ff', zorder=0) # map.drawcoastlines() # lons = np.array([-13.7, -10.8, -13.2, -96.8, -7.99, 7.5, -17.3, -3.7]) # lats = np.array([9.6, 6.3, 8.5, 32.7, 12.5, 8.9, 14.7, 40.39]) # cases = np.array([1971, 7069, 6073, 4, 6, 20, 1, 1]) # deaths = np.array([1192, 2964, 1250, 1, 5, 8, 0, 0]) # places = np.array(['Guinea', 'Liberia', 'Sierra Leone','United States', 'Mali','Nigeria', 'Senegal', 'Spain']) # x, y = map(lons, lats) # map.scatter(x, y, s=cases, c='r', alpha=0.5) # axins = zoomed_inset_axes(ax, 7, loc=1) # axins.set_xlim(-20, 0) # axins.set_ylim(3, 18) # plt.xticks(visible=False) # plt.yticks(visible=False) # map2 = Basemap(llcrnrlon=-20,llcrnrlat=3,urcrnrlon=0,urcrnrlat=18, ax=axins) # map2.drawmapboundary(fill_color='#7777ff') # map2.fillcontinents(color='#ddaa66', lake_color='#7777ff', zorder=0) # map2.drawcoastlines() # map2.drawcountries() # map2.scatter(x, y, s=cases/5., c='r', alpha=0.5) # mark_inset(ax, axins, loc1=2, loc2=4, fc="none", ec="0.5") # plt.show() # =============================================================================