[ncl-talk] Placing numbers above the bars

Mary Haley haley at ucar.edu
Tue Feb 19 08:33:14 MST 2019


Barry,

You can also use gsn_add_text or gsn_text to place the text above the bar,
using the max value of the bar and the X axis position.

There are some examples. See bar_7.ncl at:

http://www.ncl.ucar.edu/Applications/bar.shtml#ex7

Histograms are slightly different, but there are also several examples of
labeling the bars:

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

See #12, and #16. This is mainly to give you some ideas of different ways
to label a bar.

--Mary




On Sun, Feb 17, 2019 at 9:17 AM Rick Brownrigg <brownrig at ucar.edu> wrote:

> Hi Barry,
>
> You might be able to use "datatondc()" to get the NDC coordinates of the
> tops of the bars, and then use gsn_text_ndc() to draw your annotation
> (applying a small offset in x and/or y direction to properly position it).
> The example on the datatondc() does something similar, but with markers
> rather than text.
>
>     http://ncl.ucar.edu/Document/Functions/Built-in/datatondc.shtml
>     http://ncl.ucar.edu/Document/Graphics/Interfaces/gsn_text_ndc.shtml
>
> Hope that helps...
> Rick
> On Sat, Feb 16, 2019 at 11:05 PM Barry Lynn <barry.h.lynn at gmail.com>
> wrote:
>
>> Hello:
>>
>> I have a bar chart attached.
>>
>> I would like to place a number (I will generate it) above the position of
>> the bar highest bar, centered at each labeled (x-axis) interval.
>>
>> Is there a straightforward way to do this?
>>
>> Thanks,
>>
>> Barry
>>
>> --
>> Barry H. Lynn, Ph.D
>> Senior Associate Scientist, Lecturer,
>> The Institute of the Earth Science,
>> The Hebrew University of Jerusalem,
>> Givat Ram, Jerusalem 91904, Israel
>> Tel: 972 547 231 170
>> Fax: (972)-25662581
>>
>> C.E.O, Weather It Is, LTD
>> Weather and Climate Focus
>> http://weather-it-is.com
>> Jerusalem, Israel
>> Local: 02 930 9525
>> Cell: 054 7 231 170
>> Int-IS: x972 2 930 9525
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
> _______________________________________________
> 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/20190219/0d1c0e8f/attachment.html>


More information about the ncl-talk mailing list