png plot size in PyNGL

From: Lean, Peter (3246-CalTech) <Peter.Lean_at_nyahnyahspammersnyahnyah>
Date: Wed Aug 11 2010 - 10:55:25 MDT


I'm new to PyNGL so this is probably a simple question, but I'm struggling a bit with it.

I'm making a contour map png image and need to change the default image size.
I've used wkWidth and wkHeight to change the image size (which works fine), but the actual contour plot is still the original size (or at least does not fill the entire image). How can I increase the plot size to fill the png image? (NB. I've used nglMaximize, but it didn't seem to have any effect).

My code is below.

Any help is much appreciated!



wks_type = "png"
res = Ngl.Resources()
res.wkWidth = 2500
res.wkHeight = 1000 
wks = Ngl.open_wks(wks_type,'test',res)
resources = Ngl.Resources()
resources.nglMaximize = True  # didn't seem to have any effect
# Define data lat,lon limits
resources.cnFillOn              = True     # Turn on contour fill.
resources.sfXCStartV = float(min(lons))
resources.sfXCEndV   = float(max(lons))
resources.sfYCStartV = float(min(lats))
resources.sfYCEndV   = float(max(lats))
# Define map lat,lon limits
resources.mpLimitMode = "LatLon"    # Limit the map view.
resources.mpMinLonF   = float(min(lons))
resources.mpMaxLonF   = float(max(lons))
resources.mpMinLatF   = float(min(lats))
resources.mpMaxLatF   = float(max(lats))
resources.mpPerimOn   = True        # Turn on map perimeter.
# Set up the contour levels
resources.cnLevelSelectionMode = "ExplicitLevels" # Define own levels.
resources.cnLevels             = numpy.arange(data.min(),data.max(),(data.max()-data.min())/nsteps)
map = Ngl.contour_map(wks,data,resources)
pyngl-talk mailing list
List instructions, subscriber options, unsubscribe:
Received on Wed Aug 11 10:55:35 2010

This archive was generated by hypermail 2.1.8 : Fri Aug 13 2010 - 15:07:13 MDT