fill plot and transparency < 1 removes lines of x-axis and y-axis. Why?

2 次查看(过去 30 天)
The following code works nicely if transparency is 1. If transparency < 1 the lines of the x and y-axis disappear. Why is that?
clear all; close all;
color = 'r';
alpha = .3;
x = linspace(0,1,10)';
y1= x.^2;
y2= 2.*x.^2;
figure;
hold on;
plot(x,0.5.*(y1+y2),'b','Linewidth',2.);
h = fill([x; flipud(x)],[y1; flipud(y2)],color);
set(h,'FaceColor',color,'EdgeColor',color,'FaceAlpha',alpha,'EdgeAlpha',alpha);
box 'on';
  1 个评论
GunnarG
GunnarG 2021-5-20
For the case, other people are searching for a solution:
This link shows a simple solution: just put the axes on top at the end:
set(gca, 'Layer', 'top');

请先登录,再进行评论。

回答(2 个)

Walter Roberson
Walter Roberson 2012-3-9
I think this might be the same thing Jan described at http://www.mathworks.com/matlabcentral/answers/25028-bug-in-pcolor
OpenGL is the only renderer that supports transparency, so possibly your figure is being rendered by painters or zbuffer until you add transparency after which it hits the OpenGL-specific bug.

Sean de Wolski
Sean de Wolski 2012-3-9

类别

Help CenterFile Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by