cnmaps icon indicating copy to clipboard operation
cnmaps copied to clipboard

使用国界shp裁剪等值线数据后无法zoom in

Open hakurena opened this issue 2 years ago • 2 comments

想要达到的效果是白化中国国界线以外的区域,并且仅绘制100°E以东的地区,因此首先使用clip_contours_by_map裁剪数据,再通过set_extent设置了绘图范围,代码如下:

    # draw contours
    cs = ax.contourf(data_draw.coords['lon'],data_draw.coords['lat'],data_draw, 
                    cmap='Spectral_r', 
                    levels=levels, 
                    extend='both',
                    transform=proj) 
    # clip contour by map
    clip_contours_by_map(cs, map_polygon)
    ax.set_extent([100.,135,15.,55.])

绘图结果如下: Snipaste_2023-06-28_15-29-57 最终使用salem裁剪数据+set_extent达到了目的,但由于是对数据进行裁剪,边缘非常粗糙。我尝试了不使用clip_contour_by_map,并不会出现数据溢出绘图范围的情况,想知道是什么原因导致了这个问题呢?

hakurena avatar Jun 28 '23 07:06 hakurena

@hakurena 参考这个 issue:#97

Clarmy avatar Jun 28 '23 07:06 Clarmy

非常感谢!看了代码感觉应该可以解决问题,您的回复太迅速啦!感谢您开发了这个好用的包~发自我的 iPhone在 2023年6月28日,15:40,Wentao Li @.***> 写道: 参考这个 issue:#97

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

hakurena avatar Jun 28 '23 08:06 hakurena