Why isn't my legend matching my Graph
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Below Is my For loop in my main script. The actions are using my main functions. For some reason my legend doesnt match my graph that I made. Attached is the picture of what I'm getting. Only the first entry in the legend is correct, and the rest is the wrong color or wrong type of label ( ex/ a dot instead of a line). Please Help. Thanks in advance.
for n = 1:7
[Xo, Yo, Zo, Imag, theta, phi, omgX, omgY, omgZ] = read_input('A.data',n);
[T, X, Y, Z, U, V, W] = basketball( Xo, Yo, Zo, Imag, theta, phi, omgX, omgY, omgZ);
hold on
plotStyle = {'b','k','r','g','m','c','w'};
plot3(X,Y,Z,plotStyle{n})
plot3(Xcourt,Ycourt,Zcourt,'.','color',[0.5 0.2 0.3]);
plot3(Xrim,Yrim,Zrim,'-','color',[.8 0 0.8],'LineWidth',2);
plot3(Xboard,Yboard,Zboard,'.','color',[0.8 0.7 0.7]);
legend('Shot #1', 'Shot #2', 'Shot #3','Shot #4', 'Shot #5','Shot #6','Shot #7')
box on; grid on; axis tight; axis equal;
xlabel('x (m)'); ylabel('y (m)'); zlabel('z (m)');
title('Basketball Court');
view(2);
set(gca,'FontSize',16);
end
2 Commenti
Image Analyst
il 3 Dic 2017
You probably shouldn't have legend inside the loop because you'll have 7 curves the first time, 14 curves the second time, 21 curves the 3rd time, etc. but you're only doing 7 legends. Put the legend outside the loop.
Risposte (0)
Vedere anche
Categorie
Scopri di più su Legend in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!