How do I change plot line widths?
Show older comments
I'm trying to plot two arrays of values and change the width of the resulting line, however I can't seem to get it to work. I've tried several approaches and nothing seems to be yielding any results.
plot(X_a,Y_a,'LineWidth',10);
6 Comments
Star Strider
on 2 Feb 2019
The obvious question is:
- What are ‘X_a’ and ‘Y_a’,(vectors, matrices, something else?) and
- What is the context of the code you are plotting them in?
This works when I plot it
X_a = 1:10
Y_a = sin(2*pi*X_a/10)
figure
plot(X_a, Y_a,'LineWidth',10)
figure
plot(X_a', Y_a','LineWidth',10)
so you are obviously not telling us some important information.
Benjamin Haag
on 2 Feb 2019
Adam Danz
on 2 Feb 2019
Could you share a screen shot of the results of the line below?
plot(X_a,Y_a,'LineWidth',10);
Something's probably off with your input variables. Here's an example of input matricies that procude lines and a functioning width parameter.
X_a = rand(4,4);
Y_a = rand(4,4);
plot(X_a, Y_a, 'LineWidth', 4)
Image Analyst
on 2 Feb 2019
Edited: Image Analyst
on 2 Feb 2019
Do you have the plot() inside a loop where you are plotting just one single point, instead of AFTER the loop where you are plotting a bunch of values at once?
You should also specify the line style, like
plot(X_a, Y_a, 'b*-', 'LineWidth', 10); % Plot blue line with asterisk markers
to make sure you're plotting a line rather than just markers.
Benjamin Haag
on 3 Feb 2019
Adam Danz
on 3 Feb 2019
If the m-file containing your function is stored on a remote driver or server, sometimes you need to rehash the path after making changes to the m file before those changes take effect.
rehash path
Answers (1)
Aik-Siong Koh
on 8 Jul 2021
0 votes
See comments for answer.
Categories
Find more on Marine and Underwater Vehicles in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!