4
$\begingroup$

I want to use the function ListPlot3D to visualize data contained in a number of matrices. The matrices are all (191,3) in size- each matrix representing a measurement taken along a direction at a different time. I've included a sample of the first 20 points in two of these matrices below as "a" and "b" (apologies for odd formatting).

a = {{0.20242, 6244, 0.722142}, {0.21284, 6244, 0.713891}, {0.22328, 6244, 0.704955}, {0.23369, 6244, 0.697195}, {0.2441, 6244, 0.687987}, {0.25454, 6244, 0.679169}, {0.26495, 6244, 0.669641}, {0.27538, 6244, 0.660857}, {0.28579, 6244, 0.652068}, {0.29622, 6244, 0.643073}, {0.30662, 6244, 0.634506}, {0.31703, 6244, 0.62691}, {0.32746, 6244, 0.622205}, {0.33785, 6244, 0.617918}, {0.34828, 6244, 0.614794}, {0.35868, 6244, 0.613043}, {0.3691, 6244, 0.614047}, {0.3795, 6244, 0.613577}, {0.38989, 6244, 0.613514}, {0.4003, 6244, 0.611439}}

b = {{0.20242, 12488, 0.732877}, {0.21284, 12488, 0.72343}, {0.22328, 12488, 0.713726}, {0.23369, 12488, 0.705098}, {0.2441, 12488, 0.697295}, {0.25454, 12488, 0.693061}, {0.26495, 12488, 0.692608}, {0.27538, 12488, 0.691477}, {0.28579, 12488, 0.688314}, {0.29622, 12488, 0.683847}, {0.30662, 12488, 0.674824}, {0.31703, 12488, 0.663353}, {0.32746, 12488, 0.650306}, {0.33785, 12488, 0.636811}, {0.34828, 12488, 0.631822}, {0.35868, 12488, 0.635797}, {0.3691, 12488, 0.642863}, {0.3795, 12488, 0.647861}, {0.38989, 12488, 0.648684}, {0.4003, 12488, 0.643717}}

There's no trouble plotting them using the following expression:

Plot1 = ListPointPlot3D[{a, b}]

But there's only a blank set of axes showing if the following expression is used:

Plot2 = ListPlot3D[{a, b}]

Is there something I can do to re-scale/etc data so that it can be displayed this way? Any suggestions appreciated.

$\endgroup$
4
  • $\begingroup$ what kind of plot do you want? Why is the output ListPointPlot3D not suitable for you? $\endgroup$
    – glS
    Mar 30, 2017 at 22:07
  • $\begingroup$ I'm trying to very explicitly show the change in the data over time rather than just have multiple traces on a single plot so I'd prefer the type of "surface" with the tie lines that ListPlot3D provides- if there's another plot style that similarly provides this surface effect and works with the data provided that would also be fine. $\endgroup$
    – tka
    Mar 30, 2017 at 22:15
  • $\begingroup$ ListPlot3D wants the input points to not have a fixed value of some coordinates. It may be easier to make a custom visualization with Graphics3D in this case. Are the first elements of the points in the two lists corresponding to one another, like it seems to be the case in the data you provided? $\endgroup$
    – glS
    Mar 30, 2017 at 22:22
  • $\begingroup$ @glS, this is correct- the different data traces are all measured at the same points so the first elements of each matrix are the same (i.e. if only the first elements were made into a list it would always have the same values). $\endgroup$
    – tka
    Mar 30, 2017 at 22:52

2 Answers 2

2
$\begingroup$

If the data has the structure you show you may use a custom "ladder" representation to better see the increase of the points:

Show[
 ListPointPlot3D[{a, b}, PlotStyle -> Directive[[email protected]]],
 Graphics3D[{
   Table[
    {
     Polygon[{a[[k]], a[[k + 1]], b[[k + 1]], b[[k]]}]
     },
    {k, Range[Length@a - 1]}
    ]
   }
  ]
 ]

$\endgroup$
3
  • $\begingroup$ This is an interesting solution- I'd like to get as close as possible to something like this $\endgroup$
    – tka
    Mar 30, 2017 at 22:49
  • $\begingroup$ @tka can you provide a dataset like that for testing? $\endgroup$
    – glS
    Mar 31, 2017 at 9:29
  • $\begingroup$ Thanks for your help, I think the suggestion of @Edmund is a bit easier for me to work with the but customization your answer offers will be very useful for me in the future. $\endgroup$
    – tka
    Mar 31, 2017 at 15:52
2
$\begingroup$

You may use the data surface syntax of ListPlot3D along with the DataRange option.

Plot2 = ListPlot3D[{a[[All, -1]], b[[All, -1]]},
  DataRange -> {MinMax[a[[All, 1]]], MinMax[Join[a[[All, 2]], b[[All, 2]]]]}]

Mathematica graphics

Hope this helps.

$\endgroup$
1
  • $\begingroup$ Thanks, @Edmund , this works really well for me and it gave me some insight into why ListPlot3D was having so many issues with the format I'm using. $\endgroup$
    – tka
    Mar 31, 2017 at 15:50

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.