# Image Size using {w,h}

Mathematica help file says:

"With ImageSize->{w,h} an object will always be drawn in a $w\times h$ region, and will be sized to fit in the region. "

However:

Doesn't look like "and will be sized to fit in the region" is working. Am I thinking incorrectly here?

Using Version 10.0.

First, here is a trick to see the actual space used by the plot:

Grid[{{Plot[Sqrt[100 - x^2], {x, 0, 100}, PlotRange -> Automatic,
ImageSize -> {250, 100}]}}, Frame -> All]


Grid[{{Plot[Sqrt[100 - x^2], {x, 0, 100}, PlotRange -> Automatic,
ImageSize -> {500, 100}]}}, Frame -> All]


So you can see that it did actually use more space (width). Now if you want to widen your plot, this is something else. You can use Aspect ratio for this.

Grid[{{Plot[Sqrt[100 - x^2], {x, 0, 100}, PlotRange -> Automatic,
ImageSize -> {500, 100}, AspectRatio -> .2]}}, Frame -> All]


But this does not look too good. ps. (You can also use Framed@Plot[...] to see the actual space used instead of Grid as above)

• Nice answer. Looks like this works as well: Framed@Plot[Sqrt[100 - x^2], {x, 0, 100}, PlotRange -> Automatic, ImageSize -> {500, 100}, AspectRatio -> Full] – David Nov 10 '14 at 2:41
• It is worth to mention that AspectRation should be exactly equal to 100/500, i.e. h/w where h and w are from ImageSize->{w,h}. – Alexey Popkov Nov 10 '14 at 3:08
• @Alexey Popkov It is a useful point. Alexey, why would not you formulate this as a regular answer? – Alexei Boulbitch Nov 10 '14 at 9:24
• @David Be careful of that option! It can produce weird problems: (19656) – Mr.Wizard Nov 10 '14 at 11:55
• @AlexeiBoulbitch Done. – Alexey Popkov Nov 10 '14 at 15:25

By default Plot has AspectRatio -> 1/GoldenRatio which is a definite value:

1./GoldenRatio

0.6180339887498948


According to the Documentation page for ImageSize (emphasis mine),

• With ImageSize->{w,h} an object will always be drawn in a $w×h$ region, and will be sized to fit in the region.

• If the object has a definite aspect ratio that is not $h/w$, then space will be left around it.

From the above follows that ImageSize does not change AspectRatio when the latter has a definite value and if you want the plot to fit the ImageSize you should explicitly specify AspectRatio -> h/w where h and w are taken from ImageSize -> {w, h}:

Grid[{{Plot[Sqrt[100 - x^2], {x, 0, 100}, PlotRange -> Automatic,
AspectRatio -> 1/5, ImageSize -> {500, 100}]}}, Frame -> All]