I've got several patches in a figure (see minimal working example below). Currently, these patches have a face color that is determined by FaceVertexCData
, a scalar that references the current colorbar, and an edge color that is determined by EdgeColor
, a RGB vector. What I want to do is remove the face color and have the edges be the same color as the original face color of their respective patch.
Removing the face color is simple with the FaceAlpha
property, but I can't seem to figure out how to turn the FaceVertexCData
property into its equivalent RGB code so that I can assign it to EdgeColor
.
h.fig = figure;
h.patch(1) = patch([0 1 1 0],[0 0 .3 .3],10);
h.patch(2) = patch([0 1 1 0],[.5 .5 .9 .9],5);
set(h.patch, 'FaceAlpha', 0);
There's a very simple way to color your edges. If you make your color data the same size as your vertex data (i.e. the X
and Y
arguments), you can set the 'EdgeColor'
property to 'flat'
so that it uses the interpolated color values from your colormap:
h.fig = figure;
h.patch(1) = patch([0 1 1 0], [0 0 .3 .3], 10.*ones(1, 4));
h.patch(2) = patch([0 1 1 0], [.5 .5 .9 .9], 5.*ones(1, 4));
set(h.patch, 'FaceColor', 'none', 'EdgeColor', 'flat');