[ncl-talk] Bar plot: Override X axis labels with text labels
S Br
sbr.climate at gmail.com
Fri Aug 10 15:32:02 MDT 2018
Hi Adam,
It worked fine.
Many thanks.
SBR
On Fri, Aug 10, 2018 at 9:12 PM, Adam Phillips <asphilli at ucar.edu> wrote:
> Hi SBR,
> In order to use tmXBLabels/tmXBValues you need to se tmXBMode =
> "ExplicitLabels". See the coding for the bottom panel of example #2 here:
> http://www.ncl.ucar.edu/Applications/tickmarks.shtml#ex2
> If you have further questions please respond to the ncl-talk email list.
> Adam
>
> On Fri, Aug 10, 2018 at 12:49 PM S Br <sbr.climate at gmail.com> wrote:
>
>> Hi All,
>> I am trying to generate a bar plot diagram and would like override the
>> default X-axis labels with the text labels. I am trying 'res at tmXBLabels'
>> but it doesn't work. My code is given below.
>>
>> Thanks.
>> SBR
>>
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>>
>> begin
>>
>> ;********************************************************
>> ; the data
>> ;********************************************************
>> x = (/1,2,3,4,5,6,7,8,9,10,11,12/)
>> y = (/0.32, 0.29, 0.71, 0.09, 0.02, 0.57, 0.62, 0.85, 0.84, 0.12, 0.29,
>> 0.36/)
>> labels = (/"A","B","C","D","E","F","G","H","I","J","K","L"/)
>> ;********************************************************
>> ; create the plot
>> ;********************************************************
>> wks = gsn_open_wks("png","bar_plot") ; send graphics
>> to PNG file
>> res = True ; plot mods desired
>>
>> ; res at gsnFrame = False ; don't advance
>> frame yet
>> res at gsnXYBarChart = True ; turn on bar chart
>> res at gsnXYBarChartBarWidth = 0.75 ; change bar widths
>> res at gsnXYBarChartColors = (/"firebrick","red","orange","green", \
>> "navy","blue","SkyBlue","SlateBlue","navy","blue","SkyBlue","SlateBlue"/)
>> ; choose colors
>>
>> res at tmXBOn = True ; turn off tickmarks
>> at bot
>> res at trYMinF = 0 ; bring bars down to
>> zero
>> res at trXMinF = 0 ; adds space on
>> either end
>> res at trXMaxF = 13 ; of the 1st and
>> last bars
>>
>> res at tmXBLabels = (/"A","B","C","D","E","F","G",
>> "H","I","J","K","L"/)
>>
>> res at tiMainString = "Corelation"
>> plot = gsn_csm_xy (wks,x, y,res) ; create plot
>>
>> end
>>
>>
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>
>
> --
> Adam Phillips
> Associate Scientist, Climate and Global Dynamics Laboratory, NCAR
> www.cgd.ucar.edu/staff/asphilli/ 303-497-1726
>
> <http://www.cgd.ucar.edu/staff/asphilli>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180810/af045120/attachment.html>
More information about the ncl-talk
mailing list