我使用此代码绘制法国上方的投影中心:
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()
我希望看到法国的界限,但它不起作用...... 你看到缺少什么吗?