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   Ulrich Kohler <[email protected]>
To   [email protected]
Subject   Re: st: Adding a line to a scatter plot
Date   Tue, 29 Mar 2011 15:52:31 +0200

There might be easier solutions, but here is one possibility

--------------------------------tryit.do
sysuse auto, clear
sum mpg, 
local y= r(mean)
sum weight
local x = r(mean)

twoway                            ///
 || scatter mpg weight            ///
 || function y = 0 + `y'/`x' * x, range(0 `x')

-----------------------------------------------


Am Dienstag, den 29.03.2011, 09:41 -0400 schrieb Data Analytics Corp.:
> Hi,
> 
> 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?
> 
> Thanks,
> 
> Walt
> 
> ________________________
> 
> Walter R. Paczkowski, Ph.D.
> Data Analytics Corp.
> 44 Hamilton Lane
> Plainsboro, NJ 08536
> ________________________
> (V) 609-936-8999
> (F) 609-936-3733
> [email protected]
> www.dataanalyticscorp.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