Color Bar Classifying different time points

조회 수: 8 (최근 30일)
Systematically Neural
Systematically Neural 2018년 10월 4일
댓글: jonas 2018년 10월 16일
I have three sets of time - Time1, Time2, Time3. These three time points do not overlap. I would like to make a color bar to show when it is Time1, Time2 or Time3. this is hard to describe so I attached an image with the basic design. The idea being that this would continue for whatever times are in each of the three vectors.
Please let me know if I can clarify anymore.
  댓글 수: 3
Systematically Neural
Systematically Neural 2018년 10월 4일
I attached two matrices with time points. The plot just could be similar to the plot above, other than that I am not too picky!
jonas
jonas 2018년 10월 4일
편집: jonas 2018년 10월 4일
Oh, I thought you had some x-y data to go with the times. I have actually written a code for this exact type of plot before. I'll see if I can find it in my previous answers.
Edit: Here it is. I'll see if I can adapt it to your data.

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

채택된 답변

jonas
jonas 2018년 10월 4일
편집: jonas 2018년 10월 8일
Try something like this, which is based on a previous answer
n=length(t_comb_2(:));
subplot(1,2,1);
x=t_comb_2;
x=x';
x=x(:)';
tic
X=[0 x;0 x];
Y=[1.1.*ones(1,n+1);0.9.*ones(1,n+1)];
colormap(lines(n+1))
Z=linspace(0,1,n+1);
Z=[Z;Z];
surf(X,Y,Z)
view([0 90])
set(gca,'ycolor','none')
axis tight
ylabel('time')
.
Note that the colors were are determined by their z-value and the colormap lines. You can change the colormap and try different ones.
  댓글 수: 10
Systematically Neural
Systematically Neural 2018년 10월 16일
I have been trying to work with your solution and I do not htink that it is addressing what I asked
jonas
jonas 2018년 10월 16일
Its a bar with different color segments... How can it not be what you asked? Do you want time1 and time2 plotted in the same bar?? Are they not overlapping?

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by