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

Re: st: graph, by and xline options


From   vwiggins@stata.com (Vince Wiggins, StataCorp)
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: graph, by and xline options
Date   Mon, 16 Jun 2003 17:09:42 -0500

Daniel Millimet <millimet@mail.smu.edu> 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 <smerryman@kc.rr.com> 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
wants.  

-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 http://www.stata.com
    . net cd users
    . net cd vwiggins
    . net install grc1leg


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


-- Vince 
   vwiggins@stata.com

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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