필터 지우기
필터 지우기

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

조회 수: 3 (최근 30일)
Muhlbauer
Muhlbauer 2012년 3월 9일
댓글: GunnarG 2021년 5월 20일
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에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by