[ncl-talk] Printing the +- sign on a plot in NCL

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Tue Sep 2 10:54:10 MDT 2025


Tabish, I am glad that you got it working.  The default text function code
was changed from *":"* to *"~"* in recent versions of NCL, and it looks
like you are using the new default.  The cited example set the older text
function code explicitly:  *txres at txFuncCode = ":"*

I recommend *~F34~1~F~* rather than *~F34~1~F21~* so that the left and
right sides of your output string will use exactly the same font.  If you
like your current version, then of course keep it the way it is now.


On Tue, Sep 2, 2025 at 7:37 AM Tabish Ansari <tabishumaransari at gmail.com>
wrote:

> Dear Ehsan and Dave,
>
> Many thanks for your replies. I managed to get the desired output by using
> "~F34~1~F21~" inside the string.
>
> best regards,
> Tabish
>
>
> On Mon, 1 Sept 2025 at 22:14, Dave Allured - NOAA Affiliate <
> dave.allured at noaa.gov> wrote:
>
>> Tabish, NCL uses font tables for special symbols.
>> https://www.ncl.ucar.edu/Document/Graphics/font_tables.shtml
>>
>> There are two different plus/minus signs in the math symbol tables.  I
>> did not look in the other tables.  Symbols are added to plot strings with
>> the documented encoding method.  Try this NCL example.  Change one line as
>> follows, to show the two different plus/minus symbols.
>> https://www.ncl.ucar.edu/Applications/Scripts/eqn_5.ncl
>>
>> eqn2 = "Table 18 selector 'S' is :F18:S:F: symbol:C:" \
>>          + "Table 34 selector '1' is :F34:1:F: symbol"
>>
>>
>> On Mon, Sep 1, 2025 at 11:04 AM Tabish Ansari via ncl-talk <
>> ncl-talk at mailman.ucar.edu> wrote:
>>
>>> Dear NCL folks,
>>>
>>> I'm posting here after a long time, partly because I've gotten better at
>>> using NCL over the years and partly because nowadays the AI LLMs are able
>>> to answer most of my queries on NCL and solve the errors. However, I
>>> finally have a question at which all the LLMs failed: How do I print the +-
>>> sign (+ on top of -) in an NCL plot? What's the appropriate function code
>>> to use inside the string?
>>>
>>> Thank you very much in advance!
>>>
>>> best regards,
>>> Tabish
>>>
>>> --------------------------------------------------------------------------------------
>>> Dr Tabish Ansari
>>> Research Associate
>>> Air Quality Modelling Group
>>> Research Institute for Sustainability (RIFS) - Helmholtz Centre Potsdam
>>> Potsdam, Germany
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20250902/d3c6f360/attachment.htm>


More information about the ncl-talk mailing list