AspectRatio

AspectRatio

is an option for Graphics and related functions that specifies the ratio of height to width for a plot.

Details

  • AspectRatio determines the scaling for the final image shape.
  • Typical settings include:
  • Automaticdetermine the ratio from the actual coordinate values
    Fullstretch graphics to fill out the enclosing region
    aan explicit height-to-width ratio

Examples

open allclose all

Basic Examples  (2)

Use numerical values to specify the height-to-width ratio:

Choose the ratio from the actual plot values:

Scope  (2)

Automatic can be given to choose the ratio from the actual plot values:

Specify the height-to-width ratio of a graphic by numerical values:

Generalizations & Extensions  (2)

In 3D, the aspect ratio determines the ratio of the final displayed 2D image:

Use the Automatic setting to preserve the natural 3D projection:

Properties & Relations  (5)

AspectRatio determines the ratio of PlotRange, not ImageSize:

Graphics uses Automatic by default:

Plot, ListPlot, and ListLinePlot use the ratio 1/GoldenRatio by default:

Some plots, such as ParametricPlot and ArrayPlot, use Automatic by default:

Others, such as DensityPlot and ContourPlot, use the ratio 1 by default:

Possible Issues  (2)

By default, ParametricPlot may yield a graphic with an extreme aspect ratio:

Use an explicit AspectRatio to get a reasonable result:

Using an explicit AspectRatio may distort shapes:

Use Automatic when shape distortion is undesirable:

Neat Examples  (1)

A collection of boxes with random aspect ratios:

Introduced in 1988
 (1.0)
 |
Updated in 2007
 (6.0)