help drarea

Title

Draw an overlapping range area plot

Syntax

drarea hi1 lo1 hi2 lo2 x
[, options]

Main
color(colorstylelist) specifies the two colours for the two separate range areas.

add specifies that markers are plotted in addition to the range plots.

twoway() specifies that the user adds another twoway graph to the plot.

twoway_options specifies additional options in the graphic.

Description

Multiple graphics are produced in Stata by the rule "last drawn first seen". So the objects that are drawn last are the ones that
are observed. The implication of this principle is that when overlapping two rarea graphs the overlapping area is hidden by the second rarea graph.
This command drarea overlays two range area plots by merging the two colours and hence highlighting the true overlap. There are numerous
graphics that could benefit from the same principles but at the moment the graphics engine does not remember what is beneath the plots that are
observed.

drarea is short for double rarea plot

Options

Main

color(colorstylelist) specifies the two colours for the two separate range areas. The option requires the same colorstyle be used
and can handle both the words or the RGB format (CYMK is not supported at the moment). Note: if a third colour is specified then this
will be the colour of the overlapping area.

add specifies that markers are plotted in addition to the range plots.

twoway(twoway commands) specifies that the user adds other twoway graphs to the plot.

Examples

By using a Stata dataset and generating some new random highs and lows the drarea command shows off the basic plot.

sysuse sp500, clear

gen high2 = high+15*uniform()

gen low2 = low+15*uniform()

drarea high low high2 low2 date in 1/20

In this example two additional twoway plots are added. Note that each additional twoway graph must be enclosed with brackets

drarea high low high2 low2 date in 1/20, twoway((rspike high low date)(scatter high2 date, ms(green)))

To add a legend to the above graph add the following command, note the third graph is actually the overlapping range area and is dropped
from the order

drarea high low high2 low2 date in 1/20, twoway((rspike high low date)(scatter high2 date, ms(green))) legend(on order(1 2 4 5))

Author

Adrian Mander, MRC Biostatistics Unit, Cambridge, UK.

Email adrian.mander@mrc-bsu.cam.ac.uk

See Also

Related commands:

twoway rarea

Other Graphic Commands I have written:
trellis (if installed) ssc install trellis (to install this command)
cdfplot (if installed) ssc install cdfplot (to install this command)
contour (if installed) ssc install contour (to install this command)
surface (if installed) ssc install surface (to install this command)
batplot (if installed) ssc install batplot (to install this command)
plotbeta (if installed) ssc install plotbeta (to install this command)
graphbinary (if installed) ssc install graphbinary (to install this command)
palette_all (if installed) ssc install palette_all (to install this command)
plotmatrix (if installed) ssc install plotmatrix (to install this command)
metagraph (if installed) ssc install metagraph (to install this command)