Problems with Basemap.scatter
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- matplotlib, python
- Domain
- data-visualization
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.
Description
Hi,
I have stumbled over a bug in scatter plot. With latlon=True, it crashes with zero, one or two points.
Example code:
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 <module>
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
- Dominant language
- Python
- Stars
- 817
- Forks
- 395
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from matplotlib/basemap
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
matplotlib/basemap#368 ·
-
Python 3.14 wheels Open
Difficulty 4/5 3-5 days Newbie friendliness 48/100
matplotlib/basemap#652 · 2 comments · 5 reactions ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
matplotlib/basemap#649 · 2 reactions ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
matplotlib/basemap#646 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 48/100
matplotlib/basemap#645 · 2 comments ·
All issues in matplotlib/basemap
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
anthropics/skills#1811 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
speaches-ai/speaches#678 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
datalayer/mcp-compose#42 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
conda-forge/spacy-feedstock#177 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
UKGovernmentBEIS/inspect_evals#2523 ·