MATLAB에 표시하고 일부 데이터 (별도의 이미지)를 오버레이하려는 이미지가 있습니다. 이 두 이미지에 대해 두 개의 다른 컬러 맵을 사용하고 있지만 두 개의 컬러 바를 얻을 수없는 것 같습니다. 두 맵을 모두 포함하는 컬러 바도 괜찮습니다. 이것은 지금까지 내 코드입니다.
close all; clc;
figure(1)
im1 = ind2rgb( gray2ind(mat2gray(f,[.1 1]),256), spring(256));
h1 = imshow( im1, [.1 1] );
hold on;
colorbar
FA(isnan(FA)) = 0;
alpha = ones( size(f) );
alpha(mapvis) = 0;
im2 = ind2rgb( gray2ind(mat2gray(FA,[0 1]),256), bone(256));
h2 = imshow( im2, [0 1] );
set(h2, 'AlphaData', alpha);
colorbar
hold off
%cdata1 = h1.CData;
%cdata2 = h2.CData;
%cc = [cdata1; cdata2];
(저는 운없이이 예제를 따라 컬러 맵을 연결하려고 할 때 몇 가지 주석을 포함했습니다. https://se.mathworks.com/matlabcentral/answers/101346-how-do-i-use-multiple-colormaps-in- a-single-figure # Example_1 ) 결과 다음 플롯이 생성됩니다. 내가 찾고있는 것이 아닙니다.
단일 그림에 여러 컬러 맵을 포함하는 한 가지 방법이 있습니다. 아이디어는 여러 Axes 객체를 서로 위에 오버레이하고 Axes 배경을 투명하게 만들어 플롯이 서로 오버레이되도록하는 것입니다. 이것은 2D 뷰에서만 잘 작동합니다. 3D보기에서 플롯 / 표면이 서로 잘못 겹칩니다.
clear all;
close all;
clc;
ax = gca;
ax(2) = copyobj(ax, ax.Parent);
linkprop(ax, {'XLim', 'YLim', 'ZLim', 'Position', 'View'});
[x, y, z] = peaks;
% plot onto first axes
pcolor(ax(1), x, y, z);
shading(ax(1), 'interp')
% plot onto second axes, arbitrarily shifting the data to a new range
contour(ax(2), x, y, -z+10, 10);
% set the colormap and CLims of each axes
set(ax(1), 'CLim', [-10, 10], 'Colormap', parula);
set(ax(2), 'CLim', [0, 20], 'Colormap', bone);
% Make the second axes invisible
set(ax(2), 'Color', 'None', 'XColor', 'none', 'YColor', 'none', 'ZColor', 'none');
% make the colorbars
cb(1) = colorbar(ax(1), 'East');
cb(2) = colorbar(ax(2), 'South');
적합하다고 판단되면 Colorbar 및 Axes Position을 수동으로 조정해야합니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다