Re: Scatter plot markers

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed, 7 Oct 2009 10:20:53 -0600

Hi Mateus,

Glad you figured it out.

For the other users that may be wondering about this: the "xyMarkers"
resource doesn't apply to every point in a single curve,
but rather every set of curves in a multi-curve plot.

I was going to recommend that you treat each point as its own curve,
but the XY plot object requires at least two points per curve, so
that wouldn't have worked either.

Here's one kludgy method, if you want to avoid using gsn_add_marker:

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"

begin
   x = ispan(1,10,1)
   y = x*log(x*1.)/cos(x*1.)
   marks = (/1,1,1,1,2,3,3,3,2,1/)

   scatterRes = True
   scatterRes_at_xyMarkLineMode = "Markers"
   scatterRes_at_xyMarkerSizeF = 0.03
   scatterRes_at_gsnFrame = False
   scatterRes_at_trYMinF = min(y)
   scatterRes_at_trYMaxF = max(y)
   scatterRes_at_trXMinF = min(x)
   scatterRes_at_trXMaxF = max(x)

   wks = gsn_open_wks("x11","test")

   marker_types = 3 ; We have marker types 1, 2, and 3
   do mtype = 1,marker_types-1
     ii = ind(marks.eq.mtype)
     xtmp = x(ii)
     ytmp = y(ii)
     scatterRes_at_xyMarker = mtype

     plot = gsn_csm_xy( wks, xtmp, ytmp, scatterRes )

     delete(ii)
     delete(xtmp)
     delete(ytmp)
   end do

   frame(wks)

end

--Mary

On Oct 6, 2009, at 8:50 PM, Mateus Teixeira wrote:

> Dear NCL users,
>
> I'm sorry for the last message (copied below). After trying in a
> wrong way, I realize that I only can do what I want with
> gsn_add_polymarker function.
>
> Best regards and apologize for that message.
>
> Mateus
>
>
> ---------- Forwarded message ----------
> From: Mateus Teixeira <mateus.teixeira_at_gmail.com>
> Date: 2009/10/6
> Subject: Scatter plot markers
> To: ncl-talk_at_ucar.edu
>
>
> Dear NCL users,
>
> I'm trying to create a scatter plot in which the points have
> differente marks, according to an array that gives the mark
> indexes, but it seems that the xyMarkers are not getting the array
> with the marks. Please see the script below:
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
> begin
>
> x = ispan(1,10,1)
> y = x*log(x*1.)/cos
> (x*1.)
> marks = (/1,1,1,1,2,3,3,3,2,1/)
>
>
> scatterRes = True
> scatterRes_at_xyMarkLineModes = "Markers"
> scatterRes_at_xyMarkers = marks
> scatterRes_at_xyMarkerSizeF = 0.03
>
> wks = gsn_open_wks
> ("ps","test")
> plot = gsn_csm_xy( wks,
> x, y, scatterRes )
>
> end
>
> Can you see what I'm doing wrong?
>
> Best regards,
>
> --
> Mateus da Silva Teixeira
> Meteorologista
> Instituto de Pesquisas Meteorológicas - IPMet
> Universidade Estadual Paulista - UNESP
> Av. Luis Edmundo Carrijo Coube, 14-01 - Cx. Postal 281 - CEP 17033-360
> Bauru - SP - Brasil
> Fone: +55 14 3103-6030 / fax: 3203-3649
>
> Registered Linux User #466740 (http://counter.li.org/)
>
>
>
> --
> Mateus da Silva Teixeira
> Meteorologista
> Instituto de Pesquisas Meteorológicas - IPMet
> Universidade Estadual Paulista - UNESP
> Av. Luis Edmundo Carrijo Coube, 14-01 - Cx. Postal 281 - CEP 17033-360
> Bauru - SP - Brasil
> Fone: +55 14 3103-6030 / fax: 3203-3649
>
> Registered Linux User #466740 (http://counter.li.org/)
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Oct 07 2009 - 10:20:53 MDT

This archive was generated by hypermail 2.2.0 : Fri Oct 09 2009 - 08:29:22 MDT