필터 지우기
필터 지우기

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 CenterFile Exchange에서 Visual Exploration에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by