On Jul 13, 2010, at 11:36 AM, Jeff Whitaker wrote:

>  On 7/13/10 11:41 AM, Steve McFarlin wrote:
>> On Jul 12, 2010, at 6:15 PM, Jeff Whitaker wrote:
>> 
>>> On 7/12/10 5:34 PM, Steve McFarlin wrote:
>>>> Hello,
>>>> 
>>>> I have an issue rendering with basemap on a Debian server using Agg. I 
>>>> have confirmed that matplotlib does render using the following example.
>>>> 
>>>> # do this before importing pylab or pyplot
>>>> import matplotlib
>>>> matplotlib.use('Agg')
>>>> import matplotlib.pyplot as plt
>>>> fig = plt.figure()
>>>> ax = fig.add_subplot(111)
>>>> ax.plot([1,2,3])
>>>> fig.savefig('test.png')
>>>> 
>>>> However, I receive the following results when using basemap
>>>> 
>>>> Traceback (most recent call last):
>>>>  File "testImageGen.py", line 117, in<module>
>>>>    setCommonBaseMapProperties(m)
>>>>  File "/home/forecast/sgWaveModel/sgUtil.py", line 34, in 
>>>> setCommonBaseMapProperties
>>>>    bmap.drawcoastlines(color=[15./255., 53./255.,73./255.], linewidth=0.15)
>>>>  File "/usr/lib/python2.5/site-packages/mpl_toolkits/basemap/__init__.py", 
>>>> line 1479, in drawcoastlines
>>>>    self.set_axes_limits(ax=ax)
>>>>  File "/usr/lib/python2.5/site-packages/mpl_toolkits/basemap/__init__.py", 
>>>> line 2607, in set_axes_limits
>>>>    and not ax.get_autoscalex_on()
>>>> AttributeError: 'AxesSubplot' object has no attribute 'get_autoscalex_on'
>>>> 
>>>> 
>>>> I am using matplotlib.use('Agg') as the first call in the script. The call 
>>>> to bmpa.drawcoastlines is the first call to basemap I make in my scripts. 
>>>> This works on a system with a windowing toolkit. Any ideas?
>>>> 
>>>> 
>>>> - steve
>>>> 
>>>> 
>>> Steve:  What's your matplotlib version?  Does adding
>>> 
>>> ax.get_autoscalex_on()
>>> 
>>> in your first script cause that to fail as well?
>>> 
>>> -Jeff
>>> 
>> 
>> python 2.5
>> Matplotlib 1.0.0
>> basemap 1.0
>> pygrib 1.7
>> pyproj 1.8.6
>> numpy 1.4.1
>> Latest source of GRIB API
>> Jasper 1.9
>> 
>> At this point I am trying anything. I upgraded everything to the latest 
>> version. I now receive the following error, and a warnings.
>> 
>> /usr/lib/python2.5/site-packages/matplotlib/contour.py:474: 
>> DeprecationWarning: PyArray_FromDims: use PyArray_SimpleNew.
>>   nchunk = self.nchunk)
>> /usr/lib/python2.5/site-packages/matplotlib/contour.py:474: 
>> DeprecationWarning: PyArray_FromDimsAndDataAndDescr: use 
>> PyArray_NewFromDescr.
>>   nchunk = self.nchunk)
>> 
>> Traceback (most recent call last):
>>   File "testImageGen.py", line 124, in<module>
>>     m.drawmapboundary(linewidth=0.0, color=[15./255., 53./255.,73./255.])
>>   File "/usr/lib/python2.5/site-packages/mpl_toolkits/basemap/__init__.py", 
>> line 1325, in drawmapboundary
>>     for spine in ax.spines.itervalues():
>> AttributeError: 'AxesSubplot' object has no attribute 'spines''
>> 
>> 
>> Here are the functions I am calling and their associated errors.
>> 
>> bmap.drawcoastlines(color=[15./255., 53./255.,73./255.], linewidth=0.15)
>> bmap.drawcountries(color='k', linewidth=0.25)
>> bmap.fillcontinents(color="white",lake_color=[51./255., 153./255.,204./255.])
>> bmap.drawstates(color='k', linewidth=0.25)
>> 
>> No errors for the above calls
>> 
>> bmap.drawmapboundary(linewidth=0.0, color=[15./255., 53./255.,73./255.])
>> 
>> I receive the AxesSubplot error listed above.
>> 
>> I believe the errors before (and possible the current) were due to operator 
>> error. I should have started with the latest version of the source from the 
>> start rather then installing deb packages.
>> 
>> 
>> Thanks,
>> Steve
>> 
> Steve: I cannot reproduce this error.  It would help if you sent a 
> self-contained example that I can run to trigger the error.  It is 
> puzzling since the line that the traceback is pointing to is in a 
> try/except block which tries to old matplotlib API to set the color of 
> the map boundary, and if that fails use the newer 'spines' module (which 
> is available in 1.0).  My hypothesis is that you somehow have a mixture 
> of old and new matplotlib versions installed in 
> /usr/lib/python2.5/site-packages, but that's just a guess.
> 
> -Jeff
> 
> -- 

My suspicion and your hypothesis were likely correct. I installed python 2.6 
from source and all the latest libraries for everything required by pygrib and 
basemap. It all works wonderfully. 


Thanks,
Steve





------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to