matplotlib / matplotlib/basemap

call shiftdata on both lat and lon

Open
#163 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
817
Forks
395
PR merge metrics
No merged PRs in 30d

Description

This is migrated from https://github.com/matplotlib/matplotlib/issues/3404


There is a bug with point shifting when using latlon=True in Basemap.plot(), as discussed on http://stackoverflow.com/questions/25471723/plotting-on-a-basemap-unexpected-result/25472915: for instance, see the following code

from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt

m = Basemap(projection='merc',llcrnrlat=-80,urcrnrlat=80,\
            llcrnrlon=-180,urcrnrlon=180,lat_ts=20,resolution='l')
m.drawparallels(np.arange(-90.,91.,30.))
m.drawmeridians(np.arange(-180.,181.,60.))

lon=[
 -44.897539694478894,
 -79.56264363246461,
 -108.31264586027467,
 -129.5832433799378,
 -149.11755440233293,
 173.04624586158417,
 57.26114485166647,
 26.06650557322952,
 6.8910540489469785,
 -15.059586144625898]

lat=[
 -23.30021206811055,
 -22.174848810053106,
 -6.169632450760373,
 18.199421172044598,
 45.95724594253466,
 72.89364342463014,
 69.39230460744983,
 41.88542137864501,
 14.50656439517308,
 -8.974170076274387]

m.plot(lon, lat, 'ro', markersize=14, mec='none', latlon=True)
m.plot(lon[:-1], lat[:-1], 'bo', markersize=10, mec='none', latlon=True)
m.plot(lon[1:], lat[1:], 'go', markersize=6, mec='none', latlon=True)

Output:
2pwkx

The red points should all coincide with the blue and green ones, but they don't.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the supplied Basemap.plot() example with latlon=True and compare the red, blue, and green points. Trace the point-shifting behavior used by Basemap.plot() for latitude and longitude; done means the overlapping inputs produce coincident points as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.