TheM00s3
TheM00s3

Reputation: 3711

Basemap Unable to find pixel distance along axis warning

The following code snippet produces the warning. The csv has a list of longitudes and latitudes. The csv contains around 800,000 examples,

import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap

fname = "train.csv"
data = pd.read_csv(fname,sep=",",quotechar='"')
minlon=data["X"].min()
maxlon=data["X"].max()
minlat = data["Y"].min()
maxlat = data["Y"].max()


m =Basemap(projection='merc',llcrnrlat=minlat,urcrnrlat=maxlat,llcrnrlon=-minlon,urcrnrlon=maxlon,resolution='c')
m.drawcoastlines()
m.drawmapboundary()
x,y = m(list(data["X"].astype(float)),list(data["Y"].astype(float)))
m.scatter(x,y,1,marker='o',color='red')
plt.show()

Here is how the map is displayed:enter image description here

The warning generated reads: UserWarning: Unable to find pixel distance along axis for interval padding of ticks; assuming no interval padding needed. warnings.warn("Unable to find pixel distance along axis "

Upvotes: 0

Views: 1840

Answers (1)

Radek Hofman
Radek Hofman

Reputation: 527

Mercator projection does not work around poles by definition, isn't there some value of latitude -90 deg or 90 deg?

Upvotes: 1

Related Questions