[ncl-talk] gsn_histogram log axis

Mary Haley haley at ucar.edu
Tue Dec 12 09:12:26 MST 2017


The histogram code is meant to count the number of values in each range,
and the polygons are all drawn by starting at Y=0 and going to Y=N where N
is the number of values in that count.

The reason why the log of the Y axis is failing is because the minimum Y
axis value is being set internally to Y=0 which you can't take the log of.

Are you sure that gsn_histogram is the code you want? That is, do you need
to bin your values?

You could try forcing the YMinF to be something other than 0, but you will
still get some warnings because internally, it is still trying to take the
log of 0:

  res         = True
  res at trYMinF = 1.
  res at trYLog  = True
  res at tiMainString = "Log histogram"
  plot_log = gsn_histogram(wks,x,res)

To get the above code snippet to not produce a warning, I had to modify an
internal routine, "hist_columns", and hard-code the Y=0 value to be Y=1.

See the attached example.  Look at "hist_cols.ncl" and search for ";;;" and
you'll see where I hard-coded the change.

You may want to change this to something else, but make sure to also change
trYMinF in the hist_log_example.ncl script.

--Mary




On Tue, Dec 12, 2017 at 6:38 AM, Kreienkamp Frank <Frank.Kreienkamp at dwd.de>
wrote:

> Hello,
>
>
>
> i am trying to change the y-axis in a gsn_histogram towards a log style.
> But I am failing. Neither tmYLStyle, trYLog and xyYStyle is working.
>
> What is the correct name?
>
>
>
> The version I use is NCL6.2.1.
>
>
>
> Thanks in advance
>
> Frank
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> 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/20171212/d35e08a9/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: histo.000003.png
Type: image/png
Size: 34542 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171212/d35e08a9/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hist_log_example.ncl
Type: application/octet-stream
Size: 420 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171212/d35e08a9/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hist_cols.ncl
Type: application/octet-stream
Size: 6477 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171212/d35e08a9/attachment-0003.obj>


More information about the ncl-talk mailing list