Contourf and a background image: how set transparency ?

조회 수: 11 (최근 30일)
Mario Cilento
Mario Cilento 2017년 1월 13일
댓글: Kuifeng Zhao 2020년 11월 16일
Hello everyone. I have a contourf plot and I need to add in the same figure, as background image, a map. The issue is enhance trasparency of contourf layers.
I try to use my own code, helped by these forum, reported here:
% plotting image and contourf
img = imread('backgroud.png');
I=imagesc(img);
hold on;
[c,h]=contourf(X,Y,griddata(x,y,z,X,Y));
% setting trasparency
set(c, 'Renderer', 'OpenGL');
alphable = findobj(h, '-property', 'FaceAlpha');
set(alphable, 'FaceAlpha',0.5);
Even though the command 'Renderer' is applied directly to countourf's handles, this error occurs:
The name 'Renderer' is not an accessible property for an instance of class
'matlab.graphics.GraphicsPlaceholder'.
I'm working on a Matlab 2015b.
  댓글 수: 3

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

답변 (1개)

Jeff Barton
Jeff Barton 2019년 10월 22일
Undocumentedmatlab.com has the solution (which involves FacePrims field):
(See "Customizing the color" section)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by