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

조회 수: 1 (최근 30일)
bainhome
bainhome 2016년 10월 7일
댓글: bainhome 2016년 10월 7일
like:
x=linspace(0,2*pi);
y=sin(x)
I want the sine curve's linewidth is 2.

채택된 답변

uu tsi
uu tsi 2016년 10월 7일
use linewidth
x=linspace(0,2*pi);
y=sin(x);
plot(x, y, 'linewidth',2)

추가 답변 (1개)

Adam
Adam 2016년 10월 7일
편집: Adam 2016년 10월 7일
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
bainhome
bainhome 2016년 10월 7일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by