Is it possible to set an alpha value for each edge in a GraphPlot?
19 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Michael Kenning
il 6 Feb 2019
Commentato: Daniel Holstein
il 28 Set 2023
Colours for individual edges can be set.
% For individual edges
highlight(H, edge_idx, 'EdgeColour', [1,0,0]);
% For all edges
H.EdgeColour = % matrix with RGB-values for each edge
Opacity for all edges in the graph can be set, too.
H.EdgeAlpha = 0.01;
Unfortunately I cannot find a way to set alpha values for individual edges. Ideally, there should be a fourth channel in H.EdgeColour to control opacity.
Has anyone found a workaround?
0 Commenti
Risposta accettata
Christine Tobler
il 6 Feb 2019
Hi Michael,
We do not provide a way to set EdgeAlpha to be different for each edge. We just didn't expect this to be very useful, thinking it would be hard to read these subtle differences in a graph.
For the special case where you want all edges to either have the same alpha or be completely transparent, you could instead use 'LineStyle', 'none' to make some edges completely invisible (use the highlight method for a simpler way to do this).
If you are looking for something else, could you tell me more about what you are doing? What do the different alpha's represent? Are there only a few different alpha values, or is each one slightly different?
3 Commenti
Christine Tobler
il 13 Feb 2019
The LineStyle property is a scalar by default, this was done to simplify the workflow of setting all edges to the same LineStyle.
The highlight method allows setting the style for a subset of the edges, and will automatically initialize a cell array with one entry for each edge.
p = plot(graph(1, [2 3]));
highlight(p, 1, 3, 'LineStyle', '--')
Daniel Holstein
il 28 Set 2023
I am very surprised that you don't see a use case in assigning alpha to individual edges. As a systems ecologist I often create figures for publications with complex geographic networks. Setting alpha of low weight connections is extremely useful. Right now I get around this with custom code that avoides using digraphs all together, which is unfortunate.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Graph and Network Algorithms in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!