How do I change plot line widths?
Ältere Kommentare anzeigen
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 Kommentare
Star Strider
am 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
am 2 Feb. 2019
Adam Danz
am 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
am 2 Feb. 2019
Bearbeitet: Image Analyst
am 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
am 3 Feb. 2019
Adam Danz
am 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
Antworten (1)
Aik-Siong Koh
am 8 Jul. 2021
0 Stimmen
See comments for answer.
Kategorien
Mehr zu Marine and Underwater Vehicles finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!