本文整理汇总了Python中cartopy.feature.BORDERS属性的典型用法代码示例。如果您正苦于以下问题:Python feature.BORDERS属性的具体用法?Python feature.BORDERS怎么用?Python feature.BORDERS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类cartopy.feature
的用法示例。
在下文中一共展示了feature.BORDERS属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _setup_map
# 需要导入模块: from cartopy import feature [as 别名]
# 或者: from cartopy.feature import BORDERS [as 别名]
def _setup_map(
ax, xticks, yticks, crs, region, land=None, ocean=None, borders=None, states=None
):
"""
Setup a Cartopy map with land and ocean features and proper tick labels.
"""
if land is not None:
ax.add_feature(cfeature.LAND, facecolor=land)
if ocean is not None:
ax.add_feature(cfeature.OCEAN, facecolor=ocean)
if borders is not None:
ax.add_feature(cfeature.BORDERS, linewidth=borders)
if states is not None:
ax.add_feature(cfeature.STATES, linewidth=states)
ax.set_extent(region, crs=crs)
# Set the proper ticks for a Cartopy map
ax.set_xticks(xticks, crs=crs)
ax.set_yticks(yticks, crs=crs)
ax.xaxis.set_major_formatter(LongitudeFormatter())
ax.yaxis.set_major_formatter(LatitudeFormatter())
示例2: map_unique_events
# 需要导入模块: from cartopy import feature [as 别名]
# 或者: from cartopy.feature import BORDERS [as 别名]
def map_unique_events(cat, catname, mids):
"""Map unassociated events from a catalog."""
if len(mids) == len(cat):
return
cat = cat[~cat['id'].isin(mids)].reset_index(drop=True)
lllat, lllon, urlat, urlon, _, _, _, clon = qcu.get_map_bounds(cat)
plt.figure(figsize=(12, 7))
mplmap = plt.axes(projection=ccrs.PlateCarree(central_longitude=clon))
mplmap.coastlines('50m')
mplmap.scatter(cat['longitude'].tolist(), cat['latitude'].tolist(),
color='r', s=2, zorder=4, transform=ccrs.PlateCarree())
mplmap.gridlines(crs=ccrs.PlateCarree(), draw_labels=True,
linewidth=1, color='gray', alpha=0.5, linestyle='--')
mplmap.add_feature(cfeature.NaturalEarthFeature('cultural',
'admin_1_states_provinces_lines', '50m', facecolor='none',
edgecolor='k', zorder=9))
mplmap.add_feature(cfeature.BORDERS)
plt.title('%s unassociated events' % catname, fontsize=20, y=1.08)
#print(catname)
plt.savefig('%s_uniquedetecs.png' % catname, dpi=300)
plt.close()
示例3: _setup_map
# 需要导入模块: from cartopy import feature [as 别名]
# 或者: from cartopy.feature import BORDERS [as 别名]
def _setup_map(
ax, xticks, yticks, crs, region, land=None, ocean=None, borders=None, states=None
):
"""
Setup a Cartopy map with land and ocean features and proper tick labels.
"""
import cartopy.feature as cfeature
from cartopy.mpl.ticker import LongitudeFormatter, LatitudeFormatter
if land is not None:
ax.add_feature(cfeature.LAND, facecolor=land)
if ocean is not None:
ax.add_feature(cfeature.OCEAN, facecolor=ocean)
if borders is not None:
ax.add_feature(cfeature.BORDERS, linewidth=borders)
if states is not None:
ax.add_feature(cfeature.STATES, linewidth=states)
ax.set_extent(region, crs=crs)
# Set the proper ticks for a Cartopy map
ax.set_xticks(xticks, crs=crs)
ax.set_yticks(yticks, crs=crs)
ax.xaxis.set_major_formatter(LongitudeFormatter())
ax.yaxis.set_major_formatter(LatitudeFormatter())
示例4: receiver_locations
# 需要导入模块: from cartopy import feature [as 别名]
# 或者: from cartopy.feature import BORDERS [as 别名]
def receiver_locations(locs: pandas.DataFrame):
if not isinstance(locs, pandas.DataFrame):
return
if cartopy is not None:
ax = figure().gca(projection=cartopy.crs.PlateCarree())
ax.add_feature(cpf.LAND)
ax.add_feature(cpf.OCEAN)
ax.add_feature(cpf.COASTLINE)
ax.add_feature(cpf.BORDERS, linestyle=':')
else:
ax = figure().gca()
for name, loc in locs.iterrows():
if 15 <= loc.interval < 30:
c = 'g'
elif 5 <= loc.interval < 15:
c = 'o'
elif loc.interval < 5:
c = 'r'
else: # large or undefined interval
c = 'b'
if np.isfinite(loc.interval):
ax.scatter(loc.lon, loc.lat, s=1000*1/loc.interval, c=c, label=name)
else:
ax.scatter(loc.lon, loc.lat, c=c, label=name)
示例5: map_events
# 需要导入模块: from cartopy import feature [as 别名]
# 或者: from cartopy.feature import BORDERS [as 别名]
def map_events(cat1, cat1name, cat2, cat2name, cat1mids, cat2mids, dirname):
"""Map matching events between catalogs."""
if len(cat1mids) == 0:
return
lllat, lllon, urlat, urlon, _, _, _, clon = qcu.get_map_bounds(cat1, cat2)
cat1lons, cat1lats, cat2lons, cat2lats = [], [], [], []
for i, mid in enumerate(cat1mids):
cat1lons.append(cat1[cat1['id'] == mid]['longitude'].get_values()[0])
cat1lats.append(cat1[cat1['id'] == mid]['latitude'].get_values()[0])
cat2lons.append(cat2[cat2['id'] == cat2mids[i]]['longitude'
].get_values()[0])
cat2lats.append(cat2[cat2['id'] == cat2mids[i]]['latitude'
].get_values()[0])
plt.figure(figsize=(12, 7))
mplmap = plt.axes(projection=ccrs.PlateCarree(central_longitude=clon))
mplmap.set_extent([lllon, urlon, lllat, urlat], ccrs.PlateCarree())
mplmap.coastlines('50m')
mplmap.gridlines(crs=ccrs.PlateCarree(), draw_labels=True,
linewidth=1, color='gray', alpha=0.5, linestyle='--')
for i, lat in enumerate(cat1lats):
mplmap.plot([cat1lons[i], cat2lons[i]], [lat, cat2lats[i]],
color='k', transform=ccrs.PlateCarree())
mplmap.scatter(cat1lons, cat1lats, color='b', s=2, zorder=4,
transform=ccrs.PlateCarree(), label=cat1name)
mplmap.scatter(cat2lons, cat2lats, color='r', s=2, zorder=4,
transform=ccrs.PlateCarree(), label=cat2name)
mplmap.add_feature(cfeature.NaturalEarthFeature('cultural',
'admin_1_states_provinces_lines', '50m', facecolor='none',
edgecolor='k', zorder=9))
mplmap.add_feature(cfeature.BORDERS)
plt.legend()
plt.savefig('%s_mapmatcheddetecs.png' % dirname, dpi=300)
plt.close()