From: Jim on
Has anyone found a solution to assigning a transparency level to a marker with a face color?

I am trying to plot markers on a map of the continental US.

% Plot conus shape file
ax = usamap('conus');
states = shaperead('usastatelo', 'UseGeoCoords', true, 'Selector',...
{@(name) ~any(strcmp(name,{'Alaska','Hawaii'})), 'Name'});
geoshow(ax, states, 'DisplayType', 'polygon', 'FaceColor','white')
framem off; gridm off; mlabel off; plabel off
set(gcf,'Position', [ 52 234 929 702], 'Color','white');

% Plot circular marker of specified size and color

plotm(40.00,-90.00,'o','MarkerFaceColor','g','MarkerEdgeColor',[0 0.4 0],'LineWidth',...
2,'MarkerSize',50);

.....This will yield a red circle in the middle of continental US, but I'd like to set a transparency level so that I can plot multiple circles, of varying sizes, that may overlap, using a for loop.

Thanks!
From: Walter Roberson on
Jim wrote:
> Has anyone found a solution to assigning a transparency level to a
> marker with a face color?

> plotm(40.00,-90.00,'o','MarkerFaceColor','g','MarkerEdgeColor',[0 0.4
> 0],'LineWidth',...
> 2,'MarkerSize',50);

See my recent comments in the thread "semi-transparent image or scatterplot"

I do not have the mapping toolbox, and I do not readily see documentation on
the internals of the linem() object, but if it works the same way that the
regular line() object works, then you will not be able to use my suggested
technique on lines created by plotm(). I do not see a mapping routine
equivalent to scatter(), but I do see patchm() which can be used to place
patches on a map.
From: Rob Comer on
Walter Roberson wrote:
> Jim wrote:
> > Has anyone found a solution to assigning a transparency level to a
> > marker with a face color?
>
> > plotm(40.00,-90.00,'o','MarkerFaceColor','g','MarkerEdgeColor',[0 0.4
> > 0],'LineWidth',...
> > 2,'MarkerSize',50);
>
> See my recent comments in the thread "semi-transparent image or scatterplot"
>
> ... if [linem] works the same way that the
> regular line() object works, then you will not be able to use my suggested
> technique on lines created by plotm(). I do not see a mapping routine
> equivalent to scatter(), but I do see patchm() which can be used to place
> patches on a map.

Actually, the Mapping Toolbox function scatterm is a close analog to the MATLAB scatter function. But neither will help you assign transparency to markers. It's the same for line, linem, patch, and patchm. Line objects in MATLAB have no transparency (alpha) properties. Patch objects have alpha properties for faces and edges, but not markers.

Rob Comer
Mapping Toolbox Development
MathWorks