Mathematica- Rotating a 2D plot into a 3D plot

In summary, the conversation discussed how to plot a 3D graph by rotating it about the origin. Two options were presented, using the Plot3D and ParametricPlot3D functions in Mathematica. The second option was chosen as it worked well for the desired result.
  • #1
timman_24
52
0
I have a plot of radius and temperature. I want to plot it in 3D by rotating it about the origin to produce a 3D plot. I can not figure out how to do this in Mathematica without doing it by hand and then plugging it into the Plot3D function. Any advice would be greatly appreciated.

The plot is:

Plot[{(20 + 100 - r^2 + 4*30)/4 , (40 + 200 - 2*r^2 + 4*30)/4}, {r, -10, 10}]
 
Physics news on Phys.org
  • #2
Two options...

Plot3D[With[{r = Sqrt[x^2 + y^2]}, {1/4 (20 + 100 - r^2 + 4 30),
1/4 (40 + 200 - 2 r^2 + 4 30)}], {x, -10, 10}, {y, -10, 10},
Mesh -> Automatic, MeshStyle -> LightGray, PlotStyle -> Opacity[0.5]]

ParametricPlot3D[
Thread[{r Cos[\[Theta]],
r Sin[\[Theta]], {1/4 (20 + 100 - r^2 + 4 30),
1/4 (40 + 200 - 2 r^2 + 4 30)}}], {r, 0, 10}, {\[Theta], 0,
2 \[Pi]}, MeshStyle -> LightGray, PlotStyle -> Opacity[0.5]]
 
  • #3
Thanks a lot, that looks great. The second one worked perfectly for what I was going for.
 

1. How can I rotate a 2D plot into a 3D plot in Mathematica?

To rotate a 2D plot into a 3D plot in Mathematica, you can use the Rotate function. This function takes in the plot as its first argument and the rotation angle and axis as its second argument. You can also use the ViewPoint option to specify the viewing angle of the 3D plot.

2. Can I rotate only part of a 2D plot into a 3D plot?

Yes, you can rotate only a specific part of a 2D plot into a 3D plot in Mathematica. To do this, you can use the GeometricTransformation function. This function allows you to apply a transformation to a specific subset of graphics objects. You can use this function in combination with the Rotate function to rotate only a part of your 2D plot into a 3D plot.

3. How do I specify the rotation axis when rotating a 2D plot into a 3D plot?

To specify the rotation axis when rotating a 2D plot into a 3D plot in Mathematica, you can use the RotationMatrix function. This function takes in the rotation axis and angle as its arguments and returns a matrix that represents the rotation. You can then use this matrix as the second argument in the Rotate function.

4. Can I animate the rotation of a 2D plot into a 3D plot?

Yes, you can animate the rotation of a 2D plot into a 3D plot in Mathematica. To do this, you can use the Animate function. This function allows you to specify the start and end values for a variable, as well as the step size, and creates an animation by varying the variable. You can use this function to animate the rotation angle in the Rotate function.

5. Are there any other ways to rotate a 2D plot into a 3D plot in Mathematica?

Yes, there are other ways to rotate a 2D plot into a 3D plot in Mathematica. One way is to use the ChartElementFunction option in the ListPlot3D function. This allows you to specify a custom function to use for generating the 3D plot, which can include rotation transformations. Another way is to use the Graphics3D function, which allows you to construct a 3D graphics object using various 2D graphics primitives and transformations.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
212
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
Back
Top