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: line options for overlayed twoway kdensity plots
From
Austin Nichols <[email protected]>
To
[email protected]
Subject
Re: st: line options for overlayed twoway kdensity plots
Date
Sun, 28 Nov 2010 22:03:41 -0500
Chris Hajzler <[email protected]>:
Are you reading the help files that came with your Stata 8 (just type
-whelp-), or the help files for Stata 11 on the web?
This is for Stata 8 (well, 8.2 --note the free -update- via the web):
sysuse auto, clear
ren mpg x
ren foreign z
tw kdensity x if !z, clc(red)||kdensity x if z
kdensity x, nogr gen(a f)
kdensity x if !z, nogr gen(f0) at(a)
kdensity x if z, nogr gen(f1) at(a)
line f0 f1 a, clc(red black) name(l)
and this is for Stata 11.1:
sysuse auto, clear
ren mpg x
ren foreign z
tw kdensity x if !z, lc(red)||kdensity x if z
kdensity x, nogr gen(a f)
kdensity x if !z, nogr gen(f0) at(a)
kdensity x if z, nogr gen(f1) at(a)
line f0 f1 a, lc(red black) name(l)
On Sun, Nov 28, 2010 at 7:02 PM, Chris Hajzler <[email protected]> wrote:
> Dear Statalist,
>
> I am trying to change the line options (color, pattern) in an
> overlayed kernel density plot using Stata version 8.
>
> I have generated these plots using a command along the following lines:
>
> twoway (kdensity x1 if (z==1), xscale(r(-1.7(0.5)1.7))) (kdensity x1
> if (z==2), xscale(r(-1.7(0.5)1.7))), ytitle("stuff")
>
> According to online Stata help files, " cline_options" are available
> options using kdensity, such as lcolor and lpattern, but I am having
> trouble figuring out how to include these options (or if, perhaps,
> these options can only be used on more recent versions of Stata). For
> instance, if I try including "color(black)" or "lcolor(black)" as
> either right before or right after the xscale option, I receive the
> error message "option lcolor() not allowed". (I know the density
> function may not qualify as a line graph, so I have tried with and
> without the "l" prefix, but this has not worked either.)
>
> Does anyone know how I might change the density line colors/patterns?
>
> Thanks in advance,
> Chris
*
* 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/