Filter löschen
Filter löschen

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

3 Ansichten (letzte 30 Tage)
Muhlbauer
Muhlbauer am 9 Mär. 2012
Kommentiert: GunnarG am 20 Mai 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 Kommentar
GunnarG
GunnarG am 20 Mai 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');

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Walter Roberson
Walter Roberson am 9 Mär. 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 am 9 Mär. 2012

Kategorien

Mehr zu Line Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by