*! version 1.0.1 25jul2022
help resize

Title

resize -- Change the graph size but keep the font size unchanged

Syntax

resize [name] , xsize(sizelist) ysize(sizelist) [graph_display_options]

resizecombine [namelist] , xsize(sizelist) ysize(sizelist) [graph_combine_options]

resizec1leg [namelist] , xsize(sizelist) ysize(sizelist) [grc1leg_options]

options Description

ysize(sizelist) change height of graph. Enter in in cm (e.g. "9cm"), inch (e.g. "3.54inch") or other measures (see sizelist). This option is required.

xsize(sizelist) change height of graph. This option is required.

Description

resize, resizecombine, and resizec1leg keep the absolute font size (usually defined in pt) constant when changing the height and/or width of figures.
These commands help you control font sizes and keep them coherent across all your figures.

resize is an extension of graph display, resizecombine an extension of graph combine and resizec1leg an extension of grc1leg.

I recommend using these commands in combination with grstyle, in particular, grstyle set size. There, you can define the font sizes for all graph elements, see examples 2-4 below.

Background of the ado:

If you change the size of a figure using graph display or similar commands, Stata automatically rescales the font size in proportion to the minimum out of the figure's height and width. However, this is not desired in many situations.
When we want to increase the size of a figure, we often do so to fit more content into the figure. Stata's default rescaling counters that.
The new commands keep the absolute font size constant, meaning that we can increase (decrease) the figure's size if we want to show more (less) information in the figure.

Books, articles and other texts are usually coherent in their font size.
If different paragraphs or chapters were written in different font sizes, this would seem rather odd.
In figures, however, such inconsistencies in font size are common.
At least in social science journals, one often finds figures with very different font sizes, even in the same article.
As a result, some figures with small type are difficult to decipher, while other figures with too large type consume an unnecessary amount of space.
In publications in the natural science, such as Science or Nature, font sizes tend to be coherent within and between articles, which improves the reading experience.
The commands resize, resizecombine, and resizec1leg make it easier for researchers to control font sizes and create a set of figures that are coherent in their font sizes.

Options

ysize(sizelist)
and
xsize(sizelist)
specify the height and width of the entire graph. Internally, Stata uses inch, but you can specify sizes in centimeters (e.g. "9cm") or several other units.
For more information, see sizelist (package grstyle is required).
Both ysize(sizelist) and xsize(sizelist) need to be specified.

Remarks

Which font size to use?

Most social science journals have requirements concerning the font size of the main text, but not of the text in the figures. Journals in the natural sciences often require text in figures to be between 5 and 8pt.
Social science tend to use larger fonts for their main text than natural science journals.
To match that, figures for the social sciences might also use slightly larger fonts, for example between 7 and 9pt.

Which font to use?

Sans-serifs fonts, such as Arial or Helvetica, are preferable for figures because they are more readable in smaller font sizes.

Examples

Example 1:
An example for resize. Stata's default font sizes remain unchanged:

sysuse auto, clear

scatter price mpg, name(example1, replace)

resize example1, xsize(15cm) ysize(8cm)

Example 2:
Another example for resize. Now, we change Stata's default font size and add more text elements (package grstyle is required):

First, define the desired font sizes (8pt for all text in this example):

`"grstyle init"'

`"grstyle set size 8pt: heading subheading body small_body text_option axis_title tick_label minortick_label key_label"'

Then, create and resize the figure:

`"sysuse auto, clear"'

`"twoway (scatter price mpg) , title("All text has the same font size") subtitle("Same font size") text(8000 32 "Same font size", placement(west)) text(8000 32 "♥", placement(east) color(red)) name(example2, replace) note("8pt")"'

`"resize example2, xsize(10cm) ysize(15cm)"'

After resizing the figure, all text is still in 8pt. You can test this by exporting the figure to PDF or by copying it into programs like Word or PowerPoint and preserving the original figure size.

Example 3:
Combine two graphs using resizecombine. We change Stata's default font size (package grstyle is required):

First, define the desired font sizes (8pt for the title and 6pt for all other text in this example):

`"grstyle init"'

`"grstyle set size 8pt: heading"'

`"grstyle set size 6pt: subheading body small_body text_option axis_title tick_label minortick_label key_label"'

Then, create and resize the figure.

`"sysuse auto, clear"'

`"twoway (scatter price mpg) , title("This is 8pt") subtitle("This is 6pt") text(8000 32 "6pt", placement(west)) text(8000 32 "♥", placement(east) color(red)) name(example3a, replace) note("6pt")"'

`"twoway (scatter price mpg) if foreign==1, title("This is 8pt") subtitle("This is 6pt") text(8000 32 "6pt", placement(west)) text(8000 32 "♥", placement(east) color(red)) name(example3b, replace) note("6pt")"'

`"resizecombine example3a example3b, xsize(12cm) ysize(12cm) note("also 6pt") "'

Example 4:
Combine two graphs that have legends using resizec1leg. We change Stata's default font size (package grstyle is required):

First, define the desired font sizes (8pt for the title and 6pt for all other text in this example):

`"grstyle init"'

`"grstyle set size 8pt: heading"'

`"grstyle set size 6pt: subheading body small_body text_option axis_title tick_label minortick_label key_label"'

Then, create and resize the figure.

`"sysuse auto, clear"'

`"twoway (scatter price mpg) (lpoly price mpg) , title("This is 8pt") subtitle("This is 6pt") text(8000 32 "6pt", placement(west)) text(8000 32 "♥", placement(east) color(red)) name(example3a, replace) note("6pt")"'

`"twoway (scatter price mpg) (lpoly price mpg) if foreign==1, title("This is 8pt") subtitle("This is 6pt") text(8000 32 "6pt", placement(west)) text(8000 32 "♥", placement(east) color(red)) name(example3b, replace) note("6pt")"'

`"resizec1leg example3a example3b, xsize(12cm) ysize(12cm) note("also 6pt") "'

Author

Ansgar Hudde, University of Cologne, ansgar.hudde@wiso.uni-koeln.de