Volume slices with multiple colormaps
5 次查看(过去 30 天)
显示 更早的评论
I would like to be able to plot multiple slices in one figure where each slice can have its own colormap and clims set. The purpose is to be able to plot mulitple quantities (such as fluid velocity and pressure) where the value ranges may not coincide.
I have tried to link two axes as suggested in the answer for this question. However, that solution doesn't handle occlusion very well as shown below.
load wind;
ax1 = gca;
s1 = slice(x, y, z, u, 100, [], 10);
ax2 = axes;
s2 = slice(x, y, z, 100*u, [], 40, []);
ax2.Visible = 'off';
colormap(ax2, 'jet');
linked_properties = {'CameraPosition', 'CameraUpVector',...
'PlotBoxAspectRatio', 'CameraTarget', 'XLim', 'YLim', 'ZLim',...
'DataAspectRatio', 'Position'};
hlink = linkprop([ax1,ax2], linked_properties);
view(145, 30);
Plotting all the slices on one axes fixes the occlusion issue but can only use a single colormap and clim as shown below.
Is this something that can be solved in MATLAB or is it just one of those quirks that you need to live with?
8 个评论
Adam Danz
2021-6-3
编辑:Adam Danz
2021-6-3
load wind;
ax1 = gca;
colormap('parula')
s1 = slice(x, y, z, u, 100, [], 10);
hold on
freezeColors(ax1)
colormap('hot')
s2 = slice(x, y, z, 100*u, [], 40, []);
The colorbar will only represent the last colormap, though. The documentation in freezeColors referrs to another file exchange function to handle that (not tested).
回答(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!