npts = 501 x = 500.+.9*ispan(0,npts-1,1)*cos(0.031415926535898*ispan(0,npts-1,1)) y = 500.+.9*ispan(0,npts-1,1)*sin(0.031415926535898*ispan(0,npts-1,1)) wks = gsn_open_wks("x11","polystuff") res = True res@xyLineColor = "NavyBlue" res@xyLineThicknessF = 3.0 plot = gsn_csm_xy(wks,x,y,res) ; Draw an XY plot with a spiral ;---------------------------------------------------------------------- ; Draw the plot again and add some stuff to it using gsn_polyxxxx ; and gsn_text. ;---------------------------------------------------------------------- draw(plot) ; Draw the plot again, but don't advance the frame yet ; because we want to draw some lines on top ;---Two lines lnres = True lnres@gsLineColor = "Brown" lnres@gsLineThicknessF = 4.0 gsn_polyline(wks,plot,(/min(x),max(x)/),(/400,400/),lnres) gsn_polyline(wks,plot,(/600,600/),(/min(y),max(y)/),lnres) ;---Marker xpos = 500 ypos = 100 mkres = True mkres@gsMarkerIndex = 16 ; filled dot mkres@gsMarkerColor = "sandybrown" mkres@gsMarkerSizeF = 40 gsn_polymarker(wks,plot,xpos,ypos,mkres) ;---Text txres = True txres@txFontHeightF = 0.025 txres@txFontColor = "Purple4" txstring = "A text string centered at " + xpos + "," + ypos gsn_text(wks,plot,txstring,xpos,ypos,txres) frame(wks) ; Now advance the frame ;---------------------------------------------------------------------- ; Draw the plot again and note that none of the text or poly stuff ; is on it. ;---------------------------------------------------------------------- draw(plot) frame(wks) ;---------------------------------------------------------------------- ; Now attach stuff to "plot" using gsn_add functions. We are using ; the exact same input as before. Make sure each return value is ; unique ("id1", "id2", etc). ;---------------------------------------------------------------------- ;---Two lines id1 = gsn_add_polyline(wks,plot,(/min(x),max(x)/),(/400,400/),lnres) id2 = gsn_add_polyline(wks,plot,(/600,600/),(/min(y),max(y)/),lnres) ;---Marker id3 = gsn_add_polymarker(wks,plot,xpos,ypos,mkres) ;---Text id4 = gsn_add_text(wks,plot,txstring,xpos,ypos,txres) draw(plot) ; Now you see all of the added stuff. frame(wks)