Re: st: plot 3 normal distribution on one graph

Dear Sylvain and Phil,
Thank you very much for your reply. It solves the problem! I always
test my codes line-by-line in the command window before writing it in
a do.file (because I like to call a variable by clicking on it ) and
did not realize it could make a difference.
After seeing your reply, execute my do-file and it works perfect.
Thanks!
Best,
Yannan
On Tue, Nov 6, 2012 at 1:52 AM, Phil Clayton
<philclayton@internode.on.net> wrote:
> The -#delimit- command can only be run from a do-file or ado-file. See -help delimit-
>
> So I would recommend trying the code from the do-file editor. It works for me.
>
> Phil
>
> On 06/11/2012, at 5:24 PM, yannan shen <yannan2010@gmail.com> wrote:
>
>> Dear statalist,
>> I need to plot three normal distributions on one graph, I want them to
>> be over each other, not side by side.
>> The three distributions are:
>> y1~norm(1, 2)
>> y2~norm (3, 4)
>> y3 is a weighted average of y1 and y2, let's say y3=.5*y1+.5*y2
>>
>> I found the following code from previous statalist discussion that
>> looks very helpful:
>>
>> /* Plot two normal distributions */
>> #delimit ;
>> graph twoway (function y=normalden(x,1,2), range(-10 20) lw(medthick))
>> (function y=normalden(x,5,3), range(-10 20) lw(medthick)),
>> title("Normal-Distribution comparison")
>> xtitle("Normal", size(medlarge)) ytitle("")
>> xlabel(-10(2)20)
>> xscale(lw(medthick)) yscale(lw(medthick))
>> legend(off)
>> graphregion(fcolor(white));
>> #delimit cr
>> /* Stata code ends */
>>
>> However, I copied and pasted the exact code into stata command window
>> and the first line returns an error message "Unknown #command"
>>
>> Why??? I googled the error message but was not able to find a
>> solution. I cleared the program history, closed and reopned stata, and
>> tried on different computers, but was unable to find spot the problem.
>> Can someone please help me? I am using stata IC 12.0
>>
>> Thank you very much!
>> *
>> * For searches and help try:
>> * http://www.stata.com/help.cgi?search
>> * http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/