Changing the xticks in a heatmap to a datetime ticks

조회 수: 3 (최근 30일)
Gayan Lankeshwara
Gayan Lankeshwara 2020년 6월 21일
댓글: Ameer Hamza 2020년 6월 21일
I need to change the xticks of the following matrix to be in datetime format.
randMatrix = rand(5,10)
heatmap(randMatrix)
If I plot this, the xticklables are from 1 to 10.
But I need to change them as follows.
t1 = datetime(2020,06,21,8,0,0);
t2 = datetime(2020,06,21,17,0,0);
Time = t1:hours(1):t2 ;
So, I need to replace the xticks in the heatmap with the datetime ticks of Time ?
I tried this, but could not find what I want to do.

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 6월 21일
Try this
randMatrix = rand(5,10);
t1 = datetime(2020,06,21,8,0,0);
t2 = datetime(2020,06,21,17,0,0);
Time = t1:hours(1):t2 ;
h = heatmap(Time, 1:5, randMatrix);
  댓글 수: 4
Fego Etese
Fego Etese 2020년 6월 21일
Hello Ameer Hamza, sorry to contact you like this, but its really an emergency, please I need your help with this question
I will be grateful if you can help me out, thanks
Ameer Hamza
Ameer Hamza 2020년 6월 21일
Sorry! But I don't know how to solve that problem!

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by