7
$\begingroup$

I have a *.xlsx file containing four columns, each pair representing an x and y value, so (from left to right): x_sample1, y_sample1, x_sample2, y_sample2.

What I wanted to do, is put them in a ListLinePlot (or something similar) next to each other in a 3-D view. I managed to get what I wanted using ListPointPlot, but a continuous line for each sample would look better for my purposes. ListPointPlot (to my knowledge) only let me use Filling to simulate a more continuous, solid look - but that doesn't really cut it. Attached below is a picture of what I did so far and how the general look of it should be. enter image description here

I used a (rather ugly) workaround to get this to work: for each plot I added an artificial x value named "row" in integer values from 1-14 and these were followed by the original plot data corresponding to y and z data for this plot.

The code I used is:

ListPointPlot3D[{exceldaten[[All, {1, 2, 3}]], exceldaten[[All, {4, 5, 6}]], 
          exceldaten[[All, {7, 8, 9}]], exceldaten[[All, {10, 11, 12}]],
          exceldaten[[All, {13, 14, 15}]], exceldaten[[All, {16, 17, 18}]], 
          exceldaten[[All, {19, 20, 21}]], exceldaten[[All, {22, 23, 24}]], 
          exceldaten[[All, {25, 26, 27}]], exceldaten[[All, {28, 29, 30}]], 
          exceldaten[[All, {31, 32, 33}]], exceldaten[[All, {34, 35, 36}]], 
          exceldaten[[All, {37, 38, 39}]], exceldaten[[All, {40, 41, 42}]]}, 
     PlotRange -> {{0.5, 14.5}, {0.0002, 0.0006}, {0, 50000}}, 
     Filling -> Axis, FillingStyle -> Automatic, Axes -> {False, True,True}, 
     AxesLabel -> {None, "mobility (corresponding unit)", "cps"}, 
     Ticks -> {header[[3 ;; 42 ;; 3]], Automatic, Automatic}, 
     LabelStyle -> Directive[Bold, Medium], PlotLegends -> header[[3 ;; 42 ;; 3]]]
$\endgroup$
  • $\begingroup$ Might be related: 22878 $\endgroup$ – Mahdi May 26 '15 at 8:18
7
$\begingroup$

You can use Polygon to get this effect. If you use ListPointPlot3D as well, you have easy access to the axes.

a = Table[{j, i, i*Exp[-(j - 6)^2/(4)]}, {i, 1, 12}, {j, 1, 10}];
c = ColorData[97][#] & /@ Range[1, Length@a];
Show[
 ListPointPlot3D[a, PlotStyle -> c],
 Graphics3D[{#1, Polygon[#2]}] & @@@ Transpose@{c, a}
 ]

Which gives

enter image description here

Or you can use EdgeForm and FaceForm to get lines

Show[
 ListPointPlot3D[a, PlotStyle -> c],
 Graphics3D[{FaceForm[None], EdgeForm[#1], Polygon[#2]}] & @@@ 
  Transpose@{c, a}
 ]

enter image description here

Edit: Obviously, you could use Line as well, which gets rid of the lines on the x-y plane.

Show[ListPointPlot3D[a, PlotStyle -> c], 
 Graphics3D[{#1, Line[#2]}] & @@@ Transpose@{c, a}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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