;************************************************* ; histo_6.ncl ; ; Concepts illustrated: ; - Comparing two sets of histograms ; - Generating dummy data using "rand" ; ;************************************************ load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" ;************************************************ begin ;************************************************ ; Generate some random data. ;************************************************ x = new(1000,integer) y = new(1000,integer) do i=0,dimsizes(x)-1 x(i) = rand() y(i) = rand() end do x = x/320 y = y/320 ;************************************************ ; Set up a variable to hold both x and y. ;************************************************ z = new((/2,dimsizes(x)/),integer) z(0,:) = x z(1,:) = y ;************************************************ ; create plot ;************************************************ wks = gsn_open_wks("ps","histo") ; open workstation gsn_define_colormap(wks,"temp1") ; choose colormap res = True ; plot mods desired res@gsnHistogramCompare = True plot=gsn_histogram(wks,z,res) ; create histogram end