load "view.ncl" ; ; This example shows how NCL positions the plot in a frame, using ; a unit square. If the gsnMaximize resource is set to True, then ; the NDC grid and the viewport labels will not be drawn. This ; is because maximizing the plot in a frame actually changes the ; position and size of a plot, so the viewport resources you set ; won't be in affect anymore. However, the aspect ratio *will* ; be preserved. ; begin y = sin(0.0628*ispan(0,100,1)) ; Generate a curve with 101 points. wks = gsn_open_wks("png","vp1b") ; Open a PostScript file called "vp1b.png". res = True ; res@gsnMaximize = True ; Maximize plot in frame. res@gsnFrame = False ; Don't advance frame. res@vpXF = 0.25 ; Set some viewport resources res@vpYF = 0.6 ; to reposition and resize the res@vpWidthF = 0.7 ; XY plot. res@vpHeightF = 0.4 draw_unit_square(wks,res) ; Draw NDC grid. plot = gsn_csm_y(wks,y,res) ; Draw the plot. draw_viewport_labels(wks,plot,res) ; Draw viewport labels frame(wks) end