フィルターのクリア

How to increase line width non-uniformly for a single line Matlab 2021a

2 ビュー (過去 30 日間)
Varun Wadia
Varun Wadia 2021 年 11 月 3 日
編集済み: Yongjian Feng 2021 年 11 月 3 日
Hi all!
I wanted to create a plot whereI have a line tracing a systems evolution through time. I have 3 spatial coordinates and therefore would like to represent the time dimension by line thickness (i.e. the line starts thin and increases it's thickness as we get from one side of the plot to the other)
Is there a way to do this with Matlab?

回答 (1 件)

Yongjian Feng
Yongjian Feng 2021 年 11 月 3 日
編集済み: Yongjian Feng 2021 年 11 月 3 日
You can plot the whole line by one command, then the width is the same.
Or you can plot the line by segments. One plot call for every two consecutive points. Then you can control the width.
a = 1:30;
b = 1:30;
c = 2:31;
plot(a, b) % plotting the whole line
hold on
count = length(a);
w = 1;
for i=1:count-1
w = w + 0.1;
plot(a(i:i+1), c(i:i+1), 'LineWidth', w); % plot segment by segment and change width
end

カテゴリ

Help Center および File ExchangeVisual Exploration についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by