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


Python Basemap.colorbar方法代码示例

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


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

示例1: demo_north_pole

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

    r = RPN(path = "/home/huziy/skynet3_rech1/classOff_Andrey/era2/temp_3d")
    t = r.get_first_record_for_name("I0")
    lon, lat = r.get_longitudes_and_latitudes_for_the_last_read_rec()
    r.close()
    nx, ny = lon.shape

    lon_0, lat_0 = lon[nx//2, ny//2], lat[nx//2, ny//2]


    basemap = Basemap(projection = "omerc", lon_1=60, lat_1 = 89.999, lon_2=-30, lat_2=0, no_rot=True,
        lon_0 = lon_0, lat_0 = lat_0,
        llcrnrlon=lon[0, 0], llcrnrlat=lat[0,0],
        urcrnrlon=lon[-1, -1], urcrnrlat=lat[-1, -1]

    )

    x, y = basemap(lon, lat)


    basemap.contourf(x, y, t)
    basemap.drawcoastlines()
    basemap.colorbar()

    #basemap.shadedrelief()
    plt.show()
开发者ID:guziy,项目名称:RPN,代码行数:29,代码来源:demo_basemap.py

示例2: main

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

    plot_utils.apply_plot_params(width_cm=20, height_cm=20, font_size=10)

    high_hles_years = [1993, 1995, 1998]
    low_hles_years = [1997, 2001, 2006]
    data_path = "/BIG1/skynet1_rech1/diro/sample_obsdata/eraint/eraint_uvslp_years_198111_201102_NDJmean_ts.nc"





    with xr.open_dataset(data_path) as ds:
        print(ds)


        u = get_composit_for_name(ds, "u10", high_years_list=high_hles_years, low_years_list=low_hles_years)
        v = get_composit_for_name(ds, "v10", high_years_list=high_hles_years, low_years_list=low_hles_years)
        msl = get_composit_for_name(ds, "msl", high_years_list=high_hles_years, low_years_list=low_hles_years)

        lons = ds["longitude"].values
        lats = ds["latitude"].values

        print(lats)
        print(msl.shape)
        print(lons.shape, lats.shape)


        lons2d, lats2d = np.meshgrid(lons, lats)


    fig = plt.figure()

    map = Basemap(llcrnrlon=-130, llcrnrlat=22, urcrnrlon=-28,
                  urcrnrlat=65, projection='lcc', lat_1=33, lat_2=45,
                  lon_0=-95, resolution='i', area_thresh=10000)


    clevs = np.arange(-11.5, 12, 1)
    cmap = cm.get_cmap("bwr", len(clevs) - 1)
    bn = BoundaryNorm(clevs, len(clevs) - 1)

    x, y = map(lons2d, lats2d)
    im = map.contourf(x, y, msl / 100, levels=clevs, norm=bn, cmap=cmap) # convert to mb (i.e hpa)
    map.colorbar(im)


    stride = 2
    ux, vy = map.rotate_vector(u, v, lons2d, lats2d)
    qk = map.quiver(x[::stride, ::stride], y[::stride, ::stride], ux[::stride, ::stride], vy[::stride, ::stride],
               scale=10, width=0.01, units="inches")
    plt.quiverkey(qk, 0.5, -0.1, 2, "2 m/s", coordinates="axes")


    map.drawcoastlines(linewidth=0.5)
    map.drawcountries()
    map.drawstates()
    #plt.show()

    fig.savefig("hles_wind_compoosits.png", bbox_inches="tight", dpi=300)
开发者ID:guziy,项目名称:RPN,代码行数:62,代码来源:plot_slp_and_circulation.py

示例3: plot_on_earth

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import colorbar [as 别名]
def plot_on_earth(lons, lats, data, vmin=-4, vmax=12, cbar_loc='left', cbar_ticks=None):
    #import ipdb; ipdb.set_trace()
    #if ax == None:
	#ax = plt.gca()
    plot_lons, plot_data = extend_data(lons, lats, data)

    lons, lats = np.meshgrid(plot_lons, lats)

    m = Basemap(projection='cyl', resolution='c', llcrnrlat=-90, urcrnrlat=90, llcrnrlon=-180, urcrnrlon=180)
    x, y = m(lons, lats)

    m.pcolormesh(x, y, plot_data, vmin=vmin, vmax=vmax)
    #m.pcolormesh(x, y, plot_data)

    m.drawcoastlines()
    if cbar_loc == 'left':
	p_labels = [0, 1, 0, 0]
    else:
	p_labels = [1, 0, 0, 0]

    m.drawparallels(np.arange(-90.,90.1,45.), labels=p_labels, fontsize=10)
    m.drawmeridians(np.arange(-180.,180.,60.), labels=[0, 0, 0, 1], fontsize=10)

    #import ipdb; ipdb.set_trace()
    if cbar_ticks == None:
	cbar = m.colorbar(location=cbar_loc, pad='7%')
    else:
	cbar = m.colorbar(location=cbar_loc, pad='7%', ticks=cbar_ticks)

    if cbar_loc == 'left':
	cbar.ax.xaxis.get_offset_text().set_position((10,0))
开发者ID:markmuetz,项目名称:geogg134_project,代码行数:33,代码来源:plotting.py

示例4: nsolLots

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import colorbar [as 别名]
def nsolLots():
	''' Compare nSol estimates to insolation. '''
	# Read the data first:
	nsolTable = readNsol()
	lons = [p['LonW'] for p in nsolTable]
	lats = [p['LatN'] for p in nsolTable]
	sizes = [p['ArrayOutput'] for p in nsolTable]
	insolSizes = [p['TotalAnnualInsolation'] for p in nsolTable]
	bmOptions = {'projection':'merc', 'lon_0':-95, 'lat_0':35, 'llcrnrlat':20, 'urcrnrlat':50,
		'llcrnrlon':-130, 'urcrnrlon':-60, 'rsphere':6371200., 'resolution':'l', 'area_thresh':10000}
	# First Plot
	plt.subplot(211)
	m1 = Basemap(**bmOptions)
	m1.drawcoastlines()
	m1.drawstates()
	m1.drawcountries()
	plt.title('Panel Output')
	mesh1 = m1.pcolor(lons, lats, sizes, latlon=True, tri=True)
	cbar1 = m1.colorbar(mesh1,location='right',pad='5%')
	cbar1.set_label('kWh')
	# Second Plot
	plt.subplot(212)
	m2 = Basemap(**bmOptions)
	m2.drawcoastlines()
	m2.drawstates()
	m2.drawcountries()
	plt.title('Annual Insolation')
	mesh2 = m2.pcolor(lons, lats, insolSizes, latlon=True, tri=True)
	cbar2 = m2.colorbar(mesh2,location='right',pad='5%')
	cbar2.set_label('kWh/m^2')
开发者ID:AccelerateAnalyticsAdmin,项目名称:omf,代码行数:32,代码来源:baseMapPlotting.py

示例5: _fractions_map

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import colorbar [as 别名]
def _fractions_map(data, dom_x, dom_y, title, case_id, plot_dir):
    """
    Plot diagnostic plots of fraction variables using Basemap
    """
    # ---------------------------------------------------------------- #
    # Plot Fractions
    today = date.today().strftime('%Y%m%d')
    file_name = "{}_{}_{}.png".format(title.lower().replace(" ", "_"),
                                      case_id.lower().replace(" ", "_"),
                                      today)
    pfname = os.path.join(plot_dir, file_name)

    fig = plt.figure(figsize=(8, 8))
    ax = fig.add_axes([0.1, 0.1, 0.8, 0.8])

    dom_x[dom_x < 0] += 360.0

    mask = data <= 0.0
    data = np.ma.array(data, mask=mask)

    cmap = matplotlib.cm.cool
    cmap.set_bad(color=u'w')

    # define projection
    midx = int(dom_x.shape[1]/2)
    midy = int(dom_x.shape[0]/2)
    print midx, midy

    projection = {'projection': 'stere',
                  'lon_0': dom_x[-1, midx],
                  'lat_0': dom_y[midy, midx],
                  'llcrnrlat': dom_y[-1, 0],
                  'urcrnrlat': dom_y[0, -1],
                  'llcrnrlon': dom_x[-1, 0],
                  'urcrnrlon': dom_x[0, -1],
                  'resolution': 'l'}

    log.debug('Projection: %s', projection)

    m = Basemap(**projection)

    m.drawcoastlines()
    m.drawcountries()

    # draw parallels.
    parallels = np.arange(-90., 90, 10.)
    m.drawparallels(parallels, labels=[1, 0, 0, 0])

    # draw meridians
    meridians = np.arange(-180., 180., 10.)
    m.drawmeridians(meridians, labels=[0, 0, 0, 1])

    x, y = m(dom_x, dom_y)  # compute map proj coordinates.
    print 'passed 1'
    cs = m.pcolormesh(x, y, data, cmap=cmap)
    m.colorbar(cs, location='right', pad="5%")
    plt.title(title)
    fig.savefig(pfname)
    # ---------------------------------------------------------------- #
    return pfname
开发者ID:tcchiao,项目名称:RVIC,代码行数:62,代码来源:plots.py

示例6: plot_cedata

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import colorbar [as 别名]
def plot_cedata(lats, lons, data, title):
    """
    Plot coefficient of efficiency data.  Lats, lons, and data should have the
    same temporal dimensions.  Lats and lons should denote gridbox edges.
    e.g. data has spatial dimensions of M (lats) x N (lons) then lats and lons
    should have dimensions of M+1 x N+1.

    Parameters
    ----------
    lats: ndarray
        Latitude array (gridbox edges)
    lons: ndarray
        Longitude array (gridbox edges)
    data: ndarray
        CE data
    title: str
        Plot title
    """
    plt.close('all')
    m = Basemap(projection='gall', llcrnrlat=-90, urcrnrlat=90,
                llcrnrlon=0, urcrnrlon=360, resolution='c')
    m.drawcoastlines()
    
    if data.min() < 0:
        color = cm.bwr
    else:
        color = cm.OrRd
        
    m.pcolor(lons, lats, data, latlon=True, cmap=color, vmin=-1, vmax=1)
    m.colorbar()
    plt.title(title)
    plt.show()
开发者ID:frodre,项目名称:pyLIM,代码行数:34,代码来源:LIMTools.py

示例7: stere

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import colorbar [as 别名]
def stere(data,latitude,longitude,filename):
    """
    :param data: CO浓度数据矩阵
    :param latitude: 纬度
    :param longitude: 经度
    :param filename:
    :return:
    """
    ax = plt.gca()
    fig = plt.figure()
    m = Basemap(width=10000000,height=7500000,
            resolution='l',projection='stere',\
            lat_ts=35,lat_0=35,lon_0=107.)
    nx = int((m.xmax-m.xmin)/5000.)+1
    ny = int((m.ymax-m.ymin)/5000.)+1
    topodat = m.transform_scalar(data,longitude,latitude,nx,ny)
    im = m.imshow(topodat,cm.GMT_haxby,vmin=0,vmax=4e18)
    m.drawcoastlines()
    m.drawcountries()
    m.drawparallels(np.arange(-80.,81.,20.),labels=[1,0,0,0])
    # 画平行的纬度,前一个参数是表示起点,终点,间距的序列,后一个参数是指在哪一个方向显示纬度、经度值
    m.drawmeridians(np.arange(-180.,181.,20.),labels=[0,0,0,1])
    # 画平行的经度
    m.colorbar(im)
    plt.title("CO"+filename[12:14])
    outname = filename+'.png'
    fig.savefig(outname, dpi=fig.dpi)
开发者ID:wuliangradi,项目名称:RemoteSensing,代码行数:29,代码来源:MOPITT.py

示例8: plot_grid2D

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import colorbar [as 别名]
def plot_grid2D(lons, lats, tec_grid2D, datetime, title_label = ''):

	LATS, LONS = np.meshgrid(lats, lons)

	m = Basemap(llcrnrlon=-180,
	            llcrnrlat=-55,
	            urcrnrlon=180,
	            urcrnrlat=75,
	            projection='merc',
	            area_thresh=1000,
	            resolution='i')

	m.drawstates()
	m.drawcountries()
	m.drawcoastlines()

	parallels = np.arange(-90,90,20)
	m.drawparallels(parallels,labels=[True,False,False,True])
	meridians = np.arange(0,360,40)
	m.drawmeridians(meridians,labels=[True,False,False,True])

	m.scatter(LONS, LATS, c=tec_grid2D, latlon = True, linewidths=0, s=5)
	m.colorbar()

	plt.title('%s\n%s' % (title_label, datetime.isoformat(' ')))
开发者ID:arvindkamal,项目名称:pyrsss,代码行数:27,代码来源:example_usage.py

示例9: _raster_on_earth

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import colorbar [as 别名]
def _raster_on_earth(lons, lats, data, vmin=None, vmax=None, loc=None, colorbar=True, labels=True):
    if not loc:
        m = Basemap(projection='cyl', resolution='c',
                    llcrnrlat=-90, urcrnrlat=90, llcrnrlon=-180, urcrnrlon=180)
    else:
        m = Basemap(projection='cyl', resolution='c', **loc)

    if data is not None:
        plot_lons, plot_data = _extend_data(lons, lats, data)
        lons, lats = np.meshgrid(plot_lons, lats)
        x, y = m(lons, lats)
        if vmin:
            m.pcolormesh(x, y, plot_data, vmin=vmin, vmax=vmax)
        else:
            m.pcolormesh(x, y, plot_data)

    m.drawcoastlines()

    if labels:
        p_labels = [0, 1, 0, 0]
        m.drawparallels(np.arange(-90., 90.1, 45.), labels=p_labels, fontsize=10)
        m.drawmeridians(np.arange(-180., 180., 60.), labels=[0, 0, 0, 1], fontsize=10)

    if colorbar and data is not None:
        m.colorbar(location='right', pad='7%')
    return m
开发者ID:markmuetz,项目名称:stormtracks,代码行数:28,代码来源:figure_plotting.py

示例10: _vec_plot_on_earth

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import colorbar [as 别名]
def _vec_plot_on_earth(lons, lats, x_data, y_data, vmin=-4, vmax=12, loc=None, colorbar=False):
    plot_lons, plot_x_data = _extend_data(lons, lats, x_data)
    plot_lons, plot_y_data = _extend_data(lons, lats, y_data)

    lons, lats = np.meshgrid(plot_lons, lats)

    if not loc:
        m = Basemap(projection='cyl', resolution='c',
                    llcrnrlat=-90, urcrnrlat=90, llcrnrlon=-180, urcrnrlon=180)
    else:
        m = Basemap(projection='cyl', resolution='c', **loc)
    x, y = m(lons, lats)

    mag = np.sqrt(plot_x_data**2 + plot_y_data**2)
    vmin, vmax = mag.min(), mag.max()
    m.contourf(x, y, mag)
    # m.pcolormesh(x, y, mag, vmin=vmin, vmax=vmax)
    # m.quiver(x, y, plot_x_data, plot_y_data)
    skip = 1
    m.quiver(x[::skip, ::skip], y[::skip, ::skip],
             plot_x_data[::skip, ::skip], plot_y_data[::skip, ::skip], scale=500)

    m.drawcoastlines()
    m.drawparallels(np.arange(-90., 90., 45.), labels=[1, 0, 0, 0], fontsize=10)
    m.drawmeridians(np.arange(-180., 180., 60.), labels=[0, 0, 0, 1], fontsize=10)

    if colorbar:
        m.colorbar(location='right', pad='7%')
    return m
开发者ID:markmuetz,项目名称:stormtracks,代码行数:31,代码来源:figure_plotting.py

示例11: visualiseUrl

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import colorbar [as 别名]
def visualiseUrl( fig , url , fig1 ):

	nc = url #netCDF4.Dataset(url,'r')

	title = clipc_combine_process.getTitleNC(nc)

	lats = nc.variables['lat'][:]  # extract/copy the data
	lons = nc.variables['lon'][:]

	lat_0 = lats.mean()
	lon_0 = lons.mean()

	ax = fig.add_subplot(fig1)
	basemap = Basemap(resolution='l',projection='ortho', lat_0=lat_0,lon_0=lon_0) #lat_ts=40,

	if len(lons.shape) == 1:
		# 2D Array no time dimmension
		data = nc.variables[title][:][:]
		xi, yi = basemap(*np.meshgrid(lons, lats))
	elif len(lons.shape) == 2:
		# 3D Array time dimmension
		data = nc.variables[title][0][:][:]	 
		xi, yi = basemap(lons, lats)
	else:
		print "DATA SIZE NOT HANDLED"
		data = None

	# Plot Data
	cs = basemap.pcolormesh(xi,yi,np.squeeze(data))

	# Add Coastlines, States, and Country Boundaries
	basemap.drawcoastlines()
	basemap.drawcountries()
	basemap.colorbar()
开发者ID:KNMI,项目名称:wps_workflow,代码行数:36,代码来源:serve_netcdf_d4p.py

示例12: do_subplot

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import colorbar [as 别名]
    def do_subplot(field, title, lons, lats, plot_num, pole, diff=False): 
        """
        Make an individual subplot. 
        """

        if pole == 'north':
            projection = 'nplaea'
            boundinglat = 50
        else:
            projection = 'splaea'
            boundinglat = -50

        m_base = Basemap(projection=projection, boundinglat=boundinglat,
                         lon_0=0) 
        x, y = m_base(lons, lats)
        ax = fig.add_subplot(plot_num)

        max = get_max_within_area(field, lats, boundinglat, pole)
        if diff:
            cmap = plt.get_cmap('RdBu_r')
            min = -max
        else:
            cmap = plt.get_cmap()
            min = 0

        # Set the land points to be gray. 
        cmap.set_bad('0.65')
        m_base.pcolormesh(x, y, field, vmax=max, vmin=min, cmap=cmap)

        m_base.colorbar()
        m_base.drawparallels(np.arange(-80.,81.,20.))
        m_base.drawmeridians(np.arange(-180.,181.,20.))
        if title:
            plt.title(title)
开发者ID:nicjhan,项目名称:climatescripts,代码行数:36,代码来源:cice_plot_ice.py

示例13: draw_map

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import colorbar [as 别名]
def draw_map(lat, lng, sic):
    # setup south polar stereographic basemap.
    # The longitude lon_0 is at 6-o'clock, and the
    # latitude circle boundinglat is tangent to the edge
    # of the map at lon_0. Default value of lat_ts
    # (latitude of true scale) is pole.
    m = Basemap(projection='spstere',boundinglat=-50,lon_0=270,resolution='h', round=True)
    # Basemap()
  
    plt.figure()
    for beam in range(8):        
        x1,y1 = m(lng[beam], lat[beam])
        m.hexbin(x1,y1, C=sic[beam],gridsize=len(sic[beam]),cmap=plt.cm.jet)
            
    m.drawcoastlines()
    m.fillcontinents(color='coral',lake_color='aqua')
    # draw parallels and meridians.
    m.drawparallels(np.arange(-80.,81.,20.))
    m.drawmeridians(np.arange(-180.,181.,20.))
    m.drawmapboundary(fill_color='aqua')
    
    m.colorbar(location="bottom",label="SIC") # draw colorbar
    plt.title("North Polar Stereographic Projection")
    plt.gcf().set_size_inches(18,10)
    plt.show()
开发者ID:PabloSoligo2014,项目名称:M5_SIC,代码行数:27,代码来源:mwr_l2_processor.py

示例14: vec_plot_on_earth

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import colorbar [as 别名]
def vec_plot_on_earth(lons, lats, x_data, y_data, vmin=-4, vmax=12, ax=None):
    if ax == None:
	ax = plt.gca()
    plot_lons, plot_x_data = extend_data(lons, lats, x_data)
    plot_lons, plot_y_data = extend_data(lons, lats, y_data)

    lons, lats = np.meshgrid(plot_lons, lats)

    m = Basemap(ax=ax, projection='cyl', resolution='c', llcrnrlat=-90, urcrnrlat=90, llcrnrlon=-180, urcrnrlon=180)
    x, y = m(lons, lats)

    mag = np.sqrt(plot_x_data**2 + plot_y_data**2)
    vmin, vmax = mag.min(), mag.max()
    m.contourf(x[:-1,:], y[:-1,:], mag, ax=ax)
    #m.pcolormesh(x, y, mag, vmin=vmin, vmax=vmax)
    #m.quiver(x, y, plot_x_data, plot_y_data)
    skip = 5
    m.quiver(x[::skip, ::skip], y[::skip, ::skip], plot_x_data[::skip, ::skip], plot_y_data[::skip, ::skip], ax=ax)

    m.drawcoastlines(ax=ax)
    m.drawparallels(np.arange(-90.,90.,45.), labels=[1, 0, 0, 0], fontsize=10, ax=ax)
    m.drawmeridians(np.arange(-180.,180.,60.), labels=[0, 0, 0, 1], fontsize=10, ax=ax)


    m.colorbar(location='bottom', pad='7%', ax=ax)
    plt.show()
开发者ID:markmuetz,项目名称:geogg134_project,代码行数:28,代码来源:plotting.py

示例15: plot

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import colorbar [as 别名]
 def plot(self, projection='lambert', geopolygons=None, vmin=None, vmax=None):
     # fig=plt.figure(num=None, figsize=(12, 12), dpi=80, facecolor='w', edgecolor='k')
     lat_centre = (self.maxlat+self.minlat)/2.0
     lon_centre = (self.maxlon+self.minlon)/2.0
     if projection=='merc':
         m=Basemap(projection='merc', llcrnrlat=self.minlat-5., urcrnrlat=self.maxlat+5., llcrnrlon=self.minlon-5.,
                   urcrnrlon=self.maxlon+5., lat_ts=20, resolution=resolution)
         # m.drawparallels(np.arange(self.minlat,self.maxlat,self.dlat), labels=[1,0,0,1])
         # m.drawmeridians(np.arange(self.minlon,self.maxlon,self.dlon), labels=[1,0,0,1])
         m.drawparallels(np.arange(-80.0,80.0,5.0), labels=[1,0,0,1])
         m.drawmeridians(np.arange(-170.0,170.0,5.0), labels=[1,0,0,1])
         m.drawstates(color='g', linewidth=2.)
     elif projection=='global':
         m=Basemap(projection='ortho',lon_0=lon_centre, lat_0=lat_centre, resolution=resolution)
         m.drawparallels(np.arange(-80.0,80.0,10.0), labels=[1,0,0,1])
         m.drawmeridians(np.arange(-170.0,170.0,10.0), labels=[1,0,0,1])
     
     elif projection=='regional_ortho':
         m1 = Basemap(projection='ortho', lon_0=self.minlon, lat_0=self.minlat, resolution='l')
         m = Basemap(projection='ortho', lon_0=self.minlon, lat_0=self.minlat, resolution=resolution,\
             llcrnrx=0., llcrnry=0., urcrnrx=m1.urcrnrx/mapfactor, urcrnry=m1.urcrnry/3.5)
         m.drawparallels(np.arange(-80.0,80.0,10.0), labels=[1,0,0,0],  linewidth=2,  fontsize=20)
         # m.drawparallels(np.arange(-90.0,90.0,30.0),labels=[1,0,0,0], dashes=[10, 5], linewidth=2,  fontsize=20)
         # m.drawmeridians(np.arange(10,180.0,30.0), dashes=[10, 5], linewidth=2)
         m.drawmeridians(np.arange(-170.0,170.0,10.0),  linewidth=2)
     elif projection=='lambert':
         distEW, az, baz=obspy.geodetics.gps2dist_azimuth(self.minlat, self.minlon,
                             self.minlat, self.maxlon) # distance is in m
         distNS, az, baz=obspy.geodetics.gps2dist_azimuth(self.minlat, self.minlon,
                             self.maxlat+2., self.minlon) # distance is in m
         m = Basemap(width=distEW, height=distNS, rsphere=(6378137.00,6356752.3142), resolution='l', projection='lcc',\
             lat_1=self.minlat, lat_2=self.maxlat, lon_0=lon_centre, lat_0=lat_centre+1)
         m.drawparallels(np.arange(-80.0,80.0,10.0), linewidth=1, dashes=[2,2], labels=[1,1,0,0], fontsize=15)
         m.drawmeridians(np.arange(-170.0,170.0,10.0), linewidth=1, dashes=[2,2], labels=[0,0,1,0], fontsize=15)
     m.drawcoastlines(linewidth=1.0)
     m.drawcountries()
     # m.drawmapboundary(fill_color=[1.0,1.0,1.0])
     m.fillcontinents(lake_color='#99ffff',zorder=0.2)
     # m.drawlsmask(land_color='0.8', ocean_color='#99ffff')
     m.drawmapboundary(fill_color="white")
     cmap = colors.get_colormap('tomo_80_perc_linear_lightness')
     # #
     # evx, evy=m(129., 41.306)
     # plt.plot(evx, evy, 'y*', markersize=20)
     # #
     x, y=m(self.lonArr, self.latArr)
     im=m.pcolormesh(x, y, self.vArr, cmap=cmap, shading='gouraud', vmin=vmin, vmax=vmax)
     try:
         geopolygons.PlotPolygon(inbasemap=m)
     except:
         pass
     try:
         vrange=vmin+np.arange((vmax-vmin)/0.1+1)*0.1
         cb = m.colorbar(im, "bottom", size="3%", pad='2%', ticks=vrange)
     except:
         cb = m.colorbar(im, "bottom", size="3%", pad='2%')
     cb.ax.tick_params(labelsize=15)
     cb.set_label("Input Phase Velocity (km/sec)", fontsize=15, rotation=0)
     plt.show()
     return
开发者ID:NoisyLeon,项目名称:Pyfmst,代码行数:62,代码来源:pyfmst.py


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