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: Adding a line to a scatter plot


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: Adding a line to a scatter plot
Date   Tue, 29 Mar 2011 14:53:31 +0100

Here is one way to do it:

sysuse auto
su weight, meanonly
local mean_w = r(mean)
su length, meanonly
local mean_l = r(mean)
sc weight length || scatteri 0 0 `mean_w' `mean_l', recast(line)

Nick

On Tue, Mar 29, 2011 at 2:41 PM, Data Analytics Corp.
<[email protected]> wrote:

> I created a simple scatter plot but now I would like to add a ray from the
> origin that goes through the point defined by mean X and mean Y.  The two
> line options xline and yline are for vertical and horizontal lines,
> respectively.  I don't see how to draw a line from the origin through a
> specific point.  Any suggestions?

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