8000 call shiftdata on both lat and lon · Issue #163 · matplotlib/basemap · GitHub
[go: up one dir, main page]

Skip to content
call shiftdata on both lat and lon #163
Open
@tacaswell

Description

@tacaswell

This is migrated from matplotlib/matplotlib#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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0