[ncl-talk] Bar plot: Override X axis labels with text labels
S Br
sbr.climate at gmail.com
Fri Aug 10 12:49:02 MDT 2018
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180810/eb5a1d2b/attachment.html>
More information about the ncl-talk
mailing list