当前位置: 首页>>代码示例>>Python>>正文


Python Basemap.ax方法代码示例

本文整理汇总了Python中mpl_toolkits.basemap.Basemap.ax方法的典型用法代码示例。如果您正苦于以下问题:Python Basemap.ax方法的具体用法?Python Basemap.ax怎么用?Python Basemap.ax使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mpl_toolkits.basemap.Basemap的用法示例。


在下文中一共展示了Basemap.ax方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: prepare_map0

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import ax [as 别名]
def prepare_map0(coordinates, res):
    m = Basemap(llcrnrlon=coordinates[0], llcrnrlat=coordinates[2],
                urcrnrlon=coordinates[1], urcrnrlat=coordinates[3], resolution=res)
    fig = plt.figure()
    ax = plt.subplot(111)
    m.ax = ax
    return fig, m, ax
开发者ID:ctroupin,项目名称:SOCIB_plots,代码行数:9,代码来源:alborex_functions.py

示例2: prepare_map

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import ax [as 别名]
def prepare_map(coordinates,res):
    m = Basemap(projection='merc',llcrnrlon=coordinates[0],llcrnrlat=coordinates[2],urcrnrlon=coordinates[1],urcrnrlat=coordinates[3],  \
            lat_ts=0.5*(coordinates[2]+coordinates[3]),resolution=res)
    fig=plt.figure() 
    ax = plt.subplot(111)
    m.ax=ax
    return fig, m, ax
开发者ID:ctroupin,项目名称:SOCIB_plots,代码行数:9,代码来源:medgib_functions.py

示例3: draw_marker_on_map

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import ax [as 别名]
def draw_marker_on_map(lat, lon, fname, fmt='png', location_name=' ', gridshape=(1, 1)):
    '''
    Purpose::
        Draw a marker on a map

    Input::
        lat - latitude for plotting a marker
        lon - longitude for plotting a marker
        fname  - a string specifying the filename of the plot
    '''
    fig = plt.figure()
    fig.dpi = 300
    ax = fig.add_subplot(111)

    m = Basemap(projection='cyl', resolution='c', llcrnrlat=lat -
                30, urcrnrlat=lat + 30, llcrnrlon=lon - 60, urcrnrlon=lon + 60)
    m.drawcoastlines(linewidth=1)
    m.drawcountries(linewidth=1)
    m.drawmapboundary(fill_color='aqua')
    m.fillcontinents(color='coral', lake_color='aqua')
    m.ax = ax

    xpt, ypt = m(lon, lat)
    m.plot(xpt, ypt, 'bo')  # plot a blue dot there
    # put some text next to the dot, offset a little bit
    # (the offset is in map projection coordinates)
    plt.text(xpt + 0.5, ypt + 1.5, location_name +
             '\n(lon: %5.1f, lat: %3.1f)' % (lon, lat))

    fig.savefig('%s.%s' % (fname, fmt), bbox_inches='tight', dpi=fig.dpi)
    fig.clf()
开发者ID:huikyole,项目名称:climate,代码行数:33,代码来源:plotter.py

示例4: lambert_conformal

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import ax [as 别名]
def lambert_conformal(request):
    import matplotlib
    from mpl_toolkits.basemap import Basemap
    import numpy as np
    from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
    from matplotlib.figure import Figure
    
    width = float(request.GET.get('width', 6000000))
    height = float(request.GET.get('height', 4500000))
    lat = float(request.GET.get('lat',-7))
    lon = float(request.GET.get('lon',107))
    true_lat1 = float(request.GET.get('true_lat1',5))
    true_lat2 = float(request.GET.get('true_lat2',5))
    
    m = Basemap(width=width,height=height,
            rsphere=(6378137.00,6356752.3142),\
            resolution=None,projection='lcc',\
            lat_1=true_lat1,lat_2=true_lat2,lat_0=lat,lon_0=lon)
    
    fig = Figure()
    canvas = FigureCanvas(fig)
    m.ax = fig.add_axes([0, 0, 1, 1])
    
    m.drawlsmask(land_color='gray',ocean_color='white',lakes=True)
    m.drawparallels(np.arange(-90.,91.,30.), color='black')
    m.drawmeridians(np.arange(-180.,181.,60.), color='black')
    
    x, y = m(lon, lat)
    m.plot(x, y, 'ro')
    
    response = HttpResponse(content_type='image/png')
    canvas.print_figure(response, dpi=100)
    return response
