Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: graph rarea optical illusion or coding error?


From   Ulrich Kohler <[email protected]>
To   [email protected]
Subject   Re: st: graph rarea optical illusion or coding error?
Date   Wed, 11 May 2011 15:29:23 +0200

Scott, Philippe,

thanks for your answers. They helped me to find the following solution
which works good enough for me. I now use -fintensity()- directly
instead of fcolor(). 

-----------------------------------------------------------
sysuse auto, clear

collapse (mean) mean=mpg (semean) se=mpg, by(rep78)

forv alpha = 1(1)95 {
	gen ub`alpha' = mean + invnormal(1-(`alpha'/100)/2)*se
	gen lb`alpha' = mean - invnormal(1-(`alpha'/100)/2)*se
}

forv i = 1(1)95 {
	  local rarea `rarea'	       ///  
	  || rarea ub`i' lb`i' rep78,  ///		
	  fintensity(`i') fcolor(black) lcolor(black*`=`i'/100') sort
}

graph twoway `rarea' || , legend(off)

exit
-----------------------------------------------------------------------



Am Mittwoch, den 11.05.2011, 08:04 -0500 schrieb Scott Merryman:
> The scheme as a default intensity of 80% or if you open on the graph
> in the Editor you can see that the fill intensity is 80%.
> 
> It appears adding -fin(100)- seems to help.
> 
> Regarding the -lcolor(none)- removing the area completely - if there
> is no outline then there is no interior defined by the outline (see
> http://www.stata.com/statalist/archive/2003-05/msg00685.html).
> 
> Scott
> 
> On Wed, May 11, 2011 at 7:02 AM, Ulrich Kohler <[email protected]> wrote:
> > Listers,
> >
> > I try to create a figure of shaded areas for 5%, 10%, 15% ... 95%
> > confidence intervals. The resulting areas seem to have a lines around
> > the areas that are darker than both neighbouring areas. Is it possible
> > to get rid of this, or is this just an optical illusion?
> >
> > Here is a minimal example of my code. Note that I tried various settings
> > for -lwidht()- , -lcolor()-, -fintensity()-. Most surprisingly
> > -lcolor(none)- removes areas completely, btw.
> >
> > -----------------------------------------------------illusion.do
> > sysuse auto, clear
> >
> > collapse (mean) mean=mpg (semean) se=mpg, by(rep78)
> >
> > local pen 15
> > forv alpha = .05(.06).95 {
> >        gen ub`pen' = mean + invnormal(1-`alpha'/2)*se
> >        di "gen ub`pen' = mean + `=invnormal(1-`alpha'/2)'*se"
> >        gen lb`pen' = mean - invnormal(1-`alpha'/2)*se
> >        local pen = `pen'-1
> > }
> >
> > forv i = 15(-1)1 {
> >          local rarea `rarea'          ///
> >          || rarea ub`i' lb`i' rep78,  ///
> >          lcolor(gs`i') fcolor(gs`i') lwidth(none) sort
> > }
> >
> > graph twoway `rarea' || , legend(off)
> >
> > exit
> > -------------------------------------------------------------------
> >
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index