matplotlib / matplotlib/basemap
Problems with Basemap.scatter
- Dominant language
- Python
- Stars
- 817
- Forks
- 395
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by running the supplied Basemap.scatter example with latlon=True and inspect the shiftdata entry point in mpl_toolkits/basemap/__init__.py, where the traceback fails for small inputs. Done means scatter handles zero, one, and two points without raising IndexError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- matplotlib, python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100