How to change the linewidth of a curve in a graph by using code?

1 visualizzazione (ultimi 30 giorni)
like:
x=linspace(0,2*pi);
y=sin(x)
I want the sine curve's linewidth is 2.

Risposta accettata

uu tsi
uu tsi il 7 Ott 2016
use linewidth
x=linspace(0,2*pi);
y=sin(x);
plot(x, y, 'linewidth',2)

Più risposte (1)

Adam
Adam il 7 Ott 2016
Modificato: Adam il 7 Ott 2016
Well, you haven't plotted anything with that code, but assuming you do:
hLine = plot( x, y );
hLine.LineWidth = 2; % Matlab R2014b or later
set( hLine, 'LineWidth', 2 ) % Matlab R2014a or earlier
or simply
hLine = plot( x, y, 'LineWidth', 2 );
all at once
  1 Commento
bainhome
bainhome il 7 Ott 2016
sorry buddy, uu tsi is my friend, he ask me to ask him a question, just for the purpose of testing this new Q&A stuff, so i accept his answer, obviously your answer is great too. anyway, hope you don't mind.

Accedi per commentare.

Categorie

Scopri di più su Specifying Target for Graphics Output in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by