Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

st: graph rarea optical illusion or coding error?

From   Ulrich Kohler <>
To   statalist <>
Subject   st: graph rarea optical illusion or coding error?
Date   Wed, 11 May 2011 14:02:43 +0200


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.
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)


*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index