[ncl-talk] histogram

Carl Schreck cjschrec at ncsu.edu
Tue Mar 3 07:23:15 MST 2015


Hi Laura,

I've done something similar recently, here's a snippet of the code:
-----
  retVal = gsn_histogram( io_wks, stormWaveData at allCrestLag, res )

  midSignif = avg( retVal at NumInBins )

  getvalues retVal
    "trYMaxF" : trYMaxF
  end getvalues

  major = nice_mnmxintvl( 0, 100. * trYMaxF / midSignif, 6, True )
  minor = nice_mnmxintvl( major(0), major(1), 30, True )
  print( major + " " + minor )
  yrLabels = cspan( major(0), major(1), major(2) )
  yrMinor = cspan( major(0), major(1), minor(2) ) * midSignif / 100
  yrValues = yrLabels * midSignif / 100

  setvalues retVal
    "tmYUseLeft"      : False
    "tmYRLabelsOn"    : True
    "tmYRMode"        : "Explicit"
    "tmYRValues"      : yrValues
    "tmYRLabels"      : yrLabels
    "tmYRMinorValues" : yrMinor
  end setvalues
-----
cspan mentioned here is my alternative to fspan that lets you pick the
interval. The code for cspan is here:
https://k3.cicsnc.org/carl/carl-ncl-library/blob/master/lib.array.ncl

Hope this helps!

    Carl

On Mon, Mar 2, 2015 at 1:10 PM, Laura Fowler <laura at ucar.edu> wrote:

> Hello:
> I would like to change the labels of the major tick marks on the left
> and right axis of a histogram, but not sure how to do this.
>
> On the left y-axis, the frequency varies from 0.0x10^7 to 1.5x10^7. I
> would like the labels to vary between 0.0 and 1.5 and the title of the
> left y-axis be "FREQUENCY (x 10^7)" instead without changing the shape
> of the histogram, of course.
>
> On the right y-axis, I would like to change the title to simply
> 'PERCENT" instead of "Percent (missing values not counted)" and only
> have major tick marks every 10 percent.
>
> Not sure how to proceed and would love some hints on what to do next.
>
> Thanks,
> Laura
>
>
>
> --
>
> !-------------------------------------------------------------------------------------------------------------
> Laura D. Fowler
> Mesoscale and Microscale Meteorology Division (MMM)
> National Center for Atmospheric Research
> P.O. Box 3000, Boulder CO 80307-3000
>
> e-mail: laura at ucar.edu
> phone: 303-497-1628
>
>
> !-------------------------------------------------------------------------------------------------------------
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>



-- 

<http://www.cicsnc.org/>
<http://www.researcherid.com/rid/B-8711-2011>
* Cyclone <http://www.cyclonecenter.org/>*Center.org
<http://www.cyclonecenter.org/>  *Carl J. Schreck III, PhD*
*Research Associate*
Cooperative Institute for Climate and Satellites NC <http://www.cicsnc.org/>

North Carolina State University <http://ncsu.edu/>
NOAA's National Climatic Data Center <http://ncdc.noaa.gov/>
151 Patton Ave, Asheville, NC 28801
e: cjschrec at ncsu.edu
o: +1 828 257 3140
Publications
<http://scholar.google.com/citations?hl=en&user=th8ONEcAAAAJ&view_op=list_works&sortby=pubdate>
monitor.cicsnc.org/mjo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150303/2d0e00dd/attachment.html 


More information about the ncl-talk mailing list