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

Re: st: graph, by and xline options

From (Vince Wiggins, StataCorp)
Subject   Re: st: graph, by and xline options
Date   Mon, 16 Jun 2003 17:09:42 -0500

Daniel Millimet <> wants to produce a combined graph with
a common legend,

> I am using the -twoway connected y x, by(var)- command to generate a
> graph with 9 individual plots (3x3).  That all works fine, but now I
> am trying to add xlines to each of the 9 plots, where the lines are
> drawn at different values for each plot.  Is t his possible?
> Looking at the axis_selection section of the manual does not seem to
> help when using the by option.

Scott Merryman <> suggests using -graph combine- rather
than -graph- with a -by()- option.  This is the best approach, because the
-by()- option does not allow different options to be sent to each graph, and
Dann wants each graph to have its own -xlines-.  As Dann notes, however, if he
creates separate graphs and then combines them, each graph has its own legend,
and he wants one common legend for all of the graphs.

I have wanted this too.

At this point, I don't want to overload the syntax of -graph combine- with
more options.  It strikes me that the syntax of -graph- is complicated enough
as is.  However, I have posted on my user site a command to do just what Dann

-grc1leg- (GRaph Combine with 1 LEGend) has almost exactly the same syntax as
-graph combine-; however, it lets you select a legend from one of the graphs
to be shown as the common legend.  It also turns the legends off on all of the
combined graphs.  It honors -position()-, -ring()-, and -span- options, so the
single legend can be positioned wherever desired.

To install grc1leg type

    . net from
    . net cd users
    . net cd vwiggins
    . net install grc1leg

Afterwords, type -whelp grc1leg- to find out more.

-- Vince

*   For searches and help try:

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