# How to resize a plot object with various plotting functions?

I use ContourPlot,PolarPlot,Graph to plot. For example:

ContourPlot[x^2/3 + y^2/9 == 1, {x, -10, 10}, {y, -10, 10},
PlotPoints -> 100, MaxRecursion->1]


I want this plot object to be 2 times bigger, then

ContourPlot[(0.5x)^2/3+(0.5*y)^2/9 == 1, {x, -10, 10},{y, -10, 10},
PlotPoints -> 100, MaxRecursion -> 1]


get plot as my will:

But my method is primitive. What's a better general method that can be used for various plot functions?

You can use ScalingTransform on the graphics primitives:

ClearAll[resize]
resize[sc_] :=  MapAt[GeometricTransformation[#, ScalingTransform[sc]] &, #, {1}] &;


Examples:

cp = ContourPlot[x^2/3 + y^2/9 == 1, {x, -10, 10}, {y, -10, 10},
PlotPoints -> 100, MaxRecursion -> 1, ImageSize -> 300];
Row[{cp, resize[{3, 3}] @ cp}] pp = PolarPlot[Sin[3 t], {t, 0, Pi}, Frame -> True, FrameTicks -> All,
PlotRange -> {{-5, 5}, {-5, 5}}, ImageSize -> 300];
Row[{pp, resize[{3, 3}] @ pp}] For a Graph object gr, you need first wrap gr with Show to get a Graphics object before using resize on it:

gr = Graph[{1 -> 2, 2 -> 3,  3 -> 1}, Frame -> True, FrameTicks -> All,
PlotRange -> {{-5, 5}, {-5, 5}}, ImageSize -> 300];
Row[{gr, resize[{3, 3}] @ Show @ gr}] For 3D plots use a list with three numbers, one for each dimension, as the scaling parameter:

cp3d = ContourPlot3D[Cos[x] + Cos[y] + Cos[z] == 0, {x, -π, π}, {y, -π, π}, {z, -π,  π},
PlotRange -> {{-4 π, 4 π}, {-4 π, 4 π}, {-4 π, 4 π}}, Mesh -> None, ImageSize -> 300];
Row[{cp3d, resize[{2, 3, 3}] @ cp3d}] Manipulate[
ContourPlot[x^2/a^2 + y^2/b^2 == f^2,
{x, -10, 10}, {y, -10, 10},
PlotLabel -> TraditionalForm[x^2/"a"^2 + y^2/"b"^2 == "f"^2]],
{{a, Sqrt, "x control (a)"}, 1, 5, Appearance -> "Labeled"},
{{b, 3, "y control (b)"}, 1, 5, Appearance -> "Labeled"},
{{f, 1, "scale (f)"}, .25, 3, .05, Appearance -> "Labeled"}] EDIT: The f^2 above resulted from dividing both x and y by f and simplifying the equation by multiplying through by f^2. In general, scaling all x and y by f won't produce a simple f^2 factor but you still want to divide all of the occurrences of x and y by f.

Manipulate[
ContourPlot[
(x/f)^(3/2) - Sqrt[1.65]*(x/f) + (y/f)^2 == 0,
{x, -20, 20}, {y, -20, 20}],
{{f, 1, "scale (f)"}, 1, 12, 1, Appearance -> "Labeled"}] • If the object is not ellipse,this method doesn't work. Mar 8, 2018 at 0:48
• @kittygirl - so what implicit equation is causing a problem? Mar 8, 2018 at 0:52
• ,ContourPlot[ Power[(x), 3/2] - Power[1.65, 0.5]*(x) + ((y))^2 == 0, {x, -20, 20}, {y, -20, 20}, PlotPoints -> 100, MaxRecursion -> 1],for more complex objects, we cannot resize them just by f^2 Mar 8, 2018 at 0:59