- https://de.mathworks.com/matlabcentral/answers/203697-logarithmic-scale-for-colorbar
- https://de.mathworks.com/matlabcentral/answers/100066-how-do-i-create-a-logarithmic-scale-colormap-or-colorbar
- https://de.mathworks.com/matlabcentral/answers/393174-how-can-i-make-a-logarithmic-color-plot-and-colorbar
how to change the scale of an colour bar?
조회 수: 29 (최근 30일)
이전 댓글 표시
Hello, My plot range with variation from 0 to 3500, so I want to use an log scale colour bar instead of normal colour bar scale, so that I can show all the variations. please give some suggestion to change the colour scale of the colorbar into an log scale.
댓글 수: 0
답변 (1개)
Robert U
2018년 8월 9일
편집: Robert U
2018년 8월 9일
Hi Puspa patra,
Depending on Matlab version, you can go with different approaches. Known from older versions (prior 2018a):
% Create testdata
Data=magic(100);
% Define color levels to create
nLvl = 9;
% get min and max values of Data
minData = min(min(Data));
maxData = max(max(Data));
% define colorbar values on log scale
c = logspace(log10(minData),log10(maxData),nLvl);
% plot data in log-scale according to defined log scale values 'c'
contourf(log(Data),log(c));
% Change colormap to "bone"
colormap(bone);
% define color axis scaling according to 'c'
caxis(log([c(1) c(end)]));
% open colorbar
colorbar('YTick',log(c),'YTickLabel',c);
Kind regards,
Robert
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Colormaps에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!