Mala Pokhrel
Mala Pokhrel

Reputation: 143

Basemap error: module object is not callable

I am trying to learn how to use basemap in python. I used the following site for learning http://www.datadependence.com/2016/06/creating-map-visualisations-in-python/. but when I typed the following

import matplotlib.pyplot as plt
import matplotlib.cm
import basemap
fig,ax=plt.subplots(figsize=(10,20))
m=basemap(resolution='c',projection='merc',lat_0=54.5,lon_0=-4.36,llcrnrlon=-6.,llcrnrlat=49.5,urcrnrlon=2.,urcrnrlat=55.2)
m.drawmapboundary(fill_color='#46bcec')
m.fillcontinents(color='#f2f2f2',lake_color='#46bcec')
m.drawcoastlines()

I get an error as TypeError: 'module' object is not callable. Why is the reason for this?

Upvotes: 1

Views: 678

Answers (1)

Serenity
Serenity

Reputation: 36735

You misunderstood the example code. You have to write:

from mpl_toolkits.basemap import Basemap
m=Basemap(resolution='c',projection='merc',lat_0=54.5,lon_0=-4.36,llcrnrlon=-6.,llcrnrlat=49.5,urcrnrlon=2.,urcrnrlat=55.2)

Basemap have to be start from capital letter. It is very important for Python. Python is case sensitivity language.

Upvotes: 1

Related Questions