底图错误:模块对象不可调用 [英] Basemap error: module object is not callable
本文介绍了底图错误:模块对象不可调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试学习如何在python中使用底图.我使用以下网站学习 http://www.datadependence.com/2016/06/creating-map-visualisations-in-python/.但是当我输入以下
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()
我收到一个错误,因为 TypeError:模块"对象不可调用
.这是为什么?
I get an error as TypeError: 'module' object is not callable
. Why is the reason for this?
推荐答案
您误解了示例代码.您必须写:
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)
底图
必须以大写字母开头.这对 Python 非常重要.Python是区分大小写的语言.
Basemap
have to be start from capital letter. It is very important for Python. Python is case sensitivity language.
这篇关于底图错误:模块对象不可调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文