Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down at the end of May, and its replacement, **statalist.org** is already up and running.

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

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: adding line y=x |

Date |
Fri, 25 Jun 2010 14:14:28 +0100 |

su var1, meanonly twoway (scatter var2 var1, ytitle(`: var label var2') xtitle(`: var label var1')) (function equality = x, ra(0 `=r(max)')) -twoway function- is odd. -x- is a placeholder for the x-axis variable. I tend to use some nonce name for the y variable like "equality" because that then becomes the legend default. Nick n.j.cox@durham.ac.uk Jeph Herrin 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. * * 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/

**Follow-Ups**:**Re: st: RE: adding line y=x***From:*Clive Nicholas <clivelists@googlemail.com>

**References**:**st: adding line y=x***From:*Jeph Herrin <junk@spandrel.net>

- Prev by Date:
**st: adding line y=x** - Next by Date:
**st: combining data on same case from different lines** - Previous by thread:
**st: adding line y=x** - Next by thread:
**Re: st: RE: adding line y=x** - Index(es):