How to highlight with multiple colors?
古いコメントを表示
I would like to plot a graph and highlight edges with multiple colors, sometimes the same edge. If I use the highlight(h, G, ...) command it seems to overwrite the previous highlight command, even if I use hold on. Below is an illustrative example, the grah is a triangle on 1, 2, 3 and I wish to highlight edge 12 and 23 with 10 different colors in the hue scale, each with decreasing width. I added a pause command so the steps are visible and bunch of hold on's to see if any of them gives the desired result. But unfortunately the new highligh always overwrites the previous. I've tried additionally to create multiple edges but the highlight command colors all of them.
G = graph([1, 2, 1], [2, 3, 3]);
H = graph([1, 2],[2, 3]);
h = plot(G);
hold on
for I=1:10
hold on
highlight(h, H, 'EdgeColor', hsv2rgb([I/10, 1, 1]), 'LineWidth', 11-I);
hold on
pause(0.5);
end
hold off
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Graph and Network Algorithms についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!