how to display a hggroup in plotbrowser

How do I make a hggroup show up in the plotbrowser?
hg = hggroup;
hg.Annotation.LegendInformation.IconDisplayStyle='on';
hg.DisplayName='my data';
h=plot3(randn(5,5),randn(5,5),randn(5,5),'Parent',hg);
plotbrowser('show')
The code above does not work. I'd like to have a single entry in the plotbrowser for my datapoints.
BTW:
legend('show')
shows a single legend entry as intended.

3 Comments

If I understand correctly, you would like to have the right hand side, where the major objects are listed, indicate the hggroup as well as the axes? I agree, there does not seem to be a way to do that.
----
For my own reference, the below is the HG1 equivalent of your setup.
hg = hggroup;
t = get(hg,'Annotation');
t2 = t.legendInformation;
set(t2,'IconDisplayStyle','on')
set(hg,'DisplayName','my data')
hold on
h = plot3(randn(5,5),randn(5,5),randn(5,5),'Parent',hg);
yes exactly, I'm talking about the right hand side panel. I want to be able do toggle the visibility of all lines of a hggroup with one checkbox on that right hand side panel.
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);
drawnow;
hDummy.DisplayName = "my group";
hDummy.Annotation.LegendInformation.IconDisplayStyle = 'off';
lp = linkprop([hg hDummy], 'Visible');
Caveats
  • 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.

Sign in to comment.

Answers (0)

Products

Asked:

on 21 Sep 2015

Commented:

on 6 Jun 2023

Community Treasure Hunt

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

Start Hunting!