フィルターのクリア

How do I change the color bar scale

299 ビュー (過去 30 日間)
Bajdar Nouredine
Bajdar Nouredine 2021 年 10 月 14 日
回答済み: Voss 2021 年 10 月 14 日
I want to change the scale from [0,1] to [36,45]
%% Example data
x = (1.9:-0.01:0);
data = sin(x);
d1= (44.86:-.0:38);
%% Shift the values towards the center, so you get a circle instead of an annulus.
rho = x-min(x);
%% Your meshgrid generation code.
theta = (0:360)*pi/180;
[th, r] = meshgrid(theta, rho);
[th1, r1] = meshgrid(theta, d1);
%% Plotting the values
surf(min(x)+r.*cos((th)), ...
min(x)+r.*sin(th), ...
repmat(data(:), 1, size(th,2)), ...
'linestyle', 'none');
view(2);
axis equal tight;
% contourf(peaks)
colorbar
colormap (flip(jet));

回答 (1 件)

Voss
Voss 2021 年 10 月 14 日
To set the colorbar scale to [36 45], add the following line at the end of your code:
set(gca,'CLim',[36 45]);
This will turn the circle all red since data is all less than 36.

カテゴリ

Help Center および File ExchangeColormaps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by