How can I obtain opaque patch in a subplot with a mesh command in another subplot?
Show older comments
The command
patch_1 = patch(x_circle,y_circle,'r');
set(patch_1,'facealpha',1);
does not make the circles opaque in a subplot if in another subplot there is the command mesh.
Example:
x=-1:0.1:1;
y=-1:0.1:1;
[x,y]=meshgrid(x,y);
x=x';
y=y';
f=inline('x.^2+y.^2','x','y');
f=feval(f,x,y)
clf
subplot(1,2,2)
theta=0:0.1:2*pi;
x_circle=-0.5+cos(theta);
y_circle=0+sin(theta);
patch_1 = patch(x_circle,y_circle,'r');
set(patch_1,'facealpha',1);
x_circle=cos(theta);
y_circle=sin(theta);
patch_2 = patch(x_circle,y_circle,'r');
set(patch_1,'facealpha',1);
x_circle=0.5+cos(theta);
y_circle=0+sin(theta);
patch_3 = patch(x_circle,y_circle,'g');
set(patch_3,'facealpha',1);
axis equal
axis([-2 2 -2 2])
subplot(1,2,1)
mesh(x,y,f)
axis([-1 1 -1 1 0 2])
without the subplot(1,2,1) we obtain three opaque circles, but with the two subplot in the same figure windows, the contour lines of the three circles appear overlapped and transparent.
Can I obtain (Matlab2011b) the circles completely opaque (also for the contour lines) in the subplot?
Thank you
Accepted Answer
More Answers (0)
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!