Borrar filtros
Borrar filtros

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

3 visualizaciones (últimos 30 días)
Muhlbauer
Muhlbauer el 9 de Mzo. de 2012
Comentada: GunnarG el 20 de Mayo de 2021
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 comentario
GunnarG
GunnarG el 20 de Mayo de 2021
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');

Iniciar sesión para comentar.

Respuestas (2)

Walter Roberson
Walter Roberson el 9 de Mzo. de 2012
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 el 9 de Mzo. de 2012

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by