Legend not displayed correctly
조회 수: 2 (최근 30일)
이전 댓글 표시
I am plotting a 3-D plot of hand positions. 'Target positions' are marked with an 'o' in green. But when the legend comes up both hand and target positions are shown as straight lines.
for i = 1:length(filtered_hand)
plot3(handles.axes4, filtered_hand(i,1), filtered_hand(i,2), filtered_hand(i,3))
hold on
% This for loop is used to check whether 'i' is equal to the index of a
% target position. If it is, the target position with an 'o' and the % coordinates of the target are displyed on
% the GUI in a static text box.
for j = 1:8
if i == index(j)
plot3(handles.axes4, filtered_hand(index(j),1), filtered_hand(index(j),2), filtered_hand(index(j),3), 'o g')
set(handles.text1, 'String', ['The position of target ' num2str(j) ' is x = ' num2str(filtered_hand(index(j),1),3) ' m y = ' num2str(filtered_hand(index(j),2),3) ' m z = ' num2str(filtered_hand(index(j),3),3) ' m '])
hold on
end
end
xlabel(handles.axes4, 'x positions(m)')
ylabel(handles.axes4, 'y positions (m)')
zlabel(handles.axes4, 'z positions (m)')
title(handles.axes4, 'Hand positions through movement')
grid on
pause(10^-11)
end
legend(handles.axes4, 'Hand position', 'target position')
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Legend에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!