How to colour some node in a graph
조회 수: 18 (최근 30일)
이전 댓글 표시
Hello guys !
As you can see, i plotted a graph. In particoular this is the disease network. My problem is that all the graph is blue, and i would like that some part of the graph appear with different colour. For example.. that part of "blood gruop" could be red.. the part of "cancer" could appear green...
Can you help me?
I know that the function highlight can help me... but in which way?
thank you!!!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/156925/image.png)
댓글 수: 3
답변 (2개)
elias GR
2016년 10월 5일
편집: elias GR
2016년 10월 5일
Take a look here https://www.mathworks.com/help/matlab/ref/plot.html?searchHighlight=plot#inputarg_LineSpec You can give also RGB triplet https://www.mathworks.com/help/matlab/ref/colorspec.html
e.g. plot(x,y,'y.') if you want to plot a yellow dot at (x,y) point and then 'hold on' and plot(x2,y2,'g.') command to plot another dot with green color.
Specifically for graphs, take a look at that: https://www.mathworks.com/help/matlab/ref/graph.plot.html?searchHighlight=graph%2520plot
댓글 수: 0
Steven Lord
2016년 10월 5일
See the last section of the "Highlight Graph Nodes" example in the documentation page for the highlight function. That section highlights a subset of the nodes in a small graph with different colors by changing the NodeColor property of the GraphPlot object. As long as you can obtain a list of node IDs (node numbers as used in that example or node names) that you want to highlight, pass them in as the nodeIDs input argument to highlight like that example does.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Biotech and Pharmaceutical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!