Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Add date axis to colorbar

813 views
Skip to first unread message

Paul Dodd

unread,
Jan 8, 2008, 3:09:02 AM1/8/08
to
Hi all,

I would like to add date ticks to my colorbars in the same
way as one can to the x and y axes. I tried the following:

h=colorbar('v');
set(get(h,'datetick'),'string','x');

which returns:

??? Error using ==> get
There is no 'datetick' property in the 'colorbar' class.

Does anybody know a work-around? I'm sure I can't be the
only person who wants to plot time as a third dimension.

Many thanks,

Paul

Bastien

unread,
Jun 9, 2011, 1:19:04 PM6/9/11
to
This should do the trick:

h = colorbar;
datetick(h,'y');

"Paul Dodd" <p.d...@uea.ac.uk> wrote in message <flvb2u$il2$1...@fred.mathworks.com>...

Maxime Hervo

unread,
Aug 25, 2015, 9:41:11 AM8/25/15
to
> h = colorbar;
> datetick(h,'y');

Does not work since the changes in Matlab 2014b (h is a colorbar object not and Axes)

I am still looking for a workaround,
Anyone has a tricks?

All the best,
Max

dpb

unread,
Aug 25, 2015, 10:36:24 AM8/25/15
to
Have you contacted official support at <www.mathworks.com>? I haven't
upgraded so can't 'spearmint here, sorry...

--


aleday

unread,
Feb 17, 2016, 2:45:10 AM2/17/16
to
"dpb" wrote in message <mrhudq$epi$2...@dont-email.me>...
Seems as though post 2014b, colorbars have their own structure. Ergo, I've found the following lines to work, assuming that your color variable is date:
c=colorbar('SouthOutside'); % Note you can change position
c.TickLabels = datestr(c.Ticks);
0 new messages