필터 지우기
필터 지우기

Overlap a surf() over an image() with different colormap

조회 수: 15 (최근 30일)
Ricardo Ferreira
Ricardo Ferreira 2015년 5월 22일
답변: Ricardo Ferreira 2015년 5월 31일
Hi!
I have to different objects, one is an image, the other is a surface wit x,y,z,and c components.
When I do surf() by itself i get a nice colormap from red to blue (the jet one), but when i do
% Image data
im1 = imagesc(pic); hold on
% Strain data
x1 = pic_data{1}{1};
y1 = pic_data{1}{2};
z1 = zeros(size(x1,1),size(x1,2));
c1 = strain_data{1}{variable};
s1 = surf(x1,y1,z1,c1,'FaceAlpha',0.5);
I can't observe the changes in the s1 surface colormap.
Any ideas?

답변 (4개)

Image Analyst
Image Analyst 2015년 5월 22일

Walter Roberson
Walter Roberson 2015년 5월 22일
convert your imagesc to truecolor (RGB) so that you can image() it without caring about the color map. That frees the colormap for the surf() purposes.
See the File Exchange contribution freezeColors()
  댓글 수: 4
Ricardo Ferreira
Ricardo Ferreira 2015년 5월 30일
I would like to make imagesc or imshow of an image, and then put a surf like the one in the bottom over it, but maintaining the colormap. Attention, because the surface ranges from -1 to 1!
When i do imagesc(a),hold on, surf(s), view(2)
The colormap of the 2nd image is lost and I get only the blue color
Image Analyst
Image Analyst 2015년 5월 30일
But your bottom array is only 50 by 45 while the image above is much larger than that. Where exactly did you want to put this smaller image in the larger image? In the middle, upper left, or do you want to scale it to the same size as the larger image?

댓글을 달려면 로그인하십시오.


Walter Roberson
Walter Roberson 2015년 5월 30일
%choose a colormap for the first plot. If you want to use the default
%then comment out this next line:
colormap pink;
%record the colormap in use
cmaps{1} = colormap();
%plot first object
h(1) = imagesc(a);
hold on
%choose a colormap for the second plot. If you want to use the default
%or the same as the previous, then comment out this next line:
colormap flag;
%record the colormap in use
cmaps{2} = colormap();
%plot the second object
h(2) = surf(s);
%Now manipulate the colormap and settings so the two plots are independent:
multicmap(h, cmaps);

Ricardo Ferreira
Ricardo Ferreira 2015년 5월 31일
Thank you all, but i could solve the problem using set(handle,'CLim') in the surface object!

카테고리

Help CenterFile Exchange에서 Red에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by