Changing the number of xticks on heatmat (without changing the data)

조회 수: 10 (최근 30일)
Camille Woicekowski
Camille Woicekowski 2020년 6월 25일
댓글: Camille Woicekowski 2020년 6월 25일
I am creating a heat map where the x-axis is a datetime when a measurement was taken. I have about 100 times when data was recorded. When all 100 ticks show up on the x-axis, its not legible so I want to only display time labels for every 10th measurement. I have tried using
ax = gca;
ax.XDisplayLabels = [date(1:10:end)];
But I get the error message "'XDisplayLabels' vector must contain the same number of elements as the 'XDisplayData vector'".
How do I map all 100 columns of data but only display every 10th xtick label?

답변 (1개)

Sindar
Sindar 2020년 6월 25일
Try:
xt=xticks;
xticks(xt(1:10:end))
If that doesn't work, it sounds like
ax = gca;
ax.XDisplayData = [date(1:10:end)];
% probably not necessary
ax.XDisplayLabels = [date(1:10:end)];
is the version of your solution that will work.
p.s. be warned that "date" is an existing function
  댓글 수: 5
Sindar
Sindar 2020년 6월 25일
It's not looking good. The properties I'd change just don't seem to exist for heatmap objects
Camille Woicekowski
Camille Woicekowski 2020년 6월 25일
Yeah, same. These properties don't seem to exist for heatmap, which is frustrating. Thanks for your help though

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

카테고리

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

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by