scatter with z dimension color express dates just in months

9 ビュー (過去 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 Center および File ExchangeCalendar についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by