scatter with z dimension color express dates just in months

조회 수: 2 (최근 30일)
Benjamin Cowen
Benjamin Cowen 2019년 6월 7일
댓글: dpb 2019년 6월 7일
I have this code:
figure()
pointsize = 30;
scatter(x,y, pointsize, date,'filled');
set(gca,'yscale','log')
xlabel('x');
ylabel('y');
grid on;
colorbar
The z axis is date in the typical format MATLAB likes (a 5 digit number) Instead of showing dates on the colorbar like 43500, how do I show just the tic marks for the month?
I tried this which seems to work, but how do I just show the month? not the days and year?
c=colorbar('SouthOutside'); % Note you can change position
c.TickLabels = datestr(c.Ticks);
This also seems to get the year wrong. But I just want the month.
edit: Ok this is working, but I have several tics for each month. How do I reduce number of tics?
formatOut = 'mmmm';
c=colorbar('SouthOutside'); % Note you can change position
c.TickLabels = datestr(c.Ticks,formatOut);
  댓글 수: 1
dpb
dpb 2019년 6월 7일
W/O data to try to match what you're doing it's pretty-much impossible to be able to do anything specific...attach a sample test case that illustrates the issue that folks can piddle with without having to try to reproduce your work on their own...

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Axes Appearance에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by