Azzera filtri
Azzera filtri

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

3 visualizzazioni (ultimi 30 giorni)
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 Commento
GunnarG
GunnarG il 20 Mag 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');

Accedi per commentare.

Risposte (2)

Walter Roberson
Walter Roberson il 9 Mar 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 il 9 Mar 2012

Categorie

Scopri di più su Line Plots in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by