MATLAB Answers

Same colormap with colorbar which has two axes

22 views (last 30 days)
Jocelino Rodrigues
Jocelino Rodrigues on 2 Aug 2019
Answered: Rik on 13 Aug 2019
Hi,
I was wondering if it would be possible to have a colorbar with two variables (one on each side of the colorbar)?
I.e. if you take this Colorbar for example, I would like to also have different values on the left side of the colorbar for a different variable which shares the same units.
I hope my question makes sense!
Thank-you.

  0 Comments

Sign in to comment.

Answers (2)

John Doe
John Doe on 2 Aug 2019

  1 Comment

Jocelino Rodrigues
Jocelino Rodrigues on 3 Aug 2019
Unfortunately, that is not what I was looking for.
I wanted one colormap with a colorbar with two axes (two variables) where I get to pick the ticks for each of the variables on either side of the colorbar.
Hope that clarifies things?

Sign in to comment.


Rik
Rik on 13 Aug 2019
You can add a second tick row on the right side of the colorbar using the code below.
f=figure;
image
c_handle=colorbar;
%c_handle=findobj(get(f,'Children'),'Tag','Colorbar');
new_ax=axes(...
'Parent',f,...
'Units',c_handle.Units,'Position',c_handle.Position,...
'Color','none',...
'YTick',1:10,'YLim',[1 10],...
'XTick',[],...
'TickDir','out');

  0 Comments

Sign in to comment.


Translated by