开发者ID:arifwn,项目名称:AQMWEB,代码行数:35,代码来源:plot.py

示例5: test_plot

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import ax [as 别名]
def test_plot(request):
    import matplotlib
    from mpl_toolkits.basemap import Basemap
    import numpy as np
    from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
    from matplotlib.figure import Figure
    
    # llcrnrlat,llcrnrlon,urcrnrlat,urcrnrlon
    # are the lat/lon values of the lower left and upper right corners
    # of the map.
    # lat_ts is the latitude of true scale.
    # resolution = 'c' means use crude resolution coastlines.
    
#    #mercator
#    m = Basemap(projection='merc',llcrnrlat=-80,urcrnrlat=80,llcrnrlon=-180,urcrnrlon=180,lat_ts=20,resolution='c')
    

    m = Basemap(width=36000000,height=27000000,rsphere=(6378137.00,6356752.3142),
                resolution='l',area_thresh=1000.,projection='lcc',
                lat_1=30.,lat_0=0.,lon_0=0.)
    
    fig = Figure()
    canvas = FigureCanvas(fig)
    m.ax = fig.add_axes([0, 0, 1, 1])
    
#    m.bluemarble(scale=0.5)
    m.drawcoastlines()
    m.drawmapboundary(fill_color='aqua') 
    m.fillcontinents(color='coral',lake_color='aqua')
    m.drawparallels(np.arange(-90.,91.,30.))
    m.drawmeridians(np.arange(-180.,181.,60.))
    
    response = HttpResponse(content_type='image/png')
    canvas.print_figure(response, dpi=100)
    return response
开发者ID:arifwn,项目名称:AQMWEB,代码行数:37,代码来源:plot.py

示例6: main

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import ax [as 别名]
def main():

    ncols = 841
    nrows = 681
    ndays = 366

    f = open("modis_climatology_splined.bin", "r")
    data = np.fromfile(f).reshape((ndays,nrows,ncols))
    f.close()

    ncolours = 7
    vmin = 0
    vmax = 6

    cmap = sns.blend_palette(["white", "#1b7837"], ncolours, as_cmap=True)
    sns.set(style="white")

    fig = plt.figure(figsize=(10, 6))
    grid = AxesGrid(fig, [0.05,0.05,0.9,0.9], nrows_ncols=(1,1), axes_pad=0.1,
    		        cbar_mode='single', cbar_pad=0.4, cbar_size="7%",
		            cbar_location='bottom', share_all=True)
	# 111.975 + (841. * 0.05)
    # -44.025 + (681. * 0.05)
    m = Basemap(projection='cyl', llcrnrlon=111.975, llcrnrlat=-44.025, \
                urcrnrlon=154.025, urcrnrlat=-9.974999999999994, resolution='h')


    ax = grid[0]
    m.ax = ax


    shp_info = m.readshapefile('/Users/mdekauwe/research/Drought_linkage/'
                               'Bios2_SWC_1979_2013/'
                               'AUS_shape/STE11aAust',
                               'STE11aAust', drawbounds=True)


    #m.drawrivers(linewidth=0.5, color='k')

    ax.set_xlim(140.5, 154)
    ax.set_ylim(-38, -28)

    #cmap = cmap_discretize(plt.cm.YlGnBu, ncolours)

    m.imshow(data[20,:,:], cmap,
             colors.Normalize(vmin=vmin, vmax=vmax, clip=True),
             origin='upper', interpolation='nearest')


    cbar = colorbar_index(cax=grid.cbar_axes[0], ncolours=ncolours, cmap=cmap,
                          orientation='horizontal', vmin=vmin, vmax=vmax)

    fig.savefig("/Users/mdekauwe/Desktop/LAI_NSW.png", bbox_inches='tight',
                pad_inches=0.1, dpi=300)



    plt.show()
开发者ID:mdekauwe,项目名称:get_MODIS_LAI_australia,代码行数:60,代码来源:check_spline.py

