matplotlib / matplotlib/basemap

Problems with Basemap.scatter

未关闭
#191 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Python
星标
817
派生
395
PR 合并指标
30 天内没有已合并 PR

描述

Hi,

I have stumbled over a bug in scatter plot. With latlon=True, it crashes with zero, one or two points.

Example code:

``` python
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap

bmap = Basemap(projection='merc',
llcrnrlon=9, urcrnrlon=13,
llcrnrlat=63, urcrnrlat=65,
resolution='c')

lon = [10.0, 12.0]
lat = [64.0, 65.0]

bmap.scatter(lon, lat, latlon=True)

plt.show()
```

This crashes with the following Traceback:

```
Traceback (most recent call last):
File "a.py", line 12, in
bmap.scatter(lon, lat, latlon=True)
File "/opt/anaconda/lib/python2.7/site-packages/mpl_toolkits/basemap/__init__.py", line 536, in with_transform
x = self.shiftdata(x)
File "/opt/anaconda/lib/python2.7/site-packages/mpl_toolkits/basemap/__init__.py", line 4775, in shiftdata
thresh = 360.-londiff_sort[-2]
IndexError: index -2 is out of bounds for axis 0 with size 1
```

I am using python 2.7.10, matplotlib 1.4.3, basemap 1.0.7 on a 64-bit Linux machine

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先运行提供的 Basemap.scatter 示例,并使用 latlon=True,然后检查 mpl_toolkits/basemap/__init__.py 中的 shiftdata 入口点,该处的 traceback 在输入较小时失败。完成标准是 scatter 能够处理零个、一个和两个点而不引发 IndexError。

由索引模型根据 Issue 内容生成。

评估

技术栈
matplotlib, python
领域
data-visualization
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
38/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。