Change line width in graph

63 ビュー (過去 30 日間)
DavidL88
DavidL88 2022 年 7 月 13 日
コメント済み: Voss 2022 年 7 月 14 日
I have a plot with two lines. This plot was generated using a GUI that runs on MatLab. I want to change the width of the two lines using code rather than the plot editor. I used findobj to get the line handles but I can't get the code to work to change the width. I assume DataLine is the handle for both lines. I've tried variations of the last two lines below.
h2 = findobj('Type', 'line');
h2 =
5×1 Line array:
Line (TimeZeroLine)
Line (Cursor)
Line
Line (DataLine)
Line (DataLine)
line(DataLine,'LineWidth',10);
set(DataLine,'LineWidth',10);

採用された回答

Voss
Voss 2022 年 7 月 13 日
h2 = findobj('Type', 'line')
% h2 =
% 5×1 Line array:
% Line (TimeZeroLine)
% Line (Cursor)
% Line
% Line (DataLine)
% Line (DataLine)
% use index in h2 to refer to the lines you want to modify
set(h2([4 5]),'LineWidth',10)
  2 件のコメント
DavidL88
DavidL88 2022 年 7 月 14 日
That worked thanks.
Voss
Voss 2022 年 7 月 14 日
You're welcome!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by