Re: How to color vector as defined value and defined colors

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Tue, 18 Sep 2007 15:52:52 -0600

Hi Guangshan,

Yes, I think you could do this by overlaying a 2nd vector field on the
one drawn by gsn_csm_vector_scalar_map_ce. For instance, you would try
something like this:

res = True
..... ; set appropriate resources
res_at_gsnDraw = False
res_at_gsnFrame = False
res_at_vcMonoLineArrowColor = "red"
res_at_gsnScalarContour = False
plot1 = gsn_csm_vector_scalar_map_ce(wks, u, v, var2,res)

u = mask(u,var2.ge.-90.and.var2.lt.90,False)
v = mask(v,var2.ge.-90.and.var2.lt.90,False)
res2 = True
.... ; set appropriate resources
res2_at_vcMonoLineArrowColor = "blue"
res2_at_gsnDraw = False
res2_at_gsnFrame = False
plot2 = gsn_csm_vector(wks,u,v,res2)
overlay (plot1,plot2)
draw(plot1)
frame(wks)

The resulting plot should have red vectors between -90 and 90, and blue
vectors otherwise.
Hope that helps...
Adam

Guangshan chen wrote:
> Hi all,
>
> I have plotted a figure using "gsn_csm_vector_scalar_map_ce(wks, u, v,
> var1)" (see attached figure). Now I want to color the vectors by another
> scalar variable, say var2.
>
> Var2 is the degree of the vector: if the vectors point up, then define
> the degree is 0. If the vectors point left, define -90. If the vector
> point right, define 90. If the vectors point down, define 180 or -180.
> Note: I already have the var2, changing for -180 to 180.
>
> So I want to use one color to color the vectors that almost point up
> (-90 ~ 90) and use another color to color the vectors that almost point
> down (-180 ~ -90, 90 ~ 180). Is there any way to do so (like gray color
> areas)?
>
> Thanks in advance.
>
> Guangshan
>
>
> ------------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
--------------------------------------------------------------
Adam Phillips			             asphilli_at_ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
ESSL/CGD/CAS                               fax: (303) 497-1333
P.O. Box 3000				
Boulder, CO 80307-3000	  http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Sep 18 2007 - 15:52:52 MDT

This archive was generated by hypermail 2.2.0 : Mon Sep 24 2007 - 11:44:39 MDT