Uistack with GraphPlot (it looks like not working)
I have a GraphPlot array. Some of the GraphPlots have a name. Other GraphPlots, instead, do not have a name. I am trying to reorder the visual stacking of those GraphPlots by using their names, i.e. all the GraphPlots that have a name need to go to the top.
However, If I use
uistack(h(idx),’top’)
nothing changes.
How can I reorder that GraphPlot array, in such a way that GraphPlots without a name go to the bottom of the visual stacking and GraphPlots with a name go to the top?
I reproduced something similar to my case, with 5 Graphplots:
c = {‘b’,’k’,’m’,’y’,’r’};
s = [1 1 1 1 1 1 1 9 9 9 9 9 9 9];
name = {‘apple’,”,”,’banana’,’peach’};
% generate 5 arrays of t = randi([2 8],5,14);
t = [
3 3 4 5 4 6 8 6 2 5 2 8 3 2
6 3 5 5 6 4 5 3 3 2 6 7 6 5
5 7 6 2 2 7 7 8 2 5 5 8 5 8
7 8 6 7 4 4 3 5 6 4 2 8 3 2
7 8 4 8 8 5 6 8 6 5 6 7 4 2];
hold on
for i = 1 : size(t,1)
h(i) = plot(graph(s,t(i,:)),’LineWidth’,3,’EdgeColor’,c{i},’NodeColor’,c{i},’DisplayName’,name{i});
h(i).EdgeAlpha=1;
end
names_plots = {h.DisplayName};
idx = find(~cellfun(@isempty,names_plots));
uistack(h(idx),’top’)
legend(h)I have a GraphPlot array. Some of the GraphPlots have a name. Other GraphPlots, instead, do not have a name. I am trying to reorder the visual stacking of those GraphPlots by using their names, i.e. all the GraphPlots that have a name need to go to the top.
However, If I use
uistack(h(idx),’top’)
nothing changes.
How can I reorder that GraphPlot array, in such a way that GraphPlots without a name go to the bottom of the visual stacking and GraphPlots with a name go to the top?
I reproduced something similar to my case, with 5 Graphplots:
c = {‘b’,’k’,’m’,’y’,’r’};
s = [1 1 1 1 1 1 1 9 9 9 9 9 9 9];
name = {‘apple’,”,”,’banana’,’peach’};
% generate 5 arrays of t = randi([2 8],5,14);
t = [
3 3 4 5 4 6 8 6 2 5 2 8 3 2
6 3 5 5 6 4 5 3 3 2 6 7 6 5
5 7 6 2 2 7 7 8 2 5 5 8 5 8
7 8 6 7 4 4 3 5 6 4 2 8 3 2
7 8 4 8 8 5 6 8 6 5 6 7 4 2];
hold on
for i = 1 : size(t,1)
h(i) = plot(graph(s,t(i,:)),’LineWidth’,3,’EdgeColor’,c{i},’NodeColor’,c{i},’DisplayName’,name{i});
h(i).EdgeAlpha=1;
end
names_plots = {h.DisplayName};
idx = find(~cellfun(@isempty,names_plots));
uistack(h(idx),’top’)
legend(h) I have a GraphPlot array. Some of the GraphPlots have a name. Other GraphPlots, instead, do not have a name. I am trying to reorder the visual stacking of those GraphPlots by using their names, i.e. all the GraphPlots that have a name need to go to the top.
However, If I use
uistack(h(idx),’top’)
nothing changes.
How can I reorder that GraphPlot array, in such a way that GraphPlots without a name go to the bottom of the visual stacking and GraphPlots with a name go to the top?
I reproduced something similar to my case, with 5 Graphplots:
c = {‘b’,’k’,’m’,’y’,’r’};
s = [1 1 1 1 1 1 1 9 9 9 9 9 9 9];
name = {‘apple’,”,”,’banana’,’peach’};
% generate 5 arrays of t = randi([2 8],5,14);
t = [
3 3 4 5 4 6 8 6 2 5 2 8 3 2
6 3 5 5 6 4 5 3 3 2 6 7 6 5
5 7 6 2 2 7 7 8 2 5 5 8 5 8
7 8 6 7 4 4 3 5 6 4 2 8 3 2
7 8 4 8 8 5 6 8 6 5 6 7 4 2];
hold on
for i = 1 : size(t,1)
h(i) = plot(graph(s,t(i,:)),’LineWidth’,3,’EdgeColor’,c{i},’NodeColor’,c{i},’DisplayName’,name{i});
h(i).EdgeAlpha=1;
end
names_plots = {h.DisplayName};
idx = find(~cellfun(@isempty,names_plots));
uistack(h(idx),’top’)
legend(h) uistack, reorder, graphplots, visual stacking, stacking, order, plots MATLAB Answers — New Questions