The node labels in a plotted graph are difficult to alter. You can get to them by digging into undocumented properties. For example:
'and an even longer label'
'qwertyuiopasdfghjklzxcvbnm'};
G = digraph(rand(3), nodes);
set(p.NodeChildren(2), 'rotation', 45);
But any changes you make are going to be very fragile. For example, this rotation reverts if the figure is resized. In my experience, things like that also revert when you try to save a figure, which make it a bit useless.
The more robust way to deal with this would be to remove the labels from the graph altogether, and add your own text labels:
'and an even longer label'
'qwertyuiopasdfghjklzxcvbnm'};
G = digraph(rand(3), nodes);
p = plot(G, 'nodelabel', '');
text(p.XData, p.YData, nodes, 'rotation', 45)
Best Answer