示例7: plot_eq_displacements

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import ax [as 别名]
def plot_eq_displacements(LLD_FILE, LEVELS, save_file):
    # Read displacement data
    disp_data = np.genfromtxt(LLD_FILE, dtype=[('lat','f8'),('lon','f8'), ('z','f8')],skip_header=3)

    # Data ranges
    lon_min,lon_max = disp_data['lon'].min(),disp_data['lon'].max()
    lat_min,lat_max = disp_data['lat'].min(),disp_data['lat'].max()
    mean_lat = 0.5*(lat_min + lat_max)
    mean_lon = 0.5*(lon_min + lon_max)
    lon_range = lon_max - lon_min
    lat_range = lat_max - lat_min
    z_min,z_max = disp_data['z'].min(),disp_data['z'].max()
    z_lim = max(np.abs(z_min),np.abs(z_max))
    cmap = plt.get_cmap('seismic')
    norm = mcolor.Normalize(vmin=-z_lim, vmax=z_lim)
    interp = 'cubic'
    landcolor = '#FFFFCC'
    framelabelfont = mfont.FontProperties(family='Arial', style='normal', variant='normal', size=14)

    # Initialize the frame and axes
    fig = plt.figure()
    
    m = Basemap(projection='cyl',llcrnrlat=lat_min, urcrnrlat=lat_max,
                llcrnrlon=lon_min, urcrnrlon=lon_max, lat_0=mean_lat, lon_0=mean_lon, resolution='h')
    m.ax = fig.add_subplot(111)
    
    m.drawmeridians(np.linspace(lon_min,lon_max,num=5.0),labels=[0,0,0,1], linewidth=0)
    m.drawparallels(np.linspace(lat_min,lat_max,num=5.0),labels=[1,0,0,0], linewidth=0)
    m.drawcoastlines(linewidth=0.5)
    m.fillcontinents(color=landcolor, zorder=0)

    # Colorbar
    divider = make_axes_locatable(m.ax)
    cbar_ax = divider.append_axes("right", size="5%",pad=0.05)
    plt.figtext(0.96, 0.7, r'displacement $[m]$', rotation='vertical', fontproperties=framelabelfont)
    cb = mcolorbar.ColorbarBase(cbar_ax, cmap=cmap, norm=norm)

    # Reshape into matrices
    Ncols = len(np.unique(disp_data['lon']))
    Nrows = len(np.unique(disp_data['lat']))
    
    X = disp_data['lon'].reshape(Nrows, Ncols)
    Y = disp_data['lat'].reshape(Nrows, Ncols)
    Z = disp_data['z'].reshape(Nrows, Ncols)
    
    # Masked array via conditional, don't color the land unless it has water on it
    zero_below = int(len(LEVELS)/2)-1
    zero_above = zero_below+1
    masked_data = np.ma.masked_where(np.logical_and(np.array(Z <= LEVELS[zero_above]),np.array(Z >= LEVELS[zero_below])), Z)
    
    # Set masked pixels to the land color
    cmap.set_bad(landcolor, 0.0)  # set alpha=0.0 for transparent
    
    # Plot the contours
    m.contourf(X, Y, masked_data, LEVELS, cmap=cmap, norm=norm, extend='both', zorder=1)

    plt.savefig(save_file,dpi=100)
    print("Saved to "+save_file)
开发者ID:BamyaRhaskar,项目名称:TsunamiSquares,代码行数:60,代码来源:tsunamisquares.py

