[ncl-talk] How to draw a vector in a plot

wen wenguanhuan at 163.com
Wed May 10 21:32:16 MDT 2017


Hi Adam,
  I use option 1 to draw a vector. It is helpful in some case. However, I came up with some problem related to option 1. 


Hi Adam,
  Thank you for help. I follow your suggestion to draw a vector using option #1, and found that option #1 was helpful for me in some case. However, I came up with some problems related to option #1.  I want the vector is start from the center point (0,0). When the txAngle=0, the vector is what I want. However, when the txAngle = 45, I cann't make the vector start from the point (0,0), no matter what value is set for txJust. Do you know how to make the vector start from the point (0,0) in any txAngle? Thank you! 


txres = True
 txres at txFont = "math_symbols"
 txres at txJust = "CenterLeft" 
 txres at txFontColor = "white"
 
 txres at txAngleF = 0 
 txres at txFontHeightF = height(0)
 dumy1 = gsn_add_text(wks,plot1,"o",0,0,txres)


 txres at txJust = "BottomLeft"
 txres at txAngleF = 45 
 txres at txFontHeightF = height(0)
 dumy2 = gsn_add_text(wks,plot2,"o",0,0,txres)



--

Best regards,
Guanhua

At 2017-05-11 04:12:47, "Adam Phillips" <asphilli at ucar.edu> wrote:

Hello,
I see three possibilities:
1) Change to say Font Table 18 and draw a character using gsn_text (or some other NCL gsn*text function).
2) Create 2 empty arrays (with the exception of one point) that contain the u and v information of your proposed arrow, and use gsn_csm_vector to create the single vector. 
3) Use Illustrator or some other external package to add the arrow.


Option 2 seems like it would involve too much work. I have attached a script that shows how to do option #1. I started off with the first example on the Color Fill Applications page here:
http://www.ncl.ucar.edu/Applications/color.shtml#ex1

and modified it to add a single vector, using the Font Table #18:
http://www.ncl.ucar.edu/Document/Graphics/Images/font18.png

and the arrow drawn by specifying the "o" character. Note that you will need to play a bit with the txres resources to get the angle, size, and thickness of the arrow to where you want it: 
https://www.ncl.ucar.edu/Document/Graphics/Resources/tx.shtml



Hope that helps. If you have any further questions please respond to the ncl-talk email list.
Adam










 


On Tue, May 9, 2017 at 6:48 PM, wen <wenguanhuan at 163.com> wrote:

Hi all,
    I am trying to draw a vector over one area, similar with the figure bellow. But I have not found the example on the official website.  Is there anybody knowing how to draw it? Please tell me. Thank you!


  
--

祝好
温冠环




 


_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk







--

Adam Phillips

Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR

www.cgd.ucar.edu/staff/asphilli/   303-497-1726
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170511/8737b174/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ??1.png
Type: image/png
Size: 150068 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170511/8737b174/attachment.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: B~O{(9N~N at 6@4)0ND{`CRGU.jpg
Type: image/jpeg
Size: 46414 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170511/8737b174/attachment.jpg 


More information about the ncl-talk mailing list