How to change the scaling of the Matlab color panel

It is very difficult for me to understand how to change the range of my color scale in Matlab2015b.

By default, it will be in the range from 0 to 1. I managed to change the label with:

    c=colorbar;
    c.Limits=[0 180] % the range that I want

The problem is that the colors do not scale when I do this, in other words, it will display from 0 to 180, but still uses the colors associated with [0 1], which makes the whole column look like a single color.

enter image description here

I used a different approach, just changing the checkboxes and doing:

colorbar('Yticks',[0:10:180]).

Again, the color indicator is still associated with 0 to 1, so none of the ticks except 0 will appear, since the first starts at 10.

enter image description here

How do I change the data on which it is based? I tried to change c.UserDatabut it does nothing.

+6
2

, , .

, ytick, , , , . yticklabel:

% Show the colorbar
c = colorbar;

% Define the desired ticks
ticks = [0:10:180];

% Sets the correct location and number of ticks
set(c, 'ytick', ticks / max(ticks));

% Set the tick labels as desired
set(c, 'yticklabel', ticks);
+2

, , :

limits = [0,180];
c = colorbar;
set(gca,'clim',limits([1,end]))

, .

  1. , -

enter image description here enter image description here

0

Source: https://habr.com/ru/post/1615404/


All Articles