示例8: bathy_topo_map

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import ax [as 别名]
def bathy_topo_map(LLD_FILE, save_file):
    # Read bathymetry/topography data
    data = np.genfromtxt(LLD_FILE, dtype=[('lat','f8'),('lon','f8'), ('z','f8')],skip_header=3)

    # Data ranges
    lon_min,lon_max = data['lon'].min(),data['lon'].max()
    lat_min,lat_max = data['lat'].min(),data['lat'].max()
    mean_lat = 0.5*(lat_min + lat_max)
    mean_lon = 0.5*(lon_min + lon_max)
    lon_range = lon_max - lon_min
    lat_range = lat_max - lat_min
    cmap = plt.get_cmap('terrain')
    interp = 'none'
    framelabelfont = mfont.FontProperties(family='Arial', style='normal', variant='normal', size=14)
    
    # Reshape into matrices
    Ncols = len(np.unique(data['lon']))
    Nrows = len(np.unique(data['lat']))
    
    X = data['lon'].reshape(Nrows, Ncols)
    Y = data['lat'].reshape(Nrows, Ncols)
    Z = data['z'].reshape(Nrows, Ncols)
        
    # catch any nan values
    masked_data = np.ma.masked_invalid(Z)
    cmap.set_bad('red')
    
    # Color limits
    z_min,z_max = masked_data.min(),masked_data.max()
    z_lim = max(np.abs(z_min),np.abs(z_max))
    norm = mcolor.Normalize(vmin=-z_lim, vmax=z_lim)

    # Initialize the frame and axes
    fig = plt.figure()
    
    m = Basemap(projection='cyl',llcrnrlat=lat_min, urcrnrlat=lat_max,
                llcrnrlon=lon_min, urcrnrlon=lon_max, lat_0=mean_lat, lon_0=mean_lon, resolution='h')
    m.ax = fig.add_subplot(111)
    
    m.drawmeridians(np.linspace(lon_min,lon_max,num=5.0),labels=[0,0,0,1], linewidth=0)
    m.drawparallels(np.linspace(lat_min,lat_max,num=5.0),labels=[1,0,0,0], linewidth=0)
    m.drawcoastlines(linewidth=0.5)

    # Colorbar
    divider = make_axes_locatable(m.ax)
    cbar_ax = divider.append_axes("right", size="5%",pad=0.05)
    plt.figtext(0.96, 0.7, r'elevation $[m]$', rotation='vertical', fontproperties=framelabelfont)
    cb = mcolorbar.ColorbarBase(cbar_ax, cmap=cmap, norm=norm)    
        
    # Plot the contours
    #m.contourf(X, Y, masked_data, 100, cmap=cmap, norm=norm, extend='both', zorder=1)
    m.ax.imshow(masked_data,cmap=cmap,origin='lower',norm=norm,extent=[lon_min,lon_max,lat_max,lat_min],interpolation=interp)

    plt.savefig(save_file,dpi=100)
    print("Saved to "+save_file)
开发者ID:BamyaRhaskar,项目名称:TsunamiSquares,代码行数:57,代码来源:tsunamisquares.py

示例9: make_map

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import ax [as 别名]
def make_map(llcrnrlon, urcrnrlon, llcrnrlat, urcrnrlat, image):
    fig, ax = plt.subplots()
    m = Basemap(llcrnrlon=llcrnrlon, urcrnrlon=urcrnrlon,
                llcrnrlat=llcrnrlat, urcrnrlat=urcrnrlat,
                resolution='c', projection='merc',
                lon_0=(urcrnrlon + llcrnrlon) / 2,
                lat_0=(urcrnrlat + llcrnrlat) / 2,
                lat_ts=-23.5)
    m.ax = ax
    m.imshow(plt.imread(image), origin='upper', zorder=1)
    return fig, ax, m
开发者ID:ocefpaf,项目名称:python-corrida,代码行数:13,代码来源:plotting-example.py

示例10: create_projected_fig

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import ax [as 别名]
def create_projected_fig(lonmin, latmin, lonmax, latmax, projection, height, width):
    from mpl_toolkits.basemap import Basemap
    from matplotlib.figure import Figure
    fig = Figure(dpi=80, facecolor='none', edgecolor='none')
    fig.set_alpha(0)
    fig.set_figheight(height)
    fig.set_figwidth(width)
    m = Basemap(llcrnrlon=lonmin, llcrnrlat=latmin,
            urcrnrlon=lonmax, urcrnrlat=latmax, projection=projection,
            resolution=None,
            lat_ts = 0.0,
            suppress_ticks=True)
    m.ax = fig.add_axes([0, 0, 1, 1], xticks=[], yticks=[])
    return fig, m
开发者ID:dstuebe,项目名称:sci-wms,代码行数:16,代码来源:ugrid.py

