|
Michael Ashby wrote:
> Suppose I plot a transparent patch object as follows and add a legend:
>
> x = [0 0;0 1;1 1];
> y = [1 1;2 2;2 1];
> patch(x,y,'k', 'FaceAlpha', 0.5)
> legend('patch1')
>
> My problem is that the patch in the legend entry does not have the same
> 'FaceAlpha' value as my plotted patch - it therefore appears as
> non-matching, darker color. How can I control the legend entry to have a
> matching FaceAlpha?
Remember, FaceAlpha controls the blending of the colour with what-ever happens
to be underneath. As what is underneath the first patch is probably not the
same colour as what is underneath the legend, you are probably not going to be
able to match the legend patch colour to the figure patch colour, not unless
you use FaceAlpha of 1.
In any case, if you assign the output of legend() to a variable, it will be
the handle of the separate axis that the legend is drawn on. You can findobj()
from there to locate the patch within that axes, and set the properties of
that patch as you like.
|