How to change the style of plot with different colors using matlab?

1 回表示 (過去 30 日間)
RAFID AL-SAEEDI
RAFID AL-SAEEDI 2021 年 5 月 3 日
コメント済み: Rik 2022 年 1 月 3 日
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 件のコメント
Scott MacKenzie
Scott MacKenzie 2021 年 5 月 3 日
I don't think what you are attempting is possible. See the comments to this question.
Adam Danz
Adam Danz 2021 年 5 月 3 日

サインインしてコメントする。

採用された回答

Cris LaPierre
Cris LaPierre 2021 年 5 月 3 日
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 件のコメント
Rik
Rik 2022 年 1 月 3 日
Comment posted as answer by @RAFID AL-SAEEDI:
Thanks a lot dear. Thats is it
Regards

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by