Forgot the attachment...

Michael Hearne wrote:
Chris - Thanks for your reply. Unfortunately, it didn't seem to have any effect on the frame I created.

I notice with matplotlib 0.98.5.1, I get a warning with get_frame(), telling me to use the patch object of the axes instead of get_frame().

So, when I use this with an axes created for a Basemap, I can't get the thickness of the frame around the axes to change.

I'm using Basemap 0.99.2.

The code demonstrating the issue is attached, and the relevant lines of code are near the bottom of the script.

Thanks,

Mike

Christopher Brown wrote:
Hi Michael,

MH> The Axes object has a method for turning on the frame:
MH> set_frame_on().   How do I set the thickness of the frame that
MH> appears?

I use:

plt.gca().get_frame().set_linewidth(2)




#!/usr/bin/python
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
from pylab import *

fig = plt.figure()
ax1 = fig.add_axes([0,0,1.0,1.0])
bounds = (134,144,36,40)

clon = bounds[0] + (bounds[1]-bounds[0])/2.
clat = bounds[2] + (bounds[3]-bounds[2])/2.

# setup Lambert Conformal basemap.
m = Basemap(llcrnrlon=bounds[0],llcrnrlat=bounds[2],
            urcrnrlon=bounds[1],urcrnrlat=bounds[3],
            resolution='h',projection='merc',lat_ts=clat)

# draw coastlines.
m.drawcoastlines()
# draw a boundary around the map, fill the background.
# this background will end up being the ocean color, since
# the continents will be drawn on top.
m.drawmapboundary(fill_color='aqua') 
# fill continents, set lake color same as ocean color. 
m.fillcontinents(color='coral',lake_color='aqua')

left = 0.05
bottom = 0.05
width = 0.25
height = 0.25
llbounds = (left,bottom,width,height)

ax = fig.add_axes(llbounds)
map = Basemap(resolution='c',
                  projection='ortho',
                  lon_0=clon,lat_0=clat,ax=ax)

#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)

map.plot(array([pcx]),array([pcy]),'r*',linewidth=1,markersize=5,markeredgecolor='r')
map.drawmapboundary(color='k',linewidth=2.0)

ax.set_frame_on(True)
ax.patch.set_linewidth(4.0)

plt.savefig('output.png')


------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to