필터 지우기
필터 지우기

How do I use >7 colours on a scatter plot?

조회 수: 1 (최근 30일)
Andy
Andy 2016년 6월 4일
댓글: Walter Roberson 2016년 6월 5일
Hi guys,
I have 62 time-distance plots (all stored in 'Picks' =[t,d,62] ) and want to display them together; But I can only produce a plot with a max of 7 colours (plot attached).
is there (i) a way to get 62 colours or better (ii) a way I can change plot symbol every 7 colours? (eg ., X, * ... so I dont reuse the same markers)
this is my code
for i = 1:62;
scatter(Picks(:,2,i), Picks(:,1,i),'.');
hold on ;
leg{i}=['FFID',num2str(i+365)];L{i}=i;
end;
a=~isnan(cell2mat(L)); l=leg(a); legend(l); hold off
Any help would be really appreciated! Thank you
Andy

답변 (1개)

Walter Roberson
Walter Roberson 2016년 6월 4일
pointsize = 25;
scatter(Picks(:,2,i), Picks(:,1,i), pointsize, i, '.');
and after
colormap(jet(62))
The i will be used as the colormap index.
  댓글 수: 2
Andy
Andy 2016년 6월 5일
편집: Andy 2016년 6월 5일
Thank you so much for helping! I completely see you're idea here, it makes sense - but I always get
"C must be a single color, a vector of the same length as X, or an M-by-3 matrix."
if this is the modified code;
pointsize = 25;
for i = 1:62
scatter(Picks(:,2,i), Picks(:,1,i),pointsize,i)
hold on
leg{i}=['FFID',num2str(i+365)];L{i}=i; % Assigning FFID to shot
end
colormap(jet(62))
'pointsize' works fine, the 'i' for c does not.
Walter Roberson
Walter Roberson 2016년 6월 5일
col = repmat(i, size(Picks,1), 1);
scatter(Picks(:,2,i), Picks(:,1,i), pointsize, col);

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by