[Mathematica] Combining several Graphics in a Graphics3D

  • Context: Mathematica 
  • Thread starter Thread starter guerom00
  • Start date Start date
  • Tags Tags
    Graphics Mathematica
Click For Summary
SUMMARY

This discussion focuses on combining multiple 2D plots into a single 3D graphic using Mathematica. The user created a list of plots for various x-values using the Plot[] function and seeks guidance on merging these into a Graphics3D object. The conversation references the StackGraphics command from older versions of Mathematica, which allows stacking plots but lacks specific positioning capabilities. A custom function, LinePlot3D, is provided to visualize the data in 3D, demonstrating the use of Graphics3D and the Show function.

PREREQUISITES
  • Familiarity with Mathematica syntax and functions
  • Understanding of 2D plotting using the Plot[] function
  • Basic knowledge of 3D graphics concepts in Mathematica
  • Experience with data structures in Mathematica, such as lists and tables
NEXT STEPS
  • Explore the use of the Show function in Mathematica for combining graphics
  • Learn about the Graphics3D function and its options in Mathematica
  • Investigate the StackGraphics command and its limitations in recent Mathematica versions
  • Study the implementation of custom plotting functions in Mathematica, similar to LinePlot3D
USEFUL FOR

This discussion is beneficial for Mathematica users, particularly those involved in scientific computing, data visualization, and anyone looking to enhance their 3D plotting capabilities in Mathematica.

guerom00
Messages
90
Reaction score
0
Hello all,

I'll try to make myself clear... My goal here is to plot a function f(x,y) in 3D. But, instead of using the Plot3D[] function, I made a table of Plot[] for, say, several values of the x variable.
So I'm now with a list which looks like this :
{{x1,Plot[f[x1,y],{y,ymin,ymax}]},{x2,Plot[f[x2,y],{y,ymin,ymax}]},...}
So a list whose elements are a list of a real number (the xi's) and a Graphics object (the Plot[]'s).
My question is now how to combine all of this in a Graphics3D object which would represent the 3D graph of my f(x,y) function.

Thanks in advance. :)
 
Physics news on Phys.org
In older version of Mma, I don't know about the most recent ones, there was a command in Graphics'Graphics3D' named StackGraphics that could pile up Plots but I don't recall the possibility to put them at specific abscissas.

If you wish and are able to just generate the data points (losing all of Plot's useful beautifying tricks), here's a procedure I found in an old notebook of mine. I believe I took it from Bahder's book "Mathematica for Scientists and Engineers"

Code:
LinePlot3D[data_, opts___] := Show[Graphics3D[Line /@ data, opts]]

Example use
Code:
z[x_,y_]:=Exp[-3. (y-4.)^2]+.5  Exp[-18. (y-3.5-0.5x)^2]

f[x_]:=Table[{y,z[x,y]},{y,1,8,0.05}]
f3[x_]:=f[x] /. {y_,f_} :>    {x,y,f}
data=Table[f3[x],{x,1,6,0.4}];

LinePlot3D[data,ViewPoint->{3.188, -0.755, 0.845},
  PlotRange->{{1,6},{1,8},{0,2}}]

Otherwise, I'll redirect you to David Park's package (via google), but I'm not sure it's still free of charge.
 
Thanks for your answer. StackGraphics[] does work and does what I want although it lacks basic options...
 

Similar threads

  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 5 ·
Replies
5
Views
5K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K