Same colour for two curves in a plot
4 ビュー (過去 30 日間)
古いコメントを表示
Kenneth Bisgaard Cristensen
2021 年 4 月 7 日
コメント済み: Kenneth Bisgaard Cristensen
2021 年 4 月 7 日
Hi MATLAB Community,
I need to have the first and third cuve the same colour, how do i do that?
I would really ppriciate some help on how to do that.
a = [ 100, 65, 95];
b = [-100, 65, 90];
c = [50, 20, 20];
d = [-25, 20, 20];
x = linspace(-200, 100, 200)
for k = 1:numel(a)
y(k,:) = a(k)+b(k)*tanh((x+c(k))/d(k));
end
figure;
plot(x, y);
0 件のコメント
採用された回答
DGM
2021 年 4 月 7 日
Something like this. You'd just have to pick the colors you want.
h=plot(x,y);
set(h, {'color'}, {[1 0 0]; [1 0 1]; [1 0 0]});
その他の回答 (1 件)
Sajid Afaque
2021 年 4 月 7 日
you can also use color instead of triplets
h=plot(x,y);
set(h, {'color'}, {'r'; 'b'; 'r'});
2 件のコメント
参考
カテゴリ
Help Center および File Exchange で Data Distribution Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!