[ncl-talk] gsn_histogram
Mary Haley
haley at ucar.edu
Wed Dec 3 09:20:58 MST 2014
Dear Guo,
The X axis of a histogram plot goes from 0 to 1, and the bar widths are
adjusted accordingly. So, what this means
is if you have five bars, then the first bar will be centered between x=0.
and 0.2, the second bar between 0.2 and 0.4, ..., the fifth between 0.8 and
1.0. You will also get tickmarks at these locations.
Note that you will have one extra tickmark than you have bins, because the
tickmarks start at the leftmost edge, and go to the rightmost edge.
To get the labels that you want, then, you need to know how many bins you
have and you don't need to set tmXBValues, unless you want tickmarks at
different locations than what gsn_histogram is giving. You just need to
set tmXBLabels, and make sure you use nbins+1 labels.
If you actually want more control over where the tickmarks are drawn, then
you need to set both tmXBLabels and tmXBValues, but make sure you use
values between 0 and 1.
I've attached an example, which is based on histo_13.ncl at:
http://www.ncl.ucar.edu/Applications/histo.shtml#ex13
This example produces two plots, one where the existing tickmarks are
labeled with different labels, and one where tmXBValues is set such that
the leftmost and rightmost tickmarks (the ones at 0.0 and 1.0) are not
included.
You may also want to look at example histo_15.ncl on the same page, which
is a little more complicated, but allows you have to have more control over
tickmarks and labels.
--Mary
On Wed, Dec 3, 2014 at 2:45 AM, guozfruit <guozfruit at aliyun.com> wrote:
> Dear all,
>
> When I use gsn_histogram to draw several plots, I tried to set the same
> scale for x-axis as below:
> res at trXMinF = 0.3
> res at trXMaxF = 1.3
> res at tmXBMode = "Explicit"
> res at tmXBValues = fspan(0.3,1.3,6)
> res at tmXBLabels = fspan(0.3,1.3,6)
>
> But it looks like I messed up the bins of gsn_histogram. The
> distribution are different after I set the tmXBLabels. Have anyone had
> the similar problem? Could you please tell me how I should set the x-axis
> labels.
> Many thanks.
>
> Guo
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141203/9a0ac292/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: histo_13.ncl
Type: application/octet-stream
Size: 804 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141203/9a0ac292/attachment.obj
More information about the ncl-talk
mailing list