Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Unwanted margins with spmap


From   "Scott Merryman" <[email protected]>
To   [email protected]
Subject   Re: st: Unwanted margins with spmap
Date   Wed, 13 Jun 2007 09:30:59 -0500

Friedrich,

The problem lies (I believe) with the aspect ratio.  Without a title,
in -spmap- the plot region is is the entire graph:   -spmap- will
define -xsize()-, -ysize()-, aspect ratio ysize/xsize,
graphregion(margin(zero), and plotregion(margin(zero) ).  When there
are no titles there is no inner graph region so the available graph
area is the plot region.  But when a title is specified, the graph
area is still defined by -xsize()- and -ysize()- but the title will be
placed in the inner graph region and compress the plot region.  To
maintain the specified aspect ratio with the fixed graph size margins
have to appear.

"Note that the overall size of the graph is not changed by the
aspectratio() option.  Thus constraining the aspect ratio will
generally leave some additional space around the plot region in either
the horizontal or vertical dimension. " (from -help aspect_ratio-)

This can be seen using the auto data set
----------------------------------------------------------
sysuse auto,clear

scatter mpg weight, graphregion(margin(zero) style(none)) ///
plotregion(margin(zero) ) ytitle("") ///
ylabel(none) xtitle("") xlabel(none) ///
xsize(4) ysize(4.5) scheme(s1mono) ///
name(gr1,replace)

scatter mpg weight, graphregion(margin(zero) style(none)) ///
plotregion(margin(zero) ) ytitle("") ///
ylabel(none) xtitle("") xlabel(none) ///
xsize(4) ysize(4.5) ///
title(Title, size(vhuge)) ///
subtitle(Subtitle, size(vhuge)) ///
scheme(s1mono) name(gr2,replace)

scatter mpg weight, graphregion(margin(zero) style(none)) ///
plotregion(margin(zero) ) ytitle("") ///
ylabel(none) xtitle("") xlabel(none) ///
xsize(4) ysize(4.5) ///
aspect(1.125) scheme(s1mono) ///
name(gr3,replace)

scatter mpg weight, graphregion(margin(zero)style(none)) ///
plotregion(margin(zero) ) ytitle("") ///
ylabel(none) xtitle("") xlabel(none) ///
title(Title, size(vhuge)) ///
subtitle(Subtitle, size(vhuge)) ///
xsize(4) ysize(4.5) ///
aspect(1.125) scheme(s1mono) ///
name(gr4,replace)

graph combine gr1 gr3 gr2 gr4, scheme(s1mono)

graph drop gr1 gr2 gr3 gr4

----------------------------------------------------------

If you zero out the aspect ratio then your second graph will not have
margins around the map when titles are used.  You could add:

local AR

to line 1404, just before the -graph twoway `GRAPH'...- statement.

I don't know if removing the AR will cause problems with other maps,
but It works for your example.

Scott
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index