Re: histogram plot

From: Rick Brownrigg <brownrig_at_nyahnyahspammersnyahnyah>
Date: Tue Mar 09 2010 - 14:46:55 MST

Hi Hongyan,

You might try something like:

> res@gsnHistogramDiscreteBinValues = True

Rick

On Mar 9, 2010, at 2:38 PM, H.Dang wrote:

> Could anybody please help me with a simple histogram plot? My code is:
>
> ; - Drawing a histogram using discrete bin values
> ;
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> begin
> x = new(32,integer)
> do i=0,dimsizes(x)-1
> x(i) = i
> end do
>
> fl_y_axes="y_zhou.dat"
>
> data_y = asciiread(fl_y_axes,32,"float")
>
> ; x_short = x
> ; qsort(x)
>
> wks = gsn_open_wks("eps","histo") ; open workstation
> gsn_define_colormap(wks,"temp1") ; choose colormap
>
> res = True
> res@tmXBLabelStride = 2 ; every other x-label
> ; res@gsnHistogramDiscreteBinValues = ispan(0,31,1)
>
> plot=gsn_histogram(wks,data_y,res)
> end
>
> The graph I got is like:
> <midhis.jpg>
> But my data have 32 numbers, I hope thse values are shown as y-axes,
>
> 0.008376069
> 0.010610765
> 0.011429693
> 0.013173127
> 0.015046932
> 0.020174555
> 0.021249746
> 0.027682315
> 0.028703543
> 0.032443662
> 0.033265491
> 0.034031743
> 0.036874688
> 0.036874688
> 0.037776984
> 0.037550021
> 0.037311347
> 0.036591564
> 0.036591564
> 0.035565244
> 0.035565244
> 0.032706172
> 0.030944882
> 0.029017013
> 0.024836748
> 0.022671116
> 0.020509536
> 0.018388382
> 0.018388382
> 0.016339395
> 0.014389086
> 0.006661787
>
> Anyone please help fix it? Thank you!
> --
> Cordially,
> Hongyan
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Mar 9 14:47:02 2010

This archive was generated by hypermail 2.1.8 : Thu Mar 11 2010 - 11:17:07 MST