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: Q on Graph Combine: how to put 3 or less graphs on a 2x3 format (leaving multiple holes)


From   Maarten Buis <[email protected]>
To   [email protected]
Subject   Re: st: Q on Graph Combine: how to put 3 or less graphs on a 2x3 format (leaving multiple holes)
Date   Thu, 15 Sep 2011 09:47:10 +0200

On Thu, Sep 15, 2011 at 5:03 AM, Sui Zhang wrote:
> We are trying to generate a number of graphs to the clients.
> To standardize, we are thinking of presenting the graphs in
> a 2x3 format. It works fine when there's 5 or 6 graphs <snip>
> However, if there's less than 4 figures, the graph combine
> command will expand the figures into 2x2 or 3x1, just to
> cover the entire sheet, which will result in un-standardized
> larger figures. <snip>

One option is to create a blank graph and add that at the places where
you want the holes.

The following works with my preferred scheme -lean1-
(<http://www.stata-journal.com/article.html?article=gr0002>):

*-------------------- begin example ----------------------
// create the substantive graphs
sysuse auto, clear
forvalues i = 1/5 {
	scatter price mpg if rep78 == `i', name(gr`i', replace)
}

// create a blank graph
twoway scatteri 1 1,               ///
       msymbol(i)                  ///
       ylab("") xlab("")           ///
       ytitle("") xtitle("")       ///
       yscale(off) xscale(off)     ///
       plotregion(lpattern(blank)) ///
       name(blank, replace)

// combine graphs
graph combine gr1 gr2 gr3 blank blank blank, ///
      rows(3) xsize(8) ysize(10.5)           ///
      t("half page of 3 figures")
*-------------------- end example ----------------------
(For more on examples I sent to the Statalist see:
http://www.maartenbuis.nl/example_faq )

In other schemes you may need to play around with -plotregion()- and
-graphregion()- options to make the blank graph blend away in the
background.

Hope this helps,
Maarten

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany


http://www.maartenbuis.nl
--------------------------
*
*   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