how to display a hggroup in plotbrowser

조회 수: 7 (최근 30일)
Markus Leuthold
Markus Leuthold . 2015년 9월 21일
댓글: Markus Leuthold . 2023년 6월 6일
How do I make a hggroup show up in the plotbrowser?
hg = hggroup;
hg.DisplayName='my data';
The code above does not work. I'd like to have a single entry in the plotbrowser for my datapoints.
shows a single legend entry as intended.
  댓글 수: 3
Markus Leuthold
Markus Leuthold 2023년 6월 6일
Just for reference, that's what I came up almost 8y ago: Create an invisible dummy which represents the hggroup
clf, plotbrowser on
hg = hggroup;
h1 = plot3([0 1],[0 0],[1 1], 'parent', hg);
hold on
h2 = plot3([0 1],[1 1],[1 1], 'parent', hg);
ax = ancestor(hg, 'axes');
hDummy = copyobj(h1, ax);
hDummy.DisplayName = "my group";
hDummy.Annotation.LegendInformation.IconDisplayStyle = 'off';
lp = linkprop([hg hDummy], 'Visible');
  • plotbrowser must be called before dummy creation
  • drawnow is needed, otherwise the dummy is not shown in the plotbrowser
  • a reference to the linkprop object needs to be kept in memory. A good location is in the UserData of the graphic object itself. Furthermore, linkprop() has (or at least used to have) a significant performance impact, which can be worked around with a custom stripped down linkprop()
All in all very hacky. I stumbled upon my own post again since I'm looking for a plot browser solution for the new web based uiaxes(). plotbrowser() only works with the old java based figure.

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

답변 (0개)


Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기


Community Treasure Hunt

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

Start Hunting!

Translated by