How to change the style of plot with different colors using matlab?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
RAFID AL-SAEEDI
am 3 Mai 2021
Kommentiert: Rik
am 3 Jan. 2022
Hi dear community members, i want to change the ploting style. i want to reprsent x, y and z with different colors.
Please help me. i am using the following code.
1clear
clc
%%%%%%%%%%%
x= [150.4 98.2 97.9 44.9];
y= [10.1 9.3 9.3 7.8];
z= [170.6 116.8 116.5 60.5];
plot3(x,y,z)
grid on
5 Kommentare
Scott MacKenzie
am 3 Mai 2021
Adam Danz
am 3 Mai 2021
Background material on setting multi-colored line line
Akzeptierte Antwort
Cris LaPierre
am 3 Mai 2021
There are ways to do this, but not using plot. See this answer. It does require you determining a good way to get the colors to represent what you want.
x= [150.4 98.2 97.9 44.9];
y= [10.1 9.3 9.3 7.8];
z= [170.6 116.8 116.5 60.5];
lineColor = z;
% Modify the line with width so colors are easier to see
surface([x;x], [y;y], [z;z], [lineColor;lineColor],...
'FaceColor', 'no',...
'EdgeColor', 'interp',...
'LineWidth', 2);
grid on;
view(3)
1 Kommentar
Rik
am 3 Jan. 2022
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots 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!