Does anyone know of a way of preventing the generation of extra whitespace around the edge of a figure? The code sample below demonstrates the problem I'm having - I've tried postprocessing the postscript output with ImageMagick's "mogrify -trim", but unfortunately it makes it into a raster image in the process, and I really need the output to stay in vector postscript.

---------------------------------------------------------------
#!/usr/bin/python
from matplotlib.toolkits.basemap import Basemap
from pylab import *

clat = 21.813100
clon = 120.529800
xmin=117.629800
ymin=19.079100
xmax=123.546467
ymax=24.579100

bounds = [xmin,xmax,ymin,ymax]

figwidth = 5.4
dx = bounds[1] - bounds[0]
dy = bounds[3] - bounds[2]
clat = bounds[2] + (bounds[3] - bounds[2])/2
clon = bounds[0] + (bounds[1] - bounds[0])/2
aspect = dy/dx
figheight = aspect * figwidth
fig = figure(figsize=(figwidth,figheight))
ax1 = fig.add_axes([0,0,0.98,0.98])

m = Basemap(llcrnrlon=xmin,llcrnrlat=ymin,urcrnrlon=xmax,urcrnrlat=ymax,
            rsphere=(6378137.00,6356752.3142),
            resolution='h',projection='merc',
            lat_ts=clat)

water_color = [.47,.60,.81]
m.drawrivers(color=water_color)
m.drawcoastlines(linewidth=0.1)

#draw inset map
ax2 = fig.add_axes((0.1,0.1,0.25,0.25))
map = Basemap(resolution='l',
                  projection='ortho',
                  lon_0=clon,lat_0=clat,ax=ax2)
print 'map created.'
map.drawcountries(linewidth=0.1,color=[0.2,0.2,0.2])
map.drawcoastlines(linewidth=0.05,color=[0.2,0.2,0.2])
map.drawlsmask((230,230,230,255),(119,155,207,255))
meridians = arange(-180,210,30)
parallels = arange(-90,120,30)
map.drawmeridians(meridians,linewidth=0.1,dashes=[1,0],color= [0.2,0.2,0.2]) map.drawparallels(parallels,linewidth=0.1,dashes=[1,0],color= [0.2,0.2,0.2])
pcx,pcy = map(clon,clat)
print 'Lat: %f, Lon: %f' % (clat,clon)
map.plot(array([pcx]),array([pcy]),'rD',linewidth=2,markersize=5)
map.drawmapboundary(color='k',linewidth=2.0)

savefig('maptest.eps')
close('all')
---------------------------------------------------------------



------------------------------------------------------
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
------------------------------------------------------


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to