# How to keep figure in Graphics to fixed size

I have the following code:

f[u_] = Graphics[{Circle[{0, 1}, 1],  Circle[{2 Sqrt[u], u}, u]}]
Manipulate[Show[f[u]], {{u, 0.5},1,10}]


Now, if we try the slider, we can actually see that when we make the second circle (the one for which its center and radius depend on $$u$$), the first "fixed" circle (the unit circle centered in $$(0,1)$$) will shrink in size in the picture.

What should I do in order to keep that circle "fixed" in size, i.e. no matter how big I make the second circle, the first circle remains fixed in size when using the slider? (so the image does not zoom in/out to see both circles)

• Add an appropriate fixed PlotRange to your Show? Mar 27, 2019 at 21:24

Try something like this:

ClearAll[f]
f[u_] := Graphics[{Circle[{0, 1}, 1], Circle[{2 Sqrt[u], u}, u]}]
Manipulate[
Show[
f[u],
PlotRange -> PlotRange[f[10]],
],
{{u, 0.5}, 0.5, 10}
]


Here I use the PlotRange function to extract the plot range for the graphic with the largest possible circle, i.e. the one produced by f[10], then apply 5% padding to that range to make sure that everything fits comfortably.

• This is exactly what I needed! Thank you!
– QWE
Mar 27, 2019 at 21:28
• @QWE Glad to help! You are very welcome. Mar 27, 2019 at 21:28