Python 投影图国家边界

Python 投影图国家边界,python,matplotlib,projection,matplotlib-basemap,Python,Matplotlib,Projection,Matplotlib Basemap,我用这个代码在法国画一个投影中心: from sys import argv from numpy import array,histogram from numpy import * from math import * from matplotlib.pyplot import * from matplotlib.image import * from mpl_toolkits.basemap import Basemap, shiftgrid from matplotlib

我用这个代码在法国画一个投影中心:

from sys import argv

from numpy import array,histogram

from numpy import *

from math import *

from matplotlib.pyplot import *

from matplotlib.image import *

from mpl_toolkits.basemap import Basemap, shiftgrid

from matplotlib import rcParams

import matplotlib.pyplot as plt

import matplotlib.mlab as mlab

import matplotlib.patches as patches

import matplotlib.path as path

import matplotlib.dates as dt

from numpy import linalg

def continents():

 lat=[]

 lon=[]

 for lig in file('24840.dat') :

   ligne=lig.split()


   if len(ligne[0]) > 1 :

     lon.append(ligne[0])

     lat.append(ligne[1])

   else:

     plot(lon,lat,'k',linewidth=0.5)

     lat=[]

     lon=[]

m = Basemap(width=12000000,height=9000000,projection='lcc',\
            resolution='l',lat_1=42,lat_2=52,lat_0=47,lon_0=8)

m.scatter(xlon,xlat,s=45,c=z,vmin=0,vmax=30,cmap=cm.get_cmap('jet', 45),edgecolors='None')

continents() 

m.drawcountries(linewidth=0.3)

m.drawstates(linewidth=0.3)

ax=colorbar()

xlim(-6,10)

ylim(42,52)


show()
我想看看法国的边界,但它不工作。。。
您看到缺少什么了吗?

我添加了matplotlib和basemap标记。您的xlon和xlat来自哪里?此外,变量名称表明在“llc”投影网格上绘制lon/lat。您可能需要先转换坐标。但由于我们没有您的数据文件,因此无法复制您的问题。xlon和xlat来自文件。xlon和xlat来自文件。数据文件有4列:stations/lat/lon/data。实际上,我想用lat/lon在网格上绘制数据。我使用Basemap是因为它似乎更容易绘制国家边界,这可能不是最好的方法。