[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: twoway area with no outline along the baseline

From   "Scott Merryman" <[email protected]>
To   [email protected]
Subject   Re: st: twoway area with no outline along the baseline
Date   Thu, 10 Jan 2008 20:11:05 -0600


Do you mean something like this?

sysuse auto,clear
qui {
set obs `=`=r(N)' + 2'
sum weight
replace wei = r(min) in `=r(N) + 1'
replace mpg = 0 in `=r(N) + 1'
sort weight mpg
sum weight
replace we = r(max) in l
replace mpg = 0 in l
twoway area mpg weight,sort  color(gs14) fin(100) ///
	|| line mpg weight ,sort lc(black) ///
	|| , legend(off)


On Jan 10, 2008 3:37 PM, Nick Winter (UVa) <[email protected]> wrote:
> Hi,
> As part of a more complex graph I'm trying to construct, I want to
> create a -twoway area- plot that lacks the outline along the baseline.
> THat is, I want the outline along the "peaks" of the area, as well as
> along the vertical drops down to the baseline at the minimum and maximum
> of the data, but I do not want the outline along the baseline itself.
> The two approaches that occur to me are:
> (1) overwrite the baseline with an appropriate -twoway line-, with the
> line color set to the fill color of the area plot.  THe problem here is
> that when the area plot gets very close to the baseline, the outline of
> the peaks can get overwritten as well if it is close enough to baseline
> at some point along the area.
> (2) create the area plot with no outline (that is, with the outline the
> same color as the fill), then create the outline with -twoway line-.
> This does not create the vertical drops to the baseline at the min and
> max of the data without adding fake observations.
> I could do (1) and then (2), using (2) to re-create the line wherever it
> might be overwritten in step (1), but that seems inelegant at best...
> Any other ideas?
> --Nick Winter
*   For searches and help try:

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