1

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?

Serenity
  • 35,289
  • 20
  • 120
  • 115
Mala Pokhrel
  • 143
  • 2
  • 2
  • 19

1 Answers1

1

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.

Serenity
  • 35,289
  • 20
  • 120
  • 115