help for sqr

Make graphs square - or any other shape

sqr graph_command varlist [if exp] [in range] [[weight]] [ , aspectratio(#) graph_command_options ]

Note: This program requires Stata 7 as a minimum. In Stata 8 and up, it applies only to old-style graphs produced by gr7. The only reason to try to use it in Stata 8 and up is to apply it to such graphs, in which case graph here should be understood as gr7. Otherwise, find the aspectratio() option.


sqr is a command prefix to place before any graph command to make graphs square. Optionally, other aspect ratios may be specified. For example, many time series plots look better with low aspect ratios such that individual line segments are closer to 45 degrees from horizontal.


sqr works by using the bbox() option of graph. This will be possible so long as either (1) graph_command is itself graph or (2) it is set up to call graph with any user-specified options of graph, and does not specify bbox() itself.

sqr does not control the shape of the data region, but the shape of the whole graph image. Nor is any adjustment made to (e.g.) size or positioning of lettering.


aspectratio(#) specifies an aspect ratio (height / width) for the total graph image. In practice, aspect ratios between about 0.2 and 2 are possible. The default is 1 (square).

graph_command_options are whatever options apart from bbox() are allowed with graph_command.

Examples (Stata 7)

. sqr graph mpg, by(foreign) box

. sqr tsgraph vol, a(0.4)

. for num 0.2(0.1)2, pause: sqr graph mpg weight, a(X)


Nicholas J. Cox, University of Durham, U.K. n.j.cox@durham.ac.uk

Also see

On-line: help for gph Manual: [G] gph (Stata 7 only) FAQ: http://www.stata.com/support/faqs/graphics/sqgraph.html