scatter with z dimension color express dates just in months

4 vues (au cours des 30 derniers jours)
Benjamin Cowen
Benjamin Cowen le 7 Juin 2019
Commenté : dpb le 7 Juin 2019
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 commentaire
dpb
dpb le 7 Juin 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...

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by