displaying the colors of a color matrix

조회 수: 3 (최근 30일)
Leo Simon
Leo Simon 2015년 1월 18일
댓글: Leo Simon 2015년 1월 18일
Hi, I have a matrix of colors,
C = [.5142 0.7695 0.7258;
0.9300 0.8644 0.4048;
0.6929 0.6784 0.7951;
0.9154 0.4668 0.4158;
0.9227 0.6565 0.3574;
0.6528 0.8096 0.3829;
0.6856 0.4668 0.6893;
0.7914 0.7914 0.7914;
0.7440 0.8571 0.7185;
0.9191 0.7476 0.8352;
0.9191 0.7476 0.8352 ];
I'm looking for a command that will simply display each of these colors in some way that I can easily match the colors to the rows of the matrix. Have googled up and down for this, which has to exist somewhere.
Thanks very much, Leo

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2015년 1월 18일
figure
hold on
for k=1:size(C,1)
plot([0 1],[k k],'linewidth',8,'color',C(k,:))
end
  댓글 수: 1
Leo Simon
Leo Simon 2015년 1월 18일
Perfect thanks!
In case anybody else wants to use it, I tarted it up a bit.
n = size(C,1);
hold on;
for k=1:n;
plot([0 1],[k, k],'linewidth',8,'Color',C(k,:));
end;
set(gca,'XLim',[-0.1,1.1]);
set(gca,'YTick',1:n);
set(gca,'YLim',[0.9,n+0.1]);
set(gca,'XTick',[]);
ylabel('row number');

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by