How to use plot3 with Pointwise Coordinates

조회 수: 1 (최근 30일)
Sven
Sven 2015년 7월 17일
편집: Sven 2015년 7월 17일
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개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by