示例11: xyPlotCatsMap

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import ax [as 别名]
	def xyPlotCatsMap(self, doShow=True, doSave=False, saveName='catalogPlot.png', epicenter=None, legendLoc='upper left'):
		
		if epicenter==None: epicenter=[self.tLon, self.tLat]
		fcat=[]
		scat=[]
		for rw in self.shockCat:
			scat+=[rw[0:4]]
		for rw in self.fullCat:
			if rw not in scat: fcat+=[rw]
		#return [scat, fcat]
	
		f0=plt.figure(0)	
		plt.clf()
		#		
		#set up map:
		llr=self.getLatLonRange()	# latLonRange
		cntr=[float(llr[0][0])+(llr[1][0]-float(llr[0][0]))/2.0, float(llr[0][1])+(llr[1][1]-float(llr[0][1]))/2.0]
		catmap=Basemap(llcrnrlon=llr[0][1], llcrnrlat=llr[0][0], urcrnrlon=llr[1][1], urcrnrlat=llr[1][0], resolution ='l', projection='tmerc', lon_0=cntr[1], lat_0=cntr[0])
		canvas=FigureCanvas(f0)
		catmap.ax=f0.add_axes([0,0,1,1])
		f0.set_figsize_inches((8/catmap.aspect,8.))
		#
		catmap.drawcoastlines(color='gray')
		catmap.drawcountries(color='gray')
		catmap.fillcontinents(color='beige')
		xfull, yfull=catmap(list(map(operator.itemgetter(2), fcat)), list(map(operator.itemgetter(1), fcat)))
		xshock, yshock=catmap(list(map(operator.itemgetter(2), scat)), list(map(operator.itemgetter(1), scat)))
		epx, epy=catmap(epicenter[0], epicenter[1])
		catmap.plot(xfull, yfull, 'g+', label='Full Catalog')
		catmap.plot(xshock, yshock, 'b.', label='Aftershock zone')
		catmap.plot(epx, epy, 'ro')
		
		canvas.print_figure(saveName)
		
		#
		#ax=plt.gca()
		el = Ellipse((self.tLon, self.tLat), 2.0*self.tA, 2.0*self.tB, -self.tTheta, facecolor='b', alpha=0.4)
		#catmap.ax.add_artist(el)
		#ax.add_artist(el)
		#
		#plt.plot(map(operator.itemgetter(2), self.fullCat), map(operator.itemgetter(1), self.fullCat), '+')
		#plt.plot(map(operator.itemgetter(2), self.shockCat), map(operator.itemgetter(1), self.shockCat), '.')
		#plt.plot(map(operator.itemgetter(2), fcat), map(operator.itemgetter(1), fcat), '+', label='Full Catalog')
		#plt.plot(map(operator.itemgetter(2), scat), map(operator.itemgetter(1), scat), '.', label='Aftershock zone')
		#plt.plot([epicenter[0]], [epicenter[1]], 'ro', label='epicenter')
		plt.legend(loc=legendLoc, numpoints=1)
		if doSave: plt.savefig(saveName)
		if doShow: plt.show()
开发者ID:markyoder,项目名称:common2x,代码行数:50,代码来源:rbIntervals.py

示例12: animator

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import ax [as 别名]
def animator(i):
    print i
    ax.cla()
    
    data = var[i,:,:]
    
    # create basemap
    map = Basemap(projection='cyl',llcrnrlat=lat_e[0],urcrnrlat=lat_e[-1],llcrnrlon=lon_e[0],urcrnrlon=lon_e[-1],resolution='c')
    # make sure map is associated with ax, not axlogo2
    map.ax = ax
    mcoa = map.drawcoastlines(linewidth=0.25)
    mcou = map.drawcountries(linewidth=0.25)
    #add extra stripe of data to complete sphere
    #contour plot data
    pl = map.pcolor(LON,LAT,data, cmap=cmap, norm=cnorm)
    #pl = map.contourf(LON,LAT,data, cmap=cmap, norm=cnorm,antialiased=True)
    ax.set_title('%s %s %s'%(model+add,date[i],time[i]),fontsize=26)
开发者ID:DeneBowdalo,项目名称:AtmosChem_Tools,代码行数:19,代码来源:CCMI_video.py

示例13: mercator

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import ax [as 别名]
def mercator(request):
    import matplotlib
    from mpl_toolkits.basemap import Basemap
    import numpy as np
    from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
    from matplotlib.figure import Figure
    
    upper_lat = float(request.GET.get('upper_lat', 20))
    upper_lon = float(request.GET.get('upper_lon', 145))
    lower_lat = float(request.GET.get('lower_lat',-20))
    lower_lon = float(request.GET.get('lower_lon',90))
    true_lat = float(request.GET.get('true_lat',5))
    
    draw_ref_point = False
    try:
        ref_lat = float(request.GET.get('ref_lat'))
        ref_lon = float(request.GET.get('ref_lon'))
        draw_ref_point = True
    except:
        pass
    
    m = Basemap(projection='merc',llcrnrlat=lower_lat,urcrnrlat=upper_lat,
                llcrnrlon=lower_lon,urcrnrlon=upper_lon,lat_ts=true_lat,
                resolution=None)
    
    fig = Figure()
    canvas = FigureCanvas(fig)
    m.ax = fig.add_axes([0, 0, 1, 1])
    
