ConstantLine not showing up in plotbrowser

6 ビュー (過去 30 日間)
PLR
PLR 2023 年 5 月 11 日
コメント済み: Walter Roberson 2024 年 2 月 12 日
When drawing a ConstantLine with xline or yline, it doesn't show up in the plotbrowser.
Ex :
xline(5, 'DisplayName', 'test'); plotbrowser;
How to solve this ?
  2 件のコメント
Peter
Peter 2024 年 2 月 12 日
編集済み: Peter 2024 年 2 月 12 日
I'm having, what may be, similar issues.
I have tried to use findobj('type', 'constantline') and given the "xlines" a tag (findobj('tag', 'xlinetag') but this results in a 0x0 graphicsobj.
Using R2022B
Walter Roberson
Walter Roberson 2024 年 2 月 12 日
If you happen to be drawing into a uiaxes then the handlevisibility of the axes might be set to off so findobj() might not notice the handle. Try findall('tag', 'xlinetag')

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

回答 (1 件)

Shaik
Shaik 2023 年 5 月 11 日
編集済み: Shaik 2023 年 5 月 11 日
Hi Pierre,
By default, ConstantLines drawn with xline or yline may not show up in the Plot Browser when using MATLAB R2019b or earlier versions. This is a known issue with these versions of MATLAB, but it has been fixed in MATLAB R2020a and later versions.
To work around the issue in MATLAB R2019b or earlier versions, you can manually add a legend entry for the ConstantLine using the legend function. Here's an example:
Hope it helps.
x = 1:10;
y = x.^2;
figure;
plot(x, y);
hold on;
h = xline(5, 'DisplayName', 'test');
legend(h, 'Location', 'south');
  1 件のコメント
PLR
PLR 2023 年 5 月 11 日
編集済み: PLR 2023 年 5 月 11 日
Hello Shaik, I am using R2020b and this solution does not work neither.
I am not speaking about the legend, but about the plot browser that I extensively use to select/deselected named lines. Here is the result with your solution.
I am waiting for the ConstantLine to appear in the right panel with name 'test'.

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

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by