0
$\begingroup$

Suppose I have a .dat file, that I could easily manage to import it and it read as below

data = {{0.`, 1.5`, 32.`, 4.`}, {0.01`, 13.339967195548438`, 
  43.07461560857787`, 6.505586235757622`}, {0.02`, 
  26.576707615610186`, 62.27984871710982`, 
  14.52957307602648`}, {0.03`, 43.92146166445253`, 88.22533168346912`,
   33.35986308123866`}, {999.97`, 4.852152291519739`, 
  20.914352068678742`, 78.65196295800204`}, {999.98`, 
  11.498870411172586`, 23.281707241849393`, 
  81.49717171318073`}, {999.99`, 17.163630489595015`, 
  23.943758603766856`, 85.08665301847587`}, {1000.`, 
  21.44200492399224`, 22.39480828216125`, 88.75135651276551`}}

Now, I need to plot a 3D graph using data available in column-2 vs column-3 vs column-4. How do I do that?

$\endgroup$
5
  • $\begingroup$ ListLinePlot3D[data[[All, 2 ;; 4]]] ? $\endgroup$
    – Syed
    Commented Apr 23, 2022 at 10:49
  • $\begingroup$ For v13, you have commands available (such as ListPointPlot3D, ListLinePlot3D, ListSurfacePlot3D) for which you can look up information in the docs. $\endgroup$
    – Syed
    Commented Apr 23, 2022 at 10:55
  • 1
    $\begingroup$ If you have an array of 4 data points such as myData= {{a,b,c,d},{d,e,f,g},...{p,q,r,s}} and you want to plot the fourth element as a function of the second and third, then extract second, third, and fourth and use ListPlot3D[myData[[All,2;;]]] $\endgroup$
    – josh
    Commented Apr 23, 2022 at 11:12
  • 1
    $\begingroup$ data[[All,2;;4]] // Point // Graphics3D ? $\endgroup$ Commented Apr 23, 2022 at 16:04
  • $\begingroup$ I need to Plot only the last 100 data from the .dat file. How do I choose that? $\endgroup$
    – user444
    Commented Apr 24, 2022 at 1:55

1 Answer 1

2
$\begingroup$

Let's take the toy-model set you provided and assume that you want to plot the last three.

The way to pick them

lastthree = data[[6 ;;]]

lastthree

One way to plot them is using ListPointPlot3D

ListPointPlot3D[lastthree, PlotRange -> All, 
 LabelingFunction -> Callout, ColorFunction -> "Rainbow"]

ListPointPlot3D

And a couple of more based on ListPlot3D and ListLinePlot3D

ListPlot3D[lastthree, PlotRange -> All]
ListLinePlot3D[lastthree, PlotRange -> All]

plot1

plot2

Have fun!

$\endgroup$
2
  • $\begingroup$ I am using Mathematica 12.0. And ListLinePlot3D seems to be absent there. How do I join the points if I am using ListPointPlot3D? $\endgroup$
    – user444
    Commented Apr 25, 2022 at 4:33
  • $\begingroup$ @user84456 I have been trying to find an easy way to do it but I have not been able to do so. Sorry! $\endgroup$
    – bmf
    Commented Apr 25, 2022 at 5:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.