How can I draw a polar dendrogram over UIAxes in AppDesigner?

1 vue (au cours des 30 derniers jours)
Mohammad Shahbazy
Mohammad Shahbazy le 22 Août 2021
Hi All, I am trying to draw a polar dendrogram by the following code in the app designer but it does not work because it seems that UIAxes doesn't support polar dendrogram. I tried to set a panel as handle but it showed error. This code works with the "dendrogram" function. Can you please have a look on my code?
X = rand(1000,4);
Z = linkage(X,'ward');
estclustnum = 6; % estimated number of clusters
color = Z(end-estclustnum+2,3)-eps;
app.UIFigure.HandleVisibility = 'on';
set(0, 'CurrentFigure', app.UIFigure);
set(app.UIFigure,'CurrentAxes',app.UIAxes);
polardendrogram(Z,0,'ColorThreshold',color);zoom(app.UIAxes,1);
hold(app.UIAxes,'on');set(app.UIAxes,'XTickLabel',[],'XTick',[]);
app.UIFigure.HandleVisibility = 'off';

Réponse acceptée

Eric Delgado
Eric Delgado le 27 Sep 2022
Hey @Mohammad Shahbazy, I know that is an old question, but... maybe the answer help others. :)
dendrogram only works with old figure/axes, but you can use copyobj to deal with it. Below a callback for a button in a simple app.
function ButtonPushed(app, event)
X = rand(10,3);
tree = linkage(X,'average');
fig = figure('Visible', 0);
den = dendrogram(tree);
copyobj(den, app.UIAxes);
delete(fig)
end
You will get something like that...

Plus de réponses (0)

Catégories

En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by