フィルターのクリア

How to get different color with respect to an figure.

3 ビュー (過去 30 日間)
jaah navi
jaah navi 2019 年 3 月 1 日
コメント済み: Walter Roberson 2019 年 3 月 1 日
I have two figures first one with different colors and second one with one color.
Could anyone help me how to get the second figure with different color with respect to first figure.
code:
first figure
plot(PPP(:,1),PPP(:,2),'k*')
hold on
for cc=1:centroids
plot(PPP(c(:,a)==cc,1),PPP(c(:,a)==cc,2),'o','color',cluster_colors{cc});
end
second figure
figure
plot(1:N_UE,A,'-k*')
could anyone please help me on this.
  4 件のコメント
jaah navi
jaah navi 2019 年 3 月 1 日
the color of second figure should be the same with repect to first figure.
But with respect to the command used for plotting the second figure gives only one color.
Could you please help me to get the second figure with colors similar to first figure.
Walter Roberson
Walter Roberson 2019 年 3 月 1 日
Of course the second figure only gives one color: you only plot one line and you tell it that the line should be black ('k') with a simple solid line ('-') with asterisk marker ('*')
It is not possible to have multiple colors in a single line() object.
It is possible to create a single line() object and to scatter() markers on top of it, but it is not clear that is what you want.

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

採用された回答

KSSV
KSSV 2019 年 3 月 1 日
YOu should use the predefined colors to do that.
color = rand(6,3) ;
x = 1:6 ;
y = rand(size(x)) ;
figure(1)
hold on
for i = 1:6
plot(x(i),y(i),'*','MarkerEdgeColor',color(i,:)) ;
end
figure(2)
hold on
for i = 1:6
plot(x(i),y(i),'*','MarkerEdgeColor',color(i,:)) ;
end
plot(x,y,'b')

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Object Identification についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by