Bluewhitered function in tiledlayout environment
조회 수: 1 (최근 30일)
이전 댓글 표시
Dear all
I am using this nice customized function, https://es.mathworks.com/matlabcentral/fileexchange/4058-bluewhitered. When I use it in a tiledlayout environment, the individual colorbar for each of the plots is not centered in zero for the white colour:
u1=figure('visible','off','units','pixels','position',[0 0 1920 1080]);
tiledlayout("horizontal");
ax1=nexttile;
uimagesc(space_x,space_y,x);
axis xy;
colormap(gca,bluewhitered(256));
box on;
clr1=colorbar;
set(clr1,'TickLabelInterpreter','latex');
clim([-1 1]);
xlim([0 500]);
xticks([0:100:500]);
ylim([0 500]);
yticks([0:100:500]);
pbaspect([1 1 1]);
xtickangle(0);
set(gca,'TickLabelInterpreter','latex','FontSize',18);
ax2=nexttile;
uimagesc(space_x,space_y,y);
colormap(gca,bluewhitered(256));
axis xy;
box on;
clr2=colorbar;
set(clr2,'TickLabelInterpreter','latex');
clim([-1 1]);
xlim([0 500]);
xticks([0:100:500]);
ylim([0 500]);
yticks([0:100:500]);
pbaspect([1 1 1]);
xtickangle(0);
set(gca,'TickLabelInterpreter','latex','FontSize',18);
ax3=nexttile;
uimagesc(space_x,space_y,z);
box on;
axis xy;
colormap(gca,bluewhitered(256));
clr3=colorbar;
set(clr3,'TickLabelInterpreter','latex');
clim([-1 1]);
xlim([0 500]);
xticks([0:100:500]);
ylim([0 500]);
yticks([0:100:500]);
pbaspect([1 1 1]);
xtickangle(0);
set(gca,'TickLabelInterpreter','latex','FontSize',18);
set(gcf,'color','white');
set(gca,'Units','normalized');
set(u1,'Units','Inches');
posu1=get(u1,'Position');
set(u1,'PaperPositionMode','Auto','PaperUnits','Inches','PaperSize',[posu1(3),posu1(4)]);
I have tried to add "gca" to the colormap() environment, as suggested in the discussions of the function, but it does not seem to do the job.
Any ideas?
댓글 수: 0
채택된 답변
DGM
2024년 6월 4일
Unlike other map generators, bluewhitered() depends on the caxis of the current axes. You need to generate the map after you set caxis. If your subplots have different caxis symmetry about 0, then you must regenerate the map each time.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Axes Appearance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!