scatter with z dimension color express dates just in months

3 views (last 30 days)
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 Comment
dpb
dpb on 7 Jun 2019
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...

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!