爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 13904|回复: 3

[求助] 南海子图增加颜色

[复制链接]
回帖奖励 15 金钱 回复本帖可获得 5 金钱奖励! 每人限 1 次

新浪微博达人勋

发表于 2020-11-23 17:30:03 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
怎么让南海子图和主图一样有颜色?

子图代码如下
with open('D:\py\CN-border-La.dat') as src:
    context = src.read()
    blocks = [cnt for cnt in context.split('>') if len(cnt) > 0]
    borders = [np.fromstring(block, dtype=float, sep=' ') for block in blocks]
    # Plot South China Sea as a subfigure
    sub_ax = fig.add_axes([0.650, 0.107, 0.14, 0.155],
                          projection=ccrs.LambertConformal(central_latitude=90,
                                                           central_longitude=115))
    # Plot border lines
    for line in borders:
        sub_ax.plot(line[0::2], line[1::2], '-', lw=1, color='k',
                    transform=ccrs.Geodetic())
    # Set figure extent
    sub_ax.set_extent([105, 125, 0, 25], crs=ccrs.PlateCarree())


C_NZGA){RF_CC~5(58~Q{9L.png
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2020-11-23 20:15:10 | 显示全部楼层

回帖奖励 +5 金钱

# 南海小图
a = plt.axes([0.73, 0.27, 0.12, 0.23])
lon_leftup=107;lat_leftup=24
lon_rightdown=121.3;lat_rightdown=2.4
m = Basemap(projection='cyl', llcrnrlat=lat_rightdown, urcrnrlat=lat_leftup, llcrnrlon=lon_leftup, urcrnrlon=lon_rightdown, resolution='l')
m.drawcoastlines(linewidth=0.3, color='gray')
m.readshapefile('F:/Rpython/lp8/bou1_4m/bou1_4l', 'chn', color='k', linewidth=1.5)
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2020-11-23 20:17:54 | 显示全部楼层
#添加南海,实际上就是新建一个子图覆盖在之前子图的右下角
f2_ax2 = fig2.add_axes([0.82, 0.2835, 0.08, 0.13],projection = proj)
f2_ax2.set_extent([105, 125, 0, 25], crs=ccrs.PlateCarree())
f2_ax2.add_feature(cfeature.COASTLINE.with_scale('50m'))
china = shpreader.Reader('F:/Rpython/lp12/es/bou2_4l.dbf').geometries()
f2_ax2.add_geometries(china, ccrs.PlateCarree(),facecolor='none', edgecolor='black',zorder = 1)
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2020-11-23 20:21:58 | 显示全部楼层
kingjames 发表于 2020-11-23 20:15
# 南海小图
a = plt.axes([0.73, 0.27, 0.12, 0.23])
lon_leftup=107;lat_leftup=24

大佬,能发一下这个'F:/Rpython/lp8/bou1_4m/bou1_4l'文件吗
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表