Re: Histogram questions - transparent fill? bar distance?

From: Arindam Chakraborty <arch_at_nyahnyahspammersnyahnyah>
Date: Tue, 20 Jan 2009 23:21:02 +0530

hi Michel,
 I'm attaching a function bar.ncl using which you can overlap two bars
(setting barGap a negative value). See inside the function for further
documentation. Not all the features are described although. I'm sure, many
improvements and changes can be made (and fix possible bugs) to this function.
This function and Mary's suggestions together might solve your problem. A
sample file (bartest.ncl) is also attached documenting the use of this function.

regards,

arindam

--
ARINDAM CHAKRABORTY
---------- Original Message -----------
From: Mary Haley <haley_at_ucar.edu>
To: Michel dos Santos Mesquita <michel_at_iarc.uaf.edu>
Cc: ncl-talk_at_ucar.edu
Sent: Tue, 20 Jan 2009 09:05:13 -0700 (MST)
Subject: Re: Histogram questions - transparent fill? bar distance?
> On Sun, 18 Jan 2009, Michel dos Santos Mesquita wrote:
> 
> > Hi everyone,
> >
> > I am creating two histograms plotted in the same figure in NCL (using two
> > dataset values per bin in the histogram) - like this NCL example:
> > www.ncl.ucar.edu/Applications/Images/histo_6_lg.png
> >
> > I have two questions about that:
> >
> > 1) Is there a way for me to change the distance between the two column
> > bars (in each bin)? - that is, instead of plotting one behind the other, I
> > would like to plot them one next to the other.
> 
> Hi Michel,
> 
> The histogram plots have very limited capability, and there's no way
> to do this with two plots that are being compared.  However, see
> my answer to #2.
> 
> > 2) I have attached a figure which was created in another program. I would
> > like to reproduce that figure in NCL. Two histograms shown in the same
> > plot: one in the background in gray color. The other in the foreground
> > using transparent fill. Is that possible in NCL? How?
> 
> First, NCL cannot do transparent color, although this is something
> we're working on.
> 
> To do the kind of plot you want, I would call gsn_histogram twice,
> drawing each plot on the same page. To do this, you have to be
> careful that both plots use the same bin intervals, and have the
> same Y axis limits. Here's a sample script that should
> run as is:
> 
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> 
> ; Generate some random data.
> 
>    z1 = random_uniform(0,320.,500)
>    z2 = random_uniform(0,320.,700)
> 
> ; Open workstation
>    wks = gsn_open_wks("x11","histo")
> 
> ; Plot mods
>    res                             = True
>    res_at_gsnFrame                    = False   ; Don't advance frame
> 
>    res_at_trYMinF                     = 0.      ; Control limits for Y axis
>    res_at_trYMaxF                     = 110.
> 
>    res_at_gsnHistogramBinIntervals    = ispan(0,320,40)   ; self explanatory
> 
>    res_at_gsnHistogramBarWidthPercent = 100.     ; Bars will be touching
>    res_at_gsFillColor                 = "gray"
> 
>    plot = gsn_histogram(wks,z1,res)
> 
>    res_at_gsFillColor                 = "transparent"
> 
>    plot = gsn_histogram(wks,z2,res)
> 
>    plot = gsn_histogram(wks,z2,res)
>    frame(wks)
> end
> 
> --Mary
> 
> > I thank you in advance!
> >
> > Regards,
> >
> > Michel
> > -- 
> > Michel Mesquita
> > PhD Student
> > UAF/IARC
> > michel_at_iarc.uaf.edu
> >
> >
> > -----------------------------------------
> > This email was sent using SquirrelMail.
> >   "Webmail for nuts!"
> > http://squirrelmail.org/
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
------- End of Original Message -------
-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Tue Jan 20 2009 - 10:51:02 MST

This archive was generated by hypermail 2.2.0 : Wed Jan 21 2009 - 13:09:22 MST