1

I'm struggling to make a plot that I find useful with my current set of X-ray diffraction data. I have multiple x-ray scans that I'd like to place in a 3d arrangement according to a third variable. [i.e., compare the theta-two-theta (x,y) measured data to a variable in my control-space]

What I'm looking for is either like a waterfall plot or a ribbon plot, but both appear to be limiting. For the waterfall plot, it appears spacing is determined not by a variable, but by the function, similarly to a ribbon-plot, which takes x,y data only, and uses equal spacing and colors along the colormap.

This is similar to stacking XRD plots, but I figured it would be nice to have the spacing between each plot be directly linked to a testing variable in our lab.

Color I'd like to be constant for each line, determined by the nice color routine linspecer.

Are there any plots that control the third dimension by a variable for spacing of the lines? I have each line separate in a data struct right now, but can massage the data to be what is needed for suggested solutions.

AllenH
  • 577
  • 1
  • 4
  • 13
  • 1
    user1884905 's suggestion is almost exactly how I went about finding the solution. To control the color using linspecer, I used a loop and hold function to add each line according to C(ii) where C=linspecer(numlines, 'sequential'); Once looped through, and the third variable read for each line's position, I was able to put together graphs like user1884905's suggestion. It appears plot3 is the appropriate way to accomplish my need for control over spacing in the 3D line graph. – AllenH Mar 30 '17 at 19:27

1 Answers1

1

If you want control of each individual line, the 3-D line plot plot3() might be what you are looking for.

This short example makes use of the peaks data but changes the spacing between the lines.

[x,y] = meshgrid(-3:.5:3,-3:.1:3);
z = peaks(x,y);

% Change spacing of x
xNew = sign(x).*sqrt(abs(x));

plot3(x,y,z,'b')
figure
plot3(xNew,y,z,'b')

This produces the following two figures. The first one shows the original spacing and the second one uses the modified spacing.

Plot with the original spacing

Plot with the modified spacing

If you want individual colors of each line you can loop through them and set them individually as in this answer at matlab central.

user1884905
  • 3,137
  • 1
  • 22
  • 22
  • 1
    Absolutely- I forgot to come back and reply to my own message! But this was the final way I went about doing this! Perfect example and it's exactly what I was looking for! Thank you!! – AllenH Mar 30 '17 at 19:16