Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: combining graphs & legends

 From Nick Cox To statalist@hsphsun2.harvard.edu Subject Re: st: combining graphs & legends Date Sun, 16 Oct 2011 10:40:49 +0100

```Or use the -ycommon- option of -graph combine-.

On Sun, Oct 16, 2011 at 10:33 AM, Nick Cox <njcoxstata@gmail.com> wrote:
> I am not quite sure what your problem is, but -grc1leg- like any
> program just does what it does. It is not an all-purpose program to
> fix what wasn't fixed earlier. If you want different graphs to have
> the same axis range, ensure that before combining.
>
> Nick
>
> On Sun, Oct 16, 2011 at 9:49 AM, Lars Folkestad
>> Problem with grc1leg is that it makes a combines The graphs but leaves all y-axis with ranges.
>>
>> Is there a grc1leg with equal range?
>
>  Den 16/10/2011 kl. 10.28 skrev "Nick Cox" <njcoxstata@gmail.com>:
>
>>> Try
>>>
>>> grc1leg from http://www.stata.com/users/vwiggins
>>>    grc1leg.  Combine graphs into one graph with a common legend. / Program by
>>>    Vince Wiggins, StataCorp <vwiggins@stata.com>. / Statalist distribution,
>>>    16 June 2003. / Exactly like -graph combine- but shows a single common
>>>    legend for all / combined graphs. / Distribution-Date: 02jun2010
>>>
>>>
>>> . findit grc1leg
>>>
>>> Nick
>>>
>>> On Sun, Oct 16, 2011 at 7:55 AM, Richard Hiscock
>>> <rhiscock@netspace.net.au> wrote:
>>>> Hello,
>>>>
>>>> I am trying to combine two two-way graphs (see attached code)
>>>> where both y & x axes are of the same scale & a legend details
>>>> the meaning of the plots.
>>>> I have tried attempted to use graph combine command however it
>>>> doesn't appear to have a legend option and if I attempt to
>>>> combine one graph with & one without the legend no legend
>>>> appears in the combined graph. I can combine two graphs both
>>>> with a legend but this should not be required as they are the
>>>> same. I have attempted to use either the note or caption
>>>> option to generate a legend however keyboard symbols do not
>>>> replicate the linepatternstyles that I have used or are
>>>> likely to use.
>>>> Any guidance would be much appreciated.
>>>> thanks
>>>> Richard Hiscock
>>>>
>>>>
>>>>
>>>> **ANTERIOR
>>>>
>>>> twoway  (scatter t_mean gest_w if plac_postfund ==0,///
>>>>                ylabel(0(10)60) scheme(lean2)) ///
>>>>                (lfit llc5a gest_w,lpattern(dot)) ///
>>>>                (lfit ulc5a gest_w, lpattern(dot)) ///
>>>>                (lfit llc95a gest_w, lpattern(dot)) ///
>>>>                (lfit ulc95a gest_w,lpattern(dot))  ///
>>>>                (lfit c95a gest_w,lpattern(shortdash_dot)) ///
>>>>                (lfit c5a gest_w, lpattern(shortdash_dot)) ///
>>>>                (lfit xba gest_w, lpattern(longdash_dot)) , ///
>>>>                l2title("Placental thickness (mm)") xtitle("")  ///
>>>>                b2title("Gestation (weeks)") ///
>>>>                title("") ///
>>>>                name(antall)
>>>>
>>>> **POSTERIOR
>>>>
>>>> twoway  (scatter t_mean gest_w if plac_postfund ==1,///
>>>>                 ylabel(0(10)60) scheme(lean2)) ///
>>>>                (lfit llc5p gest_w,lpattern(dot)) ///
>>>>                (lfit ulc5p gest_w, lpattern(dot)) ///
>>>>                (lfit llc95p gest_w, lpattern(dot)) ///
>>>>                (lfit ulc95p gest_w,lpattern(dot))  ///
>>>>                (lfit c95p gest_w,lpattern(shortdash_dot)) ///
>>>>                (lfit c5p gest_w, lpattern(shortdash_dot)) ///
>>>>                (lfit xbp gest_w, lpattern(longdash_dot)) , ///
>>>>                l2title("Placental thickness (mm)") xtitle("") ///
>>>>                b2title("Gestation (weeks)") ///
>>>>                title("") ///
>>>>                legend(label(1 "measured thickness") label(2 "") ///
>>>>                label(3 "") label(4 "") label(5  "95% Confidence Limit") ///
>>>>                label(6 "90% Reference Interval") label(7 "") //
>>>>                label(8  "Predicted Mean") order(1 8 6 5)) ///
>>>>                name(postall)
>>>>
>>>>
>>>> graph combine antall.gph postall.gph,   iscale(0.8) ///
>>>>                ycommon xcommon ///
>>>>                note(o measured thickness   --.--  Predicted mean  ///
>>>>                 -.-.-.-  95th centile  95%CI for centile )
>>>>
>

*
*   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/
```