Filter löschen
Filter löschen

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

2 Ansichten (letzte 30 Tage)
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?

Antworten (1)

Yongjian Feng
Yongjian Feng am 3 Nov. 2021
Bearbeitet: Yongjian Feng am 3 Nov. 2021
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

Kategorien

Mehr zu Visual Exploration finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by