How can I set transparency in geoshow map from a 2d array

I am trying to make a map that has a different transparency at each x,y as given by an array. The idea is to have a raster-generated colour-shading of the world surface, and then set the alpha at each pixel according to the population density at that point.
The map is generated from the 2d array Raster, using the reference R, and the alpha is given by alphas. Both arrays have the same dimensions. The values of alphas range from 0 to 1.
%code
figure
axesm('MapProjection','Mollweid')
h = geoshow(Raster,R,'DisplayType','texturemap','Alphadata',alphas)
There is no error message, but the resulting map does not have any transparency.
I have confirmed that the Rendered is openGL. I am using Matlab 2017a.
Thanks!

2 Comments

Hello, I have also had trouble adjusting transparency using geoshow, and wondering if you ever found a solution to your question? Thanks!
Yes! I ended up using the m_map package, and used the line
m_pcolor(lon,lat,VAR,'AlphaData',flipud(alphamap),'FaceAlpha','flat')
which works fine, where VAR is the plotted variable and AlphaData is a matrix of alpha values with the same dimensions as VAR. Hope that helps!

Sign in to comment.

Answers (0)

Products

Asked:

on 22 Jan 2018

Commented:

on 15 Aug 2018

Community Treasure Hunt

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

Start Hunting!