Legend not displayed correctly

2 次查看(过去 30 天)
Afzal
Afzal 2013-4-21
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 个)

类别

Help CenterFile Exchange 中查找有关 Legend 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by