How to use plot3 with Pointwise Coordinates
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!