Hi,

I am a new user of matplotlib Basemap. I tried to draw  the latitude with
interval 0.1 degree using drawparallels, but failed.  I wonder if the
drawparallels can draw latitude lines with small interval instead of
integer values. (drawmeridian can work with small interval 0.1).

Does anyone have any idea to fix this issue?

Thanks!

Dave

#here is a test program to test the drawparallels function
#testbasemap.py
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import numpy as np
import math

latmin=36.803200
latmax=37.306640
lonmin=-76.396026
lonmax=-75.602331

latmin1=math.floor(latmin)
latmax1=math.ceil(latmax)
lonmin1=math.floor(lonmin)
lonmax1=math.ceil(lonmax)

m=Basemap(projection='merc',resolution='h',llcrnrlat=latmin,urcrnrlat=latmax,llcrnrlon=lonmin,urcrnrlon=lonmax)
m.drawcoastlines()
m.drawmapboundary(fill_color='aqua')
m.fillcontinents(color='coral',lake_color='aqua')
meridians = np.arange(lonmin1,lonmax1,0.1)
m.drawmeridians(meridians,labels=[1,1,0,1],fmt='%5.2f')
parallels=np.arange(latmin,latmax,0.1)
m.drawparallels(parallels,labels=[1,1,0,1],fmt='%5.2f')
plt.savefig('test.png')


#####################################################################
The error message is as follows:

Traceback (most recent call last):
  File "testbasemap.py", line 25, in <module>
    m.drawparallels(parallels,labels=[1,1,0,1],fmt='%5.2f')
  File
"/usr/local/lib/python2.7/site-packages/mpl_toolkits/basemap/__init__.py",
line 2067, in drawparallels
    if t is not None: linecolls[int(lat)][1].append(t)
KeyError: 36
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to