Display colorbar with evenly spaced tick intervals but unequal difference between tick values

How to display colorbar with evenly spaced tick intervals (i.e., equal sized blocks) but with unequal difference between tick values? (I don't want a log scale)
I have attached a figure indicating the required format of colorbar.

Answers (1)

image
h=colorbar;
% change ticks and ticklabels to the values you want
h.Ticks=[0 10 20 30 40 50 100 200 255];
h.TickLabels = string([0 0.1 0.2 0.3 0.4 0.5 1 2 2.56]);

4 Comments

Thank you for the reply, but sadly this is not what I am looking for.
I want to change complete image/plot based on tick values and not want to manually modify the tick labels.
The whole plot should follow the tick intervals.
In the colorbar figure shared by me, the initial 1/3rd part conisits of values ranging form 0.01 to 0.1, and the last 1/3rd part have values ranging from 2 to 20.
I hope I am little more clear now.
You need to find the relationship between the original XTicks and the TickLabels you want. By changing them, you can obtain arbitrary ticks and labels.
Thanks for the suggestion. I wish I could do that. I only know basics in MATLAB.

Sign in to comment.

Asked:

on 27 Aug 2022

Commented:

on 31 Aug 2022

Community Treasure Hunt

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

Start Hunting!