Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Adding lines to graphs

From   Ulrich Kohler <>
Subject   Re: st: Adding lines to graphs
Date   Fri, 11 Nov 2005 09:14:10 +0100 wrote:
> I have a series of interconnected monotonically declining plots that I am
> presenting as a single connected line graph, i.e., a graph that starts
> relatively high on the y axis, declines, jumbs vertically to a second high
> point, declines again,etc (substantively describes a relationship between
> varying values of a hazard ratio and age). I can't figure out how to add a
> line going from the 0 point on the x axis to the initial value of the
> graph. I would be most appreciative of any suggestions. Thanks

I think you need to generate an observation with x=0. 
Assuming that the y-value for x=0 should be y=0:

. set obs `=_N+1'
. replace x = 0 in `=_N'
. replace y = 0 in `=_N'
. connected y x, sort

Or, if your dataset contains only x and y:

. input
.  0 0
.  end
. connected y x, sort

many regards

+49 (030) 25491-361
*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index