about contour and transparent

2 visualizaciones (últimos 30 días)
Dawn
Dawn el 11 de Jun. de 2011
Editada: John Kelly el 2 de Mzo. de 2015
Hi,
I am trying to plot coutour overlaying on the top of imagesc. But my result is contour blocking the imagesc. I tried to make countour transparency.
So, please show me how to make countour transparency.
Thanks.

Respuesta aceptada

Walter Roberson
Walter Roberson el 11 de Jun. de 2011
thick = 0.8; %alpha value
ch = contourf(...);
patches = findobj(ch,'-property','AlphaData')
for ph = patches
set(ph,'AlphaData', thick * get(ph,'AlphaData'));
end
  2 comentarios
Dawn
Dawn el 11 de Jun. de 2011
Thank you.
My codes are: two dataset- d ,d1
imagesc(d); % plot figure
hold on;
thick = 0.8; %alpha value
ch =contour(d1,'black'); % overlay a transparent contour over imagesc
patches = findobj(ch,'-property','AlphaData');
for ph = patches
set(ph,'AlphaData', thick * get(ph,'AlphaData'));
end
Aftr running the codes, error message is:
Invalid handle
Error in ==> contourplot at 5
patches = findobj(ch,'-property','AlphaData');
Dawn
Dawn el 11 de Jun. de 2011
Thank you.
My codes are: two dataset- d ,d1
imagesc(d); % plot figure
hold on;
thick = 0.8; %alpha value
ch =contour(d1,'black'); % overlay a transparent contour over imagesc
patches = findobj(ch,'-property','AlphaData');
for ph = patches
set(ph,'AlphaData', thick * get(ph,'AlphaData'));
end
Aftr running the codes, error message is:
Invalid handle
Error in ==> contourplot at 5
patches = findobj(ch,'-property','AlphaData');

Iniciar sesión para comentar.

Más respuestas (1)

Jaime Calle
Jaime Calle el 4 de Jul. de 2011
Editada: John Kelly el 2 de Mzo. de 2015
Once you have the handle to contour plot (ch), look for 'FaceAlpha' property in the contour plot children.
Patches = findobj(ch,'-property','FaceAlpha');
Then you can set transparency value to those patches by means of:
set(Patches, 'FaceAlpha', thick)
For patches and surfaces, the object property is 'FaceAlpha':

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by