[ncl-talk] Lat/lon labels
Zilore Mumba
zmumba at gmail.com
Sun Apr 9 14:11:39 MDT 2023
Rick, thank you very much for pointing me to the right resources. I tried
several things, and eventually the lat/lon labels came as I wanted them (as
you can see from the attachment). I am not really sure what fixed them
because I removed the resources I tried, but the labelling remains. I have
copied this to the list, though I am not sure if it may be useful.
On Sun, Apr 9, 2023 at 4:53 PM Rick Brownrigg <brownrig at ucar.edu> wrote:
> Hi Zilore,
>
> The specific error with ispan is that the function takes integers, not
> floats:
>
> lats = ispan(-31,-28,1)
>
> There is an fspan function if that's what you really want; it behaves a
> bit differently:
>
> https://www.ncl.ucar.edu/Document/Functions/Built-in/fspan.shtml
>
> More to your question, I'm not expert with labelling axes, so I always
> have to experiment. If fixing the ispan() error doesn't get you the labels
> you want, you might look at the examples on tickmarks for how to custom
> label axes:
>
> https://www.ncl.ucar.edu/Applications/tickmarks.shtml
>
> Hope that helps...
> Rick
>
> On Sun, Apr 9, 2023 at 1:59 AM Zilore Mumba via ncl-talk <
> ncl-talk at mailman.ucar.edu> wrote:
>
>> My script,figure attached, outputs one longitude and one latitude labels
>> only. In the code snippet below, I have turned on gridlines and they draw
>> ok.
>> From this script
>> https://www.ncl.ucar.edu/Applications/Scripts/mapgrid_6.ncl I was
>> guessing that I could put latitude and longitudes labels using the code
>> reproduced below. This gives me the error (lats = ispan(-31.,-28.,1.)
>> "fatal:ispan: arguments must be of an integral type, can't continue"
>> How does one get customized lat/lon labels?
>>
>> res at mpGridAndLimbOn = True ; turn on grid
>> lines
>> res at mpGridSpacingF = 0.5
>>
>> ;---Create lat/lon arrays for location of latitude labels.
>> ;lats = ispan(-31.,-28.,1.)
>> ;nlat = dimsizes(lats)
>> ;lons = new(nlat,integer)
>> ;lons = 0
>>
>> ;---Resources for text strings
>> ;txres = True
>> ;txres at txFontHeightF = 0.015
>> ;dum = gsn_add_text(wks,plot,""+lats,lons,lats,txres)
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at mailman.ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20230409/0b2d327e/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Tmin_NODA_05.png
Type: image/png
Size: 103283 bytes
Desc: not available
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20230409/0b2d327e/attachment.png>
More information about the ncl-talk
mailing list