Legend in a Graph

조회 수: 3 (최근 30일)
Carlos Martins
Carlos Martins 2020년 4월 15일
댓글: Mehmed Saad 2020년 4월 15일
Hi,
I want to create a legend to a graph object. I don't create a bar color i want show a regular legend with the colors of the nodes. Just because i want to shown at what group belong each node and the bar color don't show properly. Could you help me?. Thanks.
  댓글 수: 2
Mehmed Saad
Mehmed Saad 2020년 4월 15일
can you explain a bit more? attach graph image
Tommy
Tommy 2020년 4월 15일
Carlos,
Can you provide the code you are using to plot your graph?

댓글을 달려면 로그인하십시오.

답변 (2개)

Carlos Martins
Carlos Martins 2020년 4월 15일
Sure,
I want something like this:
In a graph like:
Thanks

Mehmed Saad
Mehmed Saad 2020년 4월 15일
편집: Mehmed Saad 2020년 4월 15일
figure,plot(data_x,data_y,'.-','MarkerSize',10)
  댓글 수: 2
Carlos Martins
Carlos Martins 2020년 4월 15일
Thanks for the response.
But i need how to create the leyend. The second picture is a Graph object, and I need know if is possible create a regular leyend (not a color bar) like the showed in the first picture to the second one.
Mehmed Saad
Mehmed Saad 2020년 4월 15일
figure
s = [1 1 1 1 1 1 1 9 9 9 9 9 9 9];
t = [2 3 4 5 6 7 8 2 3 4 5 6 7 8];
G = graph(s,t);
plot(G);
hold on
s = [1 1 1 1 1];
t = [2 3 4 5 6];
G = graph(s,t);
plot(G);
v = legend;
v.String = {'1','2'};

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Legend에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by