Bluewhitered function in tiledlayout environment
3 次查看(过去 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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1709126/image.png)
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 中查找有关 Axis Labels 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!