How to use plot3 with Pointwise Coordinates
1 view (last 30 days)
Show older comments
Hi,
I want to plot data that is stored in arrays containing their coordinates with plot3, as Point1 containing [x1,y1,z1] and draw lines between them. But I do not want to pass them one coordinate each. My favorite notation would be something like:
point1 = [1 1 1];
point2 = [2 2 2];
plot3(point1,'marker','.','MarkerSize',25);
plot3(point2,'marker','.','MarkerSize',25);
plot3(point1, point2, 'LineStyle', ':', 'LineWidth', 2);
Limited by my current knowledge I would write the plot lines as:
plot3(point1(1),point1(2),point1(3),'marker','.','MarkerSize',25);
plot3(point2(1),point2(2),point2(3),'marker','.','MarkerSize',25);
plot3([point1(1),point2(1)],[point1(2),point2(2)],[point1(3),point2(3)], 'LineStyle', ':', 'LineWidth', 2);
But this appears overly cumbersome to me. Is there any command or trick I missed. Can I pass an array with point coordinates to plot3 or is there a way to pass the array elementwise with an elegant trick.
P.S.: I have named the points as point1 and point2 for clarity usually I would store them in an array of points.
0 Comments
Answers (0)
See Also
Categories
Find more on Line 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!