matplotlib / matplotlib/basemap
nightshade() on Robinson Projection and lon_0=-180
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 817
- 派生
- 395
- PR 合并指标
- 30 天内没有已合并 PR
描述
Hello! I'm plotting day/night shading on a Robinson projection centered at -180 degrees with nightshade(), and as you can see, the shading doesn't look right. I'm also getting a warning about a non-monotonically increasing x coordinate. Presumably, nightshade() is plotting a transparent contour under the hood, but I couldn't see a way to change the starting longitude in the documentation. I'm not familiar enough with Basemap to know if this is a bug or if I'm missing something. Any suggestions would be greatly appreciated!
Plot
Warning
WARNING: x coordinate not montonically increasing - contour plot may not be what you expect. If it looks odd, your can either adjust the map projection region to be consistent with your data, or (if your data is on a global lat/lon grid) use the shiftgrid function to adjust the data to be consistent with the map projection region (see examples/contour_demo.py).
Code for reproduction
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
from datetime import datetime
# lon_0 is central longitude of projection.
# resolution = 'c' means use crude resolution coastlines.
m = Basemap(projection='robin',lon_0=-180,resolution='c')
m.drawcoastlines()
m.fillcontinents(color='coral',lake_color='aqua')
# draw parallels and meridians.
m.drawparallels(np.arange(-90.,120.,30.))
m.drawmeridians(np.arange(0.,360.,60.))
m.drawmapboundary(fill_color='aqua')
date = datetime(2024,10,10,6)
m.nightshade(date,alpha=0.2)
plt.title("Robinson Projection")
plt.savefig('test.png')
Environment
Ubuntu and RHEL
Python 3.8.13
Please let me know if I should be providing more details
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 Basemap.nightshade() 入口点开始,使用以 lon_0=-180 为中心的 Robinson 投影重现该示例。将阴影效果以及 x 非单调警告与使用其他中央经度的同一示例进行比较,并使用 shiftgrid 和 examples/contour_demo.py 作为参考上下文。当报告的投影能够生成正确的夜间阴影且不会出现意外的等高线警告时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- matplotlib, python
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100