Statalist The Stata Listserver


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

Re: st: Unwanted margins with spmap


From   "Friedrich Huebler" <[email protected]>
To   [email protected]
Subject   Re: st: Unwanted margins with spmap
Date   Wed, 13 Jun 2007 14:55:12 -0400

Scott,

Thank you for the detailed analysis. Your edit at line 1440 (not 1404)
in spmap.ado removes the unwanted margins but as a result maps shrink
along the north-south axis. The map of Italy in my example is
noticeably distorted and becomes more wide than tall when the edited
spmap.ado is used. This also happens with other maps that I tested. It
seems that the -aspect()- option in the -graph twoway- command is
needed to produce maps with correct dimensions.

Friedrich

On 6/13/07, Scott Merryman <[email protected]> wrote:
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-)

... [snip] ...

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