# Representing 2D Plot and 3D Plot next to each other, sharing $z$-axis

I have the following code

Posvec = {Cos[\[Phi]] Sin[\[Theta]], Sin[\[Theta]] Sin[\[Phi]],
Cos[\[Theta]]};
Func = Function[{z}, -z^2];
P1 = ParametricPlot[{ Func[Posvec[]], Posvec[]}, {\[Theta],
0, \[Pi]}, PlotRange -> All, AspectRatio -> Full,
ColorFunction -> Function[{x, y}, Hue[-x]],
ColorFunctionScaling -> False];
L1 = ParametricPlot3D[
Posvec, {\[Phi], 0, 2 \[Pi]}, {\[Theta], 0.01, 0.9999 \[Pi]},
Axes -> False, Boxed -> False,
ViewVector -> {{100, 0, 0}, {0, 0, 0}}, PlotPoints -> {50, 50},
ColorFunction -> Function[{x, y, z, \[Phi], \[Theta]}, Hue[z^2]],
ColorFunctionScaling -> False];
GraphicsGrid[{{P1, L1}}, Alignment -> Center]


This first creates 2 plots like this and this The last line then creates an image of both plots next to each other. Like this Now, technically the color plot on the ball and the parabola represent the same value. I would like them to either share the z-axis or at least have the ball and the plot the same height. I really tried, but don't seems to be very successful! As a second thing it would be really nice if one could bring them closer together.

I would be really happy about help

Perhaps the simplest way is to also plot the curve in 3D.

posvec = {Cos[ϕ] Sin[θ], Sin[θ] Sin[ϕ], Cos[θ]};
movevec = {1.5, 0, 0};
func = Function[{z}, -z^2];

curve = ParametricPlot3D[{func[posvec[]], 0,
posvec[]}, {θ, 0, π}, PlotRange -> All,
AspectRatio -> Full, ColorFunction -> Function[{x, y}, Hue[-x]],
ColorFunctionScaling -> False];
sphere = ParametricPlot3D[
posvec + movevec, {ϕ, 0, 2 π}, {θ, 0, π},
Axes -> False, Boxed -> False, PlotPoints -> {50, 50},
ColorFunction -> Function[{x, y, z, ϕ, θ}, Hue[z^2]],
ColorFunctionScaling -> False];

Show[{curve, sphere}, ViewPoint -> Front,
ViewProjection -> "Orthographic",
PlotRange -> {{-1, 3}, {-2, 4}, Automatic}, AxesOrigin -> {0, 0, 0},
AspectRatio -> 1/2] Alternatively, you can manually set all the relevant options (PlotRange, ImageMargins, ImagePadding, SphericalRegion), and combine with Row or GraphicsRow.

curve = ParametricPlot[{func[posvec[]], posvec[]}, {\[Theta],
0, \[Pi]}, ColorFunction -> Function[{x, y}, Hue[-x]],
ColorFunctionScaling -> False, PlotRange -> {{-1, 0}, {-1, 1}},
ImageSize -> {150, 200}, ImageMargins -> 0, ImagePadding -> 20,
AspectRatio -> Full];

sphere = ParametricPlot3D[
posvec, {\[Phi], 0, 2 \[Pi]}, {\[Theta], 0, \[Pi]}, Axes -> False,
Boxed -> False, PlotPoints -> {50, 50},
ColorFunction -> Function[{x, y, z, \[Phi], \[Theta]}, Hue[z^2]],
ColorFunctionScaling -> False, ViewPoint -> Front,
ViewProjection -> "Orthographic",
PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}}, AxesOrigin -> {0, 0, 0},
ImageSize -> {200, 200}, SphericalRegion -> False,
ImageMargins -> 0, ImagePadding -> 20];

Row[{curve, sphere}] • Genius!!!!!!!!! Dec 28, 2022 at 21:40
• But what if the $x$-axes need to scale differently? Dec 28, 2022 at 23:05
• Well, in that case, you can manually transform (scale) the object by multiplying the $x$ coordinate. Dec 28, 2022 at 23:06
• @jabru, I have also added a second method, which is perhaps more suitable to your needs. Dec 28, 2022 at 23:19