Bookmark and Share

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]

Re: st: graph: how to draw 45 degree reference line


From   Friedrich Huebler <fhuebler@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: graph: how to draw 45 degree reference line
Date   Mon, 15 Mar 2010 11:12:58 -0400

Nick's proposal can be modified to avoid having to specify the precise
coordinates of the line, an issue addressed by Dave earlier in this
thread. I assume that the line always start at the origin.

. sysuse auto
. sum weight, meanonly
. local max = r(max)
. sum price, meanonly
. if r(max) > `max' {
  local max = r(max)
  }
. scatter weight price || scatteri 0 0 `max' `max', recast(line) name(a)
. scatter price weight || scatteri 0 0 `max' `max', recast(line) name(b)

Friedrich

On Mon, Mar 15, 2010 at 8:06 AM, Nick Cox <n.j.cox@durham.ac.uk> wrote:
> [...]
>
> However, there is yet another way to do it:
>
> . sysuse auto
>
> . scatter weight price || scatteri 0 0 15000 15000, recast(line)
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index