Using plot to generate a graph of a directed graph, how can i turn off the color of some lines
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am plotting digraphs of Markov matrices. I wish to use line thickness as a visual indicator of the strength or flow of the link on each edge. To do this, I must provide a non-zero thickness value for each line. This means that even lines which are not drawn must be dummied with a very tiny value in order for the links to have thicknesses proportional to the transition coefficient. I can live with that, but find I have drawn lines that cannot exist (We cannot normally go from death to a state of health). How can I change the color of these fake lines to white, so they cannot be seen? I am using the functions: tp4=TP*TP*TP*TP %raise transition probabilities to fourth power of a 6 x 6 transition matrix from health to death. tpp=tp4' %transpose to allow taking the columns wt=tpp(:) %create a vector from column values wt4=wt(1:31)*20+.01 %blow up the number to get a visual line width and add a fudge factor to adjust the natural zeros. names={'No Disability' 'Mild Disability' 'ADL Only' 'CI Only' 'ADL & CI' 'Dead'} gr4=digraph(tp4, names) plot(gr4,'layout','circle','LineWidth',wt4 )
Now--to wipe out the zero lines I have drawn?
0 comentarios
Respuestas (1)
Christine Tobler
el 21 de Feb. de 2018
You can set the LineStyle property of these edges to 'none', which will make them not display.
p = plot(gr4,'layout','circle','LineWidth',wt4);
highlight(p, wt4==0.01, 'LineStyle', 'none');
2 comentarios
Kelly Kearney
el 21 de Feb. de 2018
Minor syntax error in the suggested solution... to highlight edges, you need to provide the 'edges' input:
highlight(zz,'edges', LineW==.01,'LineStyle','none')
Ver también
Categorías
Más información sobre Graph and Network Algorithms en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!