how to plot a scalar on a x-y bar graph

From: mark collier <mark.collier_at_nyahnyahspammersnyahnyah>
Date: Thu Sep 30 2010 - 19:18:17 MDT

Hi,
my script

begin
wks = gsn_open_wks("x11","bar")

      sres = True
      sres@gsnDraw = False
      sres@gsnFrame = False
      sres@gsnXYBarChart = True
      sres@trYMinF = 0.
      sres@trYMaxF = 10.
      sres@gsnXYBarChartBarWidth = 0.25

lst1 = (/1.,4.,7./)
y1 = (/6.,7.,8./)

lst2 = (/2.,5.,8./)
y2 = (/2.,3.,5./)

lst3 = (/3.,6.,9./)
y3 = (/1.,1.,1./)

;lst3 = (/3/)
;y3 = (/1/)

printVarSummary(lst3)

sres@gsnXYBarChartColors = "green"
plot = gsn_csm_xy(wks,lst1,y1,sres)
sres@gsnXYBarChartColors = "brown"
plot_1 = gsn_csm_xy(wks,lst2,y2,sres)
sres@gsnXYBarChartColors = "red"
plot_2 = gsn_csm_xy(wks,lst3,y3,sres)
overlay(plot,plot_1)
overlay(plot,plot_2)
draw(plot)
frame(wks)
end

works, however, if I change my third set of values to a scalar (lst3/
y3), I get the error:

fatal:Subscript out of range, error in subscript #0
fatal:An error occurred reading x
fatal:Execute: Error occurred at or near line 161 in file $NCARG_ROOT/
lib/ncarg/nclscripts/csm/gsn_csm.ncl

fatal:Execute: Error occurred at or near line 4337 in file $NCARG_ROOT/
lib/ncarg/nclscripts/csm/gsn_csm.ncl

fatal:Execute: Error occurred at or near line 31 in file
test_xy_plot.ncl

clearly it doesn't like the fact that I just have one x/y pair. In my
script I just set a dummy value to it (turn it into a vector) and it
works. However, this isn't very elegant. Is there a way of forcing the
single value to be plotted?

Many thanks,
Mark.

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Sep 30 19:19:17 2010

This archive was generated by hypermail 2.1.8 : Mon Oct 04 2010 - 08:55:54 MDT