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

st: added line in front of area shading

From   Roger Harbord <>
To   Statalist <>
Subject   st: added line in front of area shading
Date   Thu, 24 Jun 2004 17:18:42 +0100

I'm using a command that produces something similar to:

. twoway lfitci mpg headroom , yline(20)

However I want the added line to go in front of the shaded area, not behind (because in my real graph i truncate the CI if it crosses the reference line so the reference line then forms the boundary, so it looks silly if it disappears - the real graph uses twoway rarea but this gives the idea).

After looking at -help added_line_options- I assumed that

. twoway lfitci mpg headroom , yline(20, lstyle(foreground))

- might do the trick, but no luck.

Clearly I can do something like

. gen refline = 20
. twoway lfitci mpg headroom || line refline headroom, clstyle(foreground)
. drop refline

- but then the line only extends over the range of the data, not the range of the x-axis (in my real example it looks worse).

(Apologies if this has been asked before on Statalist - i have a very vague memory that it might have been but I had a look in the archives and couldn't find anything.)

Roger Harbord
Department of Social Medicine, University of Bristol

* For searches and help try:

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