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: RE: adding line y=x


From   Jeph Herrin <[email protected]>
To   [email protected]
Subject   Re: st: RE: adding line y=x
Date   Fri, 25 Jun 2010 14:36:52 -0400

Thanks Nick and Ivana. -function- is exactly what I was looking for.

cheers,
Jeph

On 6/25/2010 9:25 AM, Ivana Templado wrote:
Jephs, try with

twoway scatter var1 var2 || function y = x, ra(var1) clpat(dash)

I found it looking for something else, but I think it is what are you
looking for.
Ivana

-----Mensaje original-----
De: [email protected]
[mailto:[email protected]] En nombre de Jeph Herrin
Enviado el: Viernes, 25 de Junio de 2010 10:06 a.m.
Para: [email protected]
Asunto: st: adding line y=x


Is there an easier way to do this? I am trying to
add the canonical line y=x to a twoway scatter plot
of -var2- vs -var1-; here's the briefest approach:

    twoway (scatter var2 var1) (line var2 var2)

The biggest problem with this is that -var1- and -var2- range
from about 2 up to 20, whereas I'd like my line to extend
from the origin (0,0). To do that, I have to add an observation
which contains the origin, and then arrange things so that
the observation is excluded from the scatter plot. The other
problems stem from overlaying two graphs, which means that
for example I have to fiddle with the labelling on the yaxis,
because -twoway- doesn't give precedence to the -scatter- plot.

Is there not a simpler way to simply add the diagonal to
a scatter plot? If not, I would suggest that this would be
a useful feature, much like -yline(), -xline(), and -tline()-
which add vertical and horizontal lines.

cheers,
Jeph

*
*   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/


__________ Information from ESET NOD32 Antivirus, version of virus signature
database 5226 (20100624) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


*
*   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