안녕하세요 저는 컬러 바의 눈금 값에 따라 컬러 맵을 costomize하려고합니다. 파란색에서 빨간색으로 5 가지 색상으로 나만의 컬러 바를 정의했습니다.
cmap_my=[0 0 1;0 1 1;0 1 0; 1 1 0; 1 0 0];
내가 넣을 때마다 색이 변하기를 바랍니다. cbfit을 사용하면 틱이 0:40 범위에 균등하게 분포되어 있으면 틱에 따라 색상이 변경되지만 내 틱은
h = colorbar;
set(h,'YTick',[5,10,15,22,30,35,40]);
그리고 내 범위는 최대 45입니다. 또한 내가 정의한 색상은 내가 cbfit을 사용할 때 더 이상 표시되지 않습니다. 색상에 대한 특정 범위를 제공 할 가능성이 있습니까? 예를 들어 5 ~ 10 진한 파란색 10 ~ 15 연한 파란색 15 ~ 22 녹색 22 ~ 30 연한 노란색 30 ~ 35 노란색 35 ~ 40 주황색 및 40 이상 빨간색 진드기?
나는 당신의 문제를 이해하기를 바랍니다. 여기에 한 가지 예가 있습니다. 여기에서 특정 색상으로 작업 할 수 있습니다.
mri=load('mri');
mri=double(mri.D(:,:,1,13));
%making my image within the same range as yours
mri=(mri-min(mri(:)))./(max(mri(:))-min(mri(:)))*45;
figure,imagesc(mri),axis off,axis image,h_bar=colorbar;
%h_map(1) is related with the min(mri), and h_map(end) with max(mri)
h_map=colormap;
min_mri=0;
max_mri=45;
lim=eps*100;
my_map_int=[0-lim,5-lim,5+lim,10-lim,10+lim,40-lim,40+lim,45+lim];
my_map_color=[0,0,0;0,0,0;0,0,1;0,0,1;0,1,0;0,1,0;1,0,0;1,0,0];
new_map_color(:,1)=interp1(my_map_int,my_map_color(:,1),linspace(min_mri,max_mri,64),'nearest');
new_map_color(:,2)=interp1(my_map_int,my_map_color(:,2),linspace(min_mri,max_mri,64),'nearest');
new_map_color(:,3)=interp1(my_map_int,my_map_color(:,3),linspace(min_mri,max_mri,64),'nearest');
figure,imagesc(mri),axis off,axis image
colormap(new_map_color)
colorbar
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다