change scale for colorbar
조회 수: 10 (최근 30일)
이전 댓글 표시
Hello, can anyone help ,i will appreciate it very much.![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/250889/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/250889/image.jpeg)
I have three-figure with three different scale colorbar
I want to put one scale bar to them from min value to the max value how can I do that(one colorbar for 3 figure)
greetings to you all
댓글 수: 0
답변 (2개)
ME
2019년 11월 27일
Have you tried looking at the below link - seems like that might do what you want
댓글 수: 0
Adam Danz
2019년 11월 27일
편집: Adam Danz
2019년 11월 27일
You can set the color range of each subplot to be equal and then add a colorbar only to one of the plots. Then change the colorbar position.
Where ax is an axis handle and [min,max] is your color range.
댓글 수: 2
ME
2019년 11월 27일
This is fine but surely it would make the subfigure to which it is applied a smaller window than the others?
Adam Danz
2019년 11월 27일
편집: Adam Danz
2019년 11월 30일
By default, yes. That's why my answer suggests to change the colorbar position which would change the subplot back to it's standard size. Here's a demo for you to run
figure()
h = arrayfun(@(i)subplot(1,3,i),1:3);
cb = colorbar(h(end))
% After executing this line below, subplots will be same size.
cb.Position(1) = .93
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/250922/image.png)
참고 항목
카테고리
Help Center 및 File Exchange에서 Colorbar에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!