Bookmark and Share

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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: combining graphs & legends


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: combining graphs & legends
Date   Sun, 16 Oct 2011 09:26:49 +0100

Try

grc1leg from http://www.stata.com/users/vwiggins
    grc1leg.  Combine graphs into one graph with a common legend. / Program by
    Vince Wiggins, StataCorp <[email protected]>. / Statalist distribution,
    16 June 2003. / Exactly like -graph combine- but shows a single common
    legend for all / combined graphs. / Distribution-Date: 02jun2010

Start with

. findit grc1leg

Nick

On Sun, Oct 16, 2011 at 7:55 AM, Richard Hiscock
<[email protected]> 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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index