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 as is without resizing.


From   [email protected] (Vince Wiggins, StataCorp)
To   [email protected]
Subject   Re: st: Combining graphs as is without resizing.
Date   Tue, 23 Jul 2013 16:25:27 -0500

Paul <[email protected]> writes that my solution for combining two
graphs "asis" without resizing did not work.

He's right again, it doesn't work, and it particularly doesn't work
when you have legends and are specifying aspect(1), as Paul is.  I
wasn't careful enough with my first "solution".

Here s a modified suggestion,

    . graph combine a b, cols(1) iscale(.7273) ysize(8) 
                         graphregion(margin(zero))

Where: 

    -- a and b        are the names of the original graphs

    -- cols(1)        requests a single column for the two subgraphs

    -- iscale(.7273)  specifies a rescaling of the fonts on the
                      combined graph

    -- ysize(8)       specifies that the graph be 8 inches 
                      high -- twice the height of a default Stata graph.  
		      Paul should substitute twice his original graph 
		      heights for "8"

    -- graphregion(margin(zero))  removes the extra margins around the
                                  combined graph.

What is ".7273"??  

Assuming your final graph will be taller than it is wide and that your
original graphs were wider than the were tall,

        iscale  =  ysize / xsize  =  4 / 5.5  ~=  .7273

Where ysize is the height of the original graph and xsize is the width
of the combined graph.

Paul should substitute the dimensions from his graphs.

Why "ysize / xsize"?  (Warning technical explanation coming.)  The size
of text, markers, and other graph elements are determined relative to
the smaller dimension of the graph -- in this case the ysize.  So, a
textsize of "medium" maps to 3.8194 which implies that the text height
is 3.82% of the smaller of xsize and ysize.

This method of determining relative sizes works pretty well in a most
situations.  It works so well that we rarely get questions like Paul's.
That said, I too sometimes want the kind of exact control that Paul is
asking for.

The sizes of all elements on our original graphs are derived relative
to the ysize of the graph (the smaller of the two dimensions).  The
sizes of the same elements on our combined graph are derived relative
to xsize of that graph (the smaller of the two dimensions for the
combined graph).  If we want the sizes on the combined graph to match
those of the original graph we will need to scale those sizes by the
ratio of dimensions used to scale the sizes on the two graphs -- the
ysize of our original graph (4) and the xsize of our combined graph
(5.5).

There is still a very small differences because we have only partially
adjusted for the margins on the combined graph.  It is all-but
undetectable on the graphs I have been drawing to test the suggestion
above.


-- Vince 
   [email protected]

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


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