異なる線幅で線をプロ​ットするにはどうした​らよいですか?

조회 수: 122 (최근 30일)
MathWorks Support Team
MathWorks Support Team 2024년 11월 13일
답변: MathWorks Support Team 2024년 11월 13일

次のようにプロットしたいのですが:

plot(x1, y1, x2, y2, 'LineWidth', 8)
LineWidthプロパティが両方の線に適用されてしまいます。線1と線2で異なる幅にするには、hold onコマンドを使って2つのプロット関数を使用する必要がありますか?ありがとうございます。

채택된 답변

MathWorks Support Team
MathWorks Support Team 2024년 11월 13일
異なる線幅で2本の線をプロットするには、以下のいずれかの方法を使用できます。
1.plot関数から2つの「Line」オブジェクトを出力引数として返し、それぞれのLineWidthプロパティを設定します。
p = plot(x1, y1, x2, y2); p(1).LineWidth = 5; p(2).LineWidth = 10;
2.hold onコマンドを使用して、2本の線を別々にプロットします。それぞれの線の幅を名前と値のペアを使って設定します。
plot(x1, y1, 'LineWidth', 5) hold on plot(x2, y2, 'LineWidth', 10) hold off
このようにして、異なる線幅で線をプロットすることができます。

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 書式設定と注釈에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!