Visualizing values of nodes in a graph

2 ビュー (過去 30 日間)
Deepa Maheshvare
Deepa Maheshvare 2020 年 1 月 20 日
コメント済み: darova 2020 年 1 月 21 日
I'm trying to visualize the values assigned to graph nodes
tail = 1:9;
head = 2:10;
G = graph(tail,head);
data = rand(10,10);
for k=1:10
clf
G.Nodes.Value = data(:,k);
p = plot(G)
p.Marker = 's';
p.MarkerSize = 7;
p.NodeCData = G.Nodes.Value;
colorbar
%Add plotting options
grid on
title(['t = ',num2str(k)])
view([30 35])
movieVector(k) = getframe;
end
The color scale(colobar) keeps changing while iterating through each loop. But I want the colorbar to be fixed for all iterations.
For instance, currenly what happens is
For k = 1, if data(:,k) contains values that range from 1:10
and
for k = 10, if data(:,k) contains values from 10:100
colorbar is different for both k's.
Expected output:
I want to have a colorbar that has a color scale ranging from 1:100. This will ensure that the colorscale doesn't vary for all the iterations (i.e colorbar is the same for all iterations)
Any suggestions on how to do this will be really helpful.
  3 件のコメント
Deepa Maheshvare
Deepa Maheshvare 2020 年 1 月 21 日
This will display he colorbar only at the end. How do I see teh colorscale while the animation is playing?
darova
darova 2020 年 1 月 21 日
What if display colorbar before loop?

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

回答 (1 件)

Sindar
Sindar 2020 年 1 月 20 日
編集済み: Sindar 2020 年 1 月 21 日
Fix the axis limits right after creating the colorbar:
colorbar
caxis([1 100])

カテゴリ

Help Center および File ExchangeColorbar についてさらに検索

タグ

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by