How do I create a scatter plot of every value combination of three vectors?
Show older comments
I have three vectors each corresponding to a position of a seat in a theater. x = [0:60], y = [0:60] and z = [y.*5]. So I have an x vector, a y vector, and a z vector. I need to be able to plot every combination of the vectors because when I use scatter3(x,y,z) it plots x(n), y(n) and z(n), creating a diagonal line of seats. So I also need it to plot x(n), y(n+1), z(n+1).
Accepted Answer
More Answers (2)
Sumeet Gadagkar
on 9 Apr 2018
Hey Luke,
Have you considered looping through the values of your matrix and plotting for each of the values?
It would go something like this -
% x = 0:4;
y = 0:4;
z = y*5;
q = ones(5,1);
q = q';
for i = 1:length(z)
for j = 1:length(y)
scatter3(x,y(j)*q,z(i)*q)
hold on
end
end
end
Hope this helps!
1 Comment
Luke Mason
on 11 Apr 2018
Luke Mason
on 12 Apr 2018
0 votes
Categories
Find more on Scatter Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!