Plot line with custom color
5 ビュー (過去 30 日間)
How to plot a line with custom color in matlab?
I want to use the color [0 0.5 0]
Normally, I would plot it as: plot(x, y, '-g', 'LineWidth', 1) but not sure if this is the right syntax for what I want:
plot(x, y, -[0 0.5 0], 'LineWidth', 1)
Les Beckham 2023 年 5 月 3 日
編集済み: Les Beckham 2023 年 5 月 3 日
This looks a bit jaggedy and dark here, but looks good in my desktop Matlab.
If you had read the documentation for plot, you could have figured this out yourself.
x = linspace(0, 4*pi);
y = sin(x);
plot(x, y, 'Color', [0 0.5 0], 'LineWidth', 1)