Contourf and a background image: how set transparency ?

9 ビュー (過去 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)
  2 件のコメント
Alan Meier
Alan Meier 2020 年 7 月 12 日
Kuifeng Zhao
Kuifeng Zhao 2020 年 11 月 16 日
This works for me, Matlab 2020b. Thanks for sharing.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by