[ncl-talk] attaching polymarkers to an XY plot

Xi Chang xi.chang01 at gmail.com
Wed Nov 18 09:13:29 MST 2015


Dear NCL,

I have ozone data with array dimension O3[obs,value], where obs is year of
observation from 2000-2010 and each year has 365 ozone data, i.e.,
O3[11x365].
I'd like to create scatter plot like in example example 29 here
http://ncl.ucar.edu/Applications/Scripts/xy_29.ncl . However it always
produced errors and failed since that example is very difficult to adjust
for my case.

I made something like this for plotting, but it is failed. could you help
me to figure this out:

;========

  wks  = gsn_open_wks("x11","xy")
  gsn_define_colormap(wks,"default")

  res = True
  res at gsnMaximize    = True
  res at vpHeightF      = 0.5
  res at vpWidthF       = 0.75
  res at vpXF           = 0.15
  res at tiXAxisString  = "x"
  res at tiYAxisString  = "y"
  res at tiMainString   = "sos"
  res at gsnDraw        = False
  res at gsnFrame       = False
  res at xyMarkLineMode = "markers"
  res at xyMarker       = 16
  res at xyMarkerColor  = "Background"


  year=ispan(2000,2010,1)
  ntim=dimsizes(year)

  res at trXMinF = year(0)-1
  res at trXMaxF = year(ntim-1)+1

;=======

do n=0,364

  plot               = gsn_csm_xy (wks,year,O3(n,:),res) ; create plot
frame ork

do i=0,ntim-1
    xmarker = year(i)
    ymarker = y(i)

    if (i.gt.0) then
      if (year(i).gt.OldYear) then
        MarkerCol = MarkerCol+1
      end if
      OldYear = year(i)
    end if

    gsres at gsMarkerColor = MarkerCol
    gsres at gsMarkerIndex = 16

    plot@$unique_string("dum")$ =
gsn_add_polymarker(wks,plot,xmarker,ymarker,gsres)
  end do

  draw(plot)
  frame(wks)

end do
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151118/280fe0d9/attachment.html 


More information about the ncl-talk mailing list