[ncl-talk] 回复: how to print the string of plus-minus sign on the figure with NCL

WUJIE 393069045 at qq.com
Sun Nov 10 23:58:07 MST 2019


Hi Rick,


Thanks so much for your help. It does work now:


plus_minus_sign = "~H4V0F34~1~FV0H4~"


Thanks again,
Jie


------------------ 原始邮件 ------------------
发件人: "Rick Brownrigg"<brownrig at ucar.edu>;
发送时间: 2019年11月11日(星期一) 凌晨0:04
收件人: "WUJIE"<393069045 at qq.com>;
抄送: "ncl-talk"<ncl-talk at ucar.edu>;
主题: Re: [ncl-talk] how to print the string of plus-minus sign on the figure with NCL



Hi,


I don't know about using a marker to do what you want -- it can likely be done, but (?)   On the other hand, if I understand correctly, there's a plus/minus symbol in font #34 (character "1"):


    http://www.ncl.ucar.edu/Document/Graphics/Images/font34.png


You'll need to use the "function code" notation to switch font's mid stream in a title:



    http://www.ncl.ucar.edu/Applications/text.shtml


Hope that helps...
Rick



On Sun, Nov 10, 2019 at 6:16 AM WUJIE via ncl-talk <ncl-talk at ucar.edu> wrote:

Hi NCL experts,

Typically I use "gsn_text_ndc" to show some statistic metrics on the XY Plots, which is easy to do. However, for uncertainty purpose, one may need show " plus-minus sign” between two numbers. Does anyone can help how can I show the "plus-minus sign" with NCL? 


I have tried this to make a "plus-minus sign", which is learned from here: http://www.ncl.ucar.edu/Document/Functions/Built-in/NhlNewMarker.shtml 


;-----------------------------------------
   mstring_tem = "1"
   fontnum_tem = 34
   xoffset_tem = 0.0
   yoffset_tem = 0.0
   ratio_tem   = 1.0
   size_tem    = 1.0
   angle_tem   = 0.0
   plus_minus_sign = NhlNewMarker(wks, mstring_tem, fontnum_tem, xoffset_tem, yoffset_tem, ratio_tem, size_tem, angle_tem)

;-----------------------------------------


I then learned that "plus_minus_sign" created by above lines is a number instead of a string, so below line cannot work :


 gsn_text_ndc(wks,"Slope = " + sprintf("%3.2f", rc)+plus_minus_sign+sprintf("%3.2f",std)






How can I transfer it to a string?


Thanks, 


Jie
_______________________________________________
 ncl-talk mailing list
 ncl-talk at ucar.edu
 List instructions, subscriber options, unsubscribe:
 http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20191111/45bbbe80/attachment.html>


More information about the ncl-talk mailing list