如何解决Python中的底图问题? [英] How can I solve the problem of basemap in Python ?

查看:147
本文介绍了如何解决Python中的底图问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

import mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt

def mapTut():

    m = Basemap(projection='mill',llcrnrlat=20,urcrnrlat=50,\
                llcrnrlon=-130,urcrnrlon=-60,resolution='c')
    m.drawcoastlines()
    m.drawcountries()
    m.drawstates()
    m.fillcontinents(color='#04BAE3',lake_color='#FFFFFF')
    m.drawmapboundary(fill_color='#FFFFFF')


    # Houston, Texas

    lat,lon = 29.7630556,-95.3630556
    x,y = m(lon,lat)
    m.plot(x,y, 'ro')
    

    lon, lat = -104.237, 40.125 # Location of Boulder

    xpt,ypt = m(lon,lat)
    m.plot(xpt,ypt, 'go')


    
    plt.title("Geo Plotting")
    plt.show()
mapTut()
 Error  Message appears : import mpl_toolkits.basemap import Basemap
                                                            ^





我尝试过:





What I have tried:

After this I found basemap in my package is missing. I downloaded it from matplotlib.org but after installing that to it ended me up with the same result. What to do now??? I am using anaconda 4.2 and python 2.7.

推荐答案

由于你使用的是Anaconda,它有一个底图包:

Since you're using Anaconda, it has a package for basemap:
conda install basemap


这篇关于如何解决Python中的底图问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