[ncl-talk] lbLabelFormat functionality request.
Alan Brammer
abrammer at albany.edu
Tue Jan 20 11:56:21 MST 2015
Thanks Mary, (Sorry hit reply way to early)
Yeah, thats how I've been doing it in the past as well.
Last note on the matter then, the documentation for cnLineLabelFormat may
possibly be misleading then?
"Note that since the labels used for the ContourPlot LabelBar are copied
from the cnLineLabelStrings resource the cnLineLabelFormat resource also
controls the formatting of the LabelBar labels. "
On Tue, Jan 20, 2015 at 1:54 PM, Alan Brammer <abrammer at albany.edu> wrote:
> Thanks Mary,
>
> On Tue, Jan 20, 2015 at 12:48 PM, Mary Haley <haley at ucar.edu> wrote:
>
>> Hi Alan,
>>
>> This is an issue for me as well, and I was surprised to see there's no
>> ticket for this. I just created one (NCL-2125).
>>
>> I don't think this is a bug. It's simply an oversight that we never
>> created a "format" type of resource for labelbar labels.
>>
>> You can work around this somewhat awkwardly by:
>>
>> - Creating the plot (set res at gsnDraw = False and res at gsnFrame = False)
>> - Retrieving the "cnLineLabelStrings" resource to get the formatted
>> strings
>> - Setting "res at lbLabelStrings" to this retrieved resource
>> - Recreating the plot with the newly added lbLabelStrings resource
>>
>> You can also set lbLabelStrings the first time you create the plot, but
>> then you would have to use "sprintf" as you mentioned above.
>>
>> I've attached a modified version of your script that uses the method
>> outlined above.
>>
>> --Mary
>>
>>
>> On Tue, Jan 20, 2015 at 9:57 AM, Alan Brammer <abrammer at albany.edu>
>> wrote:
>>
>>> NCLers.
>>>
>>> I would like to be able to format a color bar label, without using
>>> sprintf. It seems that cnLineLabelFormat
>>> <https://www.ncl.ucar.edu/Document/Graphics/Resources/cn.shtml#cnLineLabelFormat>
>>> claims that it should do this job but for me today it is not making any
>>> difference to the label bar.
>>>
>>> Am I missing a step or something? cnLineLabelFormat does it's job nicely
>>> on the plot, but has no impact on the labelbar.
>>>
>>>
>>> Request:
>>> Existence of an lbLabelFormat resource, that is potentially linked to
>>> cnLineLabelFormat when not defined itself.
>>>
>>> For now I will stick to creating my own array of labels, and pumping
>>> them through sprintf.
>>>
>>>
>>> Thanks,
>>> ~Alan.
>>>
>>>
>>>
>>> example code of cnLineLabelFormat not affecting the label bar below:
>>>
>>> x = fspan(-5, 5, 100)
>>> data = new( (/100,100/), float)
>>> do y=0, 99
>>> data(y,:) = exp(( -(x^2)/4) - (((x(y))^2))) ;; quick way of creating
>>> some nice data to plot.
>>> end do
>>>
>>> wks = gsn_open_wks("x11","")
>>>
>>> res = True
>>> res at cnFillOn = True
>>> res at cnFillMode= "RasterFill"
>>> res at cnLinesOn = False
>>> res at cnLineLabelsOn = True
>>> res at cnLineLabelFormat = "0@;*.4f"
>>> res at lbAutoManage = False
>>> res at lbOrientation = "vertical"
>>> plot = gsn_csm_contour(wks, data, res)
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> 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/20150120/c00eb9c3/attachment.html
More information about the ncl-talk
mailing list