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

Rick Brownrigg brownrig at ucar.edu
Sun Nov 10 09:04:05 MST 2019


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/20191110/5c72e874/attachment.html>


More information about the ncl-talk mailing list