How do I change plot line widths?
Afficher commentaires plus anciens
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 commentaires
Star Strider
le 2 Fév 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
le 2 Fév 2019
Adam Danz
le 2 Fév 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
le 2 Fév 2019
Modifié(e) : Image Analyst
le 2 Fév 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
le 3 Fév 2019
Adam Danz
le 3 Fév 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
Réponses (1)
Aik-Siong Koh
le 8 Juil 2021
0 votes
See comments for answer.
Catégories
En savoir plus sur Marine and Underwater Vehicles dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!