Alex Stapleton wrote: > Not sure if this is the right place to send this, can't seem to find a > dedicated bugs list or issue tracker. Or much discussion regarding the > basemap toolkit at all really. > > Trying to savefig some Basemap instances causes the following > exception in the Cairo backend. Seems to work alright using the Agg > backend but the fill doesn't seem to come out properly. The sea gets > colored as well as the continents. > > Traceback (most recent call last): > File "map.py", line 48, in <module> > plt.savefig("map.png", dpi=100) > File "/usr/lib/python2.5/site-packages/matplotlib/pyplot.py", line > 286, in savefig > return fig.savefig(*args, **kwargs) > File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line > 1033, in savefig > self.canvas.print_figure(*args, **kwargs) > File "/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py", > line 1301, in print_figure > **kwargs) > File > "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_cairo.py", > line 406, in print_png > self.figure.draw (renderer) > File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line > 833, in draw > for a in self.axes: a.draw(renderer) > File "/usr/lib/python2.5/site-packages/matplotlib/axes.py", line 1539, in > draw > a.draw(renderer) > File "/usr/lib/python2.5/site-packages/matplotlib/patches.py", line > 285, in draw > renderer.draw_path(gc, tpath, affine, rgbFace) > File > "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_cairo.py", > line 140, in draw_path > raise ValueError("The Cairo backend can not draw paths longer than > 18980 points.") > ValueError: The Cairo backend can not draw paths longer than 18980 points. > > Here's a short reduction > > import matplotlib > matplotlib.use("Cairo") > from mpl_toolkits.basemap import Basemap > import matplotlib.pyplot as plt > > map = Basemap(projection='ortho', > llcrnrlon=-12.7, llcrnrlat=49, > urcrnrlon=4.7, urcrnrlat=61, > lat_0 = 50, lon_0 = 0, > lat_ts=50, > resolution='i') > map.drawcoastlines(linewidth=0.5) > map.drawcountries(linewidth=0.5) > map.drawstates(linewidth=0.5) > map.drawmapboundary() > plt.savefig("map.png", dpi=100) > > Alex: I don't have the Cairo backend installed, but I bet it would work if you changed resolution='i' to resolution='l'. Seems like a pretty severe limitation of the backend though.
-Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 325 Broadway Boulder, CO, USA 80305-3328 ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users