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

1

11
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.

Ortiz answered 31/5, 2011 at 0:46 Comment(0)
L
12

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

set(gca,'Layer','top')
Literally answered 31/5, 2011 at 2:18 Comment(1)
great, that works! I added this after the area plotting commands and before box onOrtiz

© 2022 - 2024 — McMap. All rights reserved.