# Re: st: legend in the hole for combined graph

 From Ulrich Kohler To statalist@hsphsun2.harvard.edu Subject Re: st: legend in the hole for combined graph Date Mon, 30 Mar 2009 17:46:42 +0200

```I don't know whether there is an easy way.

You can produce a figure holding nothing else than the legend and treat
this figure as one graph amongst the others in -graph combine-. Here is
an example that shows the general principle, although it originally
served a different purpose:

-----------------------------------------------------example.do
sysuse auto, clear
separate mpg, by(rep78)

sc mpg1 mpg2 mpg3 mpg3 mpg4 mpg4 mpg5 mpg5 weight,             ///
ms(Oh O Oh o Oh + O +)                                     ///
mcolor(black..)                                            ///
msize(*1.5 *1.5 *1.5 *.5 *1.5 *1.5 *1.5 *1.5)              ///
legend(off) name(data, replace) nodraw

tw scatteri 2 1 (3) "Very Low", ms(Oh) mcolor(black) msize(*1.5)       ///
|| scatteri 2 2 (3) "Low", ms(O) mcolor(black) msize(*1.5)             ///
|| scatteri 2 3 (3) "Intermediate", ms(Oh) mcolor(black)  msize(*1.5)  ///
|| scatteri 2 3, ms(o) mcolor(black) msize(.3) msize(*.5)              ///
|| scatteri 1 1 (3) "High" , ms(Oh) mcolor(black) msize(*1.5)          ///
|| scatteri 1 1, ms(+) mcolor(black) msize(*1.5)                       ///
|| scatteri 1 2 (3) "Very High", ms(O) mcolor(black)  msize(*1.5)      ///
|| scatteri 1 2, ms(+) mcolor(white) msize(*1.5)                       ///
|| , legend(off) xscale(off range(0.5 4.5)) ylabel(, nogrid)           ///
yscale(off) fysize(10) name(g2, replace) nodraw

graph combine data data data g2, rows(2) iscale(*1.3)
--------------------------------------------------------example

Many regards
Uli

Am Montag, den 30.03.2009, 08:24 -0700 schrieb Lloyd Dumont:
> Hello.  Is there an easy way to combine graphs using either graph combine or grc1leg, but putting the resulting legend in the hole?  For example, imagine a 4-panel graph with graphs in 3 of the 4 panels, and then a legend in the 4th panel?
>
> Thank you.  Lloyd
>
>
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
--
kohler@wzb.eu
030 25491-361

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```