MATLAB Answers

How to colour some node in a graph

10 ビュー (過去 30 日間)
Light.16
Light.16 2016 年 10 月 5 日
回答済み: Steven Lord 2016 年 10 月 5 日
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!!!

  3 件のコメント

KSSV
KSSV 2016 年 10 月 5 日
Your figure is messy...where is blood part? where is cancer part?
Light.16
Light.16 2016 年 10 月 5 日
blood group = top right in the picture
but is this important? i ask in general... how can i do for colour differnt node with different colour?
KSSV
KSSV 2016 年 10 月 5 日
plot(x,y,'color')..use your own color.

サインインしてコメントする。

回答 (2 件)

elias GR
elias GR 2016 年 10 月 5 日
編集済み: elias GR 2016 年 10 月 5 日
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.

  0 件のコメント

サインインしてコメントする。


Steven Lord
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 件のコメント

サインインしてコメントする。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by