[How To] Set the transparency of a MATLAB plot

Some days ago I was trying to generate a graphic of the projected EIRP over Spain using a MATLAB plot. I wanted to superimpose my results on a map I had found on the Internet, but I was unable of making the picture translucent.

MATLAB plot showing EIRP projected over Spain

Final result

Map of Spain

Map of Spain

EIRP plot

EIRP plot

This is a very common procedure when dealing with layers on a graphical editor software like GIMP or Photoshop. There’s usually a parameter called “opacity” that let’s you set the transparency of the layer in a MATLAB plot.

Given this, I was sure that MATLAB would have a similar option. After some time of googling I found it. After plotting some data you can use a handle to the plot for setting a parameter called “AlphaData”. This parameter represents the opacity of the plot in the range [0,1] (where 0 means “Invisible” and 1 means “No transparency at all”).

So you can do something like this:

imshow('Map.jpg'); hold on;
PIREhand = imagesc( ... );
set(PIREhand, 'AlphaData', 0.6);


Map Image: desfaziendoentuertos