legend for plot3 command
39 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Indrajit Roy
am 18 Mär. 2020
Kommentiert: Adam Danz
am 20 Mär. 2020
I am going to plot two 3D data with the help of below command lines.
How can I insert legend for both the 3D data in a single window?
plot3(x,y,z);
hold on;
plot3(xx,yy,zz);
0 Kommentare
Akzeptierte Antwort
Adam Danz
am 18 Mär. 2020
Use the DisplayName property of graphics objects to specify the legend string.
plot3(x,y,z, 'DisplayName', 'Object1');
hold on;
plot3(xx,yy,zz, 'DisplayName', 'Object2');
legend()
or
p1 = plot3(x,y,z, 'DisplayName', 'Object1');
hold on;
p2 = plot3(xx,yy,zz, 'DisplayName', 'Object2');
legend([p1,p2])
4 Kommentare
Adam Danz
am 20 Mär. 2020
I understood. My previous comment shows what to do under those circumstances.
Another alternative:
legend([p1(:);p2(:)])
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Legend finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!