is an option for Graphics and related functions that specifies the ratio of height to width for a plot.
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:
-
Automatic determine the ratio from the actual coordinate values Full stretch graphics to fill out the enclosing region a an explicit height-to-width ratio
Examples
open all close allBasic Examples (2)
Scope (2)
Automatic can be given to choose the ratio from the actual plot values:
{Plot[Sqrt[1 - x ^ 2], {x, 0, 1}], Plot[Sqrt[1 - x ^ 2], {x, 0, 1}, AspectRatio -> Automatic]}Specify the height-to-width ratio of a graphic by numerical values:
{ParametricPlot[{Cos[u], 1 / 10Sin[u]}, {u, 0, 2Pi}],
ParametricPlot[{Cos[u], 1 / 10Sin[u]}, {u, 0, 2Pi}, AspectRatio -> 1 / 2]}Generalizations & Extensions (2)
In 3D, the aspect ratio determines the ratio of the final displayed 2D image:
Table[Framed@Graphics3D[Sphere[], AspectRatio -> 1 / k], {k, 1, 3}]Use the Automatic setting to preserve the natural 3D projection:
Table[Plot3D[Sin[x y], {x, 0, 3}, {y, 0, 3}, AspectRatio -> ar], {ar, {Automatic, 2}}]Properties & Relations (5)
AspectRatio determines the ratio of PlotRange, not ImageSize:
Framed[Graphics[{Pink, Disk[]}, PlotRange -> {{-1, 1}, {-1, 1}}, Frame -> True, AspectRatio -> 2, ImageSize -> {200, 100}]]Graphics uses Automatic by default:
Graphics[{Pink, Disk[]}, PlotRange -> {{-2, 2}, {-1, 1}}, Frame -> True]Plot, ListPlot, and ListLinePlot use the ratio 1/GoldenRatio by default:
{Plot[Sin[x], {x, 0, 2Pi}], Plot[Sin[x], {x, 0, 2Pi}, AspectRatio -> 1 / GoldenRatio]}Some plots, such as ParametricPlot and ArrayPlot, use Automatic by default:
ParametricPlot[{u Cos[u], u Sin[u] / 2}, {u, 0, 4Pi}]ArrayPlot[CellularAutomaton[30, {{1}, 0}, 50]]Others, such as DensityPlot and ContourPlot, use the ratio 1 by default:
DensityPlot[Sin[x] + Cos[y], {x, 0, 10}, {y, 0, 5}]ContourPlot[Sin[x] + Cos[y], {x, 0, 10}, {y, 0, 5}]Possible Issues (2)
By default, ParametricPlot may yield a graphic with an extreme aspect ratio:
ParametricPlot[{u, Exp[u]}, {u, 0, 5}]Use an explicit AspectRatio to get a reasonable result:
ParametricPlot[{u, Exp[u]}, {u, 0, 5}, AspectRatio -> 1 / GoldenRatio]Using an explicit AspectRatio may distort shapes:
ParametricPlot[{Cos[θ], Sin[θ]}, {θ, 0, 2Pi}, AspectRatio -> 1 / 2]ContourPlot[x ^ 2 + y ^ 2 == 1, {x, -1, 1}, {y, -1, 1}, AspectRatio -> 1 / 2]Use Automatic when shape distortion is undesirable:
ParametricPlot[{Cos[θ], Sin[θ]}, {θ, 0, 2Pi}, AspectRatio -> Automatic]ContourPlot[x ^ 2 + y ^ 2 == 1, {x, -1, 1}, {y, -1, 1}, AspectRatio -> Automatic]Neat Examples (1)
A collection of boxes with random aspect ratios:
Grid@Table[With[{c = ColorData[14, RandomInteger[31]]}, Graphics[{Lighter[c], Rectangle[]}, AspectRatio -> RandomReal[{1 / 10, 3 / 2}], Background -> c, Frame -> True, FrameTicks -> False, ImageSize -> 50, PlotRangePadding -> .1]], {6}, {6}]Related Guides
History
Introduced in 1988 (1.0) | Updated in 2007 (6.0)
Text
Wolfram Research (1988), AspectRatio, Wolfram Language function, https://reference.wolfram.com/language/ref/AspectRatio.html (updated 2007).
CMS
Wolfram Language. 1988. "AspectRatio." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2007. https://reference.wolfram.com/language/ref/AspectRatio.html.
APA
Wolfram Language. (1988). AspectRatio. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AspectRatio.html
BibTeX
@misc{reference.wolfram_2026_aspectratio, author="Wolfram Research", title="{AspectRatio}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/AspectRatio.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_aspectratio, organization={Wolfram Research}, title={AspectRatio}, year={2007}, url={https://reference.wolfram.com/language/ref/AspectRatio.html}, note=[Accessed: 13-June-2026]}