#    m.drawcoastlines()
#    m.drawmapboundary(fill_color='aqua') 
#    m.fillcontinents(color='coral',lake_color='aqua')
#    m.etopo()
    m.drawlsmask(land_color='gray',ocean_color='white',lakes=True)
    m.drawparallels(np.arange(-90.,91.,30.), color='black')
    m.drawmeridians(np.arange(-180.,181.,60.), color='black')
    
    if draw_ref_point:
        x, y = m(ref_lon, ref_lat)
        m.plot(x, y, 'ro')
    
    response = HttpResponse(content_type='image/png')
    canvas.print_figure(response, dpi=100)
    return response
开发者ID:arifwn,项目名称:AQMWEB,代码行数:46,代码来源:plot.py

示例14: draw_marker_on_map

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import ax [as 别名]
def draw_marker_on_map(lat, lon, fname, fmt='png', location_name=' ', gridshape=(1, 1)):
    '''Draw a marker on a map.

    :param lat: Latitude for plotting a marker.
    :type lat: :class:`float`

    :param lon: Longitude for plotting a marker.
    :type lon: :class:`float`

    :param fname: The filename of the plot.
    :type fname: :class:`string`

    :param fmt: (Optional) Filetype for the output.
    :type fmt: :class:`string`

    :param location_name: (Optional) A label for the map marker.
    :type location_name: :class:`string`

    '''
    fig = plt.figure()
    fig.dpi = 300
    ax = fig.add_subplot(111)

    m = Basemap(projection='cyl', resolution='c', llcrnrlat=lat -
                30, urcrnrlat=lat + 30, llcrnrlon=lon - 60, urcrnrlon=lon + 60)
    m.drawcoastlines(linewidth=1)
    m.drawcountries(linewidth=1)
    m.drawmapboundary(fill_color='aqua')
    m.fillcontinents(color='coral', lake_color='aqua')
    m.ax = ax

    xpt, ypt = m(lon, lat)
    m.plot(xpt, ypt, 'bo')  # plot a blue dot there
    # put some text next to the dot, offset a little bit
    # (the offset is in map projection coordinates)
    plt.text(xpt + 0.5, ypt + 1.5, location_name +
             '\n(lon: %5.1f, lat: %3.1f)' % (lon, lat))

    fig.savefig('%s.%s' % (fname, fmt), bbox_inches='tight', dpi=fig.dpi)
    fig.clf()
开发者ID:MichaelArthurAnderson,项目名称:climate,代码行数:42,代码来源:plotter.py

示例15: animator

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import ax [as 别名]
def animator(i):
    print i
    ax.cla()
    
    # create basemap
    map = Basemap(projection='cyl',llcrnrlat=-90,urcrnrlat=90,llcrnrlon=-180,urcrnrlon=180,resolution='c')
    map.ax = ax
    mcoa = map.drawcoastlines(linewidth=0.25)
    mcou = map.drawcountries(linewidth=0.25)
    #add extra stripe of data to complete sphere
    
    for site_ref in valid_refs:
        site_group = root_grp.groups[site_ref]
        obs_cut = site_group.variables[species.lower()][i]
        obs_lat = site_group.latitude
        obs_lon = site_group.longitude
        obs_group = site_group.process_group
        
        if obs_cut != -99999:        
            x, y = np.meshgrid(*map(obs_lon, obs_lat))
            map.scatter(x, y, c=obs_cut,s=35,cmap=cmap, norm=cnorm)

    ax.set_title('MONTHLY %s %s %s'%(species,full_dates[i],full_times[i]),fontsize=26)
开发者ID:DeneBowdalo,项目名称:AtmosChem_Tools,代码行数:25,代码来源:site_map_video_monthly.py


注:本文中的mpl_toolkits.basemap.Basemap.ax方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。