Mathematica 3D plotting question

Click For Summary
SUMMARY

This discussion focuses on creating a 3D graph in Mathematica that combines a scatter plot and a plane. The user successfully imports data from a CSV file generated from Excel and utilizes the ListPointPlot3D function to create the scatter plot. The plane is defined using the Plot3D function, and the user incorporates opacity into the plane's appearance using the PlotStyle directive. The final code integrates both elements seamlessly, demonstrating effective data visualization techniques in Mathematica.

PREREQUISITES
  • Familiarity with Mathematica syntax and functions
  • Understanding of 3D plotting concepts in Mathematica
  • Basic knowledge of data handling in CSV format
  • Experience with the Plot3D and ListPointPlot3D functions
NEXT STEPS
  • Learn how to manipulate data in Mathematica using Import and Export functions
  • Explore advanced 3D plotting techniques in Mathematica
  • Research the use of Opacity and other graphical directives in Mathematica
  • Investigate the integration of multiple graphical elements in a single plot
USEFUL FOR

This discussion is beneficial for data scientists, mathematicians, and educators looking to enhance their skills in 3D data visualization using Mathematica.

Wesleytf
Messages
31
Reaction score
0
I'd like to make a single 3D graph that contains a scatter plot and a plane. Ideally I'd like to import the data for the point from an excel file, but if I have to punch it in, I can find a few hours to kill. Anyway, can anyone help me with the code for this? I can get a 3D scatter plot where I'm just typing in the coordinates of each point, but I'm not sure where to go from there.
 
Physics news on Phys.org
To emulate getting some data from excel, here's some random data - saved as a csv file:

In[1]:= data=RandomReal[{0,1},{50,3}];
In[2]:= Save[ToFileName[NotebookDirectory[], "data.csv"],data]

All you need to do is save your table of data as a csv file from excel. Probably using save as or maybe export. The load it into mma using, eg

In[3]:= Get[ToFileName[NotebookDirectory[], "data.csv"]];

Here's a plane...

In[4]:= plane=Graphics3D[{Opacity[.5],Polygon[{{0,0,.4},{0,1,.4},{1,1,.4},{1,0,.4}}]}];

Here's a scatter plot + plane:

In[5]:= Show[ListPointPlot3D[data, PlotStyle->Red], plane]
 
Thanks for the help-- I wound up using this for the plane:

plane = Plot3D[{1.295*x + .6415*y + 16.09}, {x, -3, 3}, {y, -3, 3} ]

I'd like to make add in Opacity[.5], but I'm not sure where to put it in and the Plot3D help file doesn't show it as an option (at least that I can find). Any advice?
 
Nevermind, I found it!

PlotStyle -> Directive[Opacity[0.5]]
 

Similar threads

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