How do I make a rectangle semi-transparent?
I can draw a rectangle with
rectangle('Position',[0 3 1 1],'EdgeColor','blue','FaceColor',[0 0 0])
but rectangle does not have a FaceAlpha property
I see something about using annotation
but get an error when position values are outside of 1
annotation('rectangle',[0 3 1 1])
??? Error using ==> annotation at 130
position values must be between 0 and 1
so does anyone know how I can draw a semi transparent rectangle? thanks.
ANNOTATION uses a percentage of the figure size instead of coordinates.
For example:
figure;
annotation('rectangle',[.2 .4 .1 .1]);
% 20% across x, 40% across y, 10% width,10%height
-Sean
You can't. Use a patch() instead. (In general, this may require calculating
the vertices of the approximation to the curve, if you specify curvature. The
example you gave is a straight-forward four-vertex patch.)