Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Matlab area() edge colors cover the axes lines, is there a work around?

figure('Color', 'w')
box on
x = 1:10;
y = 5 * x + 2;
area(x, y, 'FaceColor', 'b', 'EdgeColor', 'b')

This code creates a figure with the area under the curve shaded blue. The EdgeColor property sets the trapezoidal line around the filled area to blue but this covers up the black axes lines and tick marks. I'm not sure why it does this or how to prevent it. I thought the axis would always have precedence. I can't figure out how to bring the axes lines and tick marks back into view over laying the filled area. Any ideas how to get this to work?

Update: 'EdgeColor', 'None' does not seem to work either.

like image 960
moorepants Avatar asked May 31 '11 00:05

moorepants


1 Answers

Try adding the following after your code for the figure (gca refers to the current axes):

set(gca,'Layer','top')
like image 142
astay13 Avatar answered Nov 05 '22 13:11

astay13