Draw Matlab graphs with frame, ticks, on top of graph lines

Consider something like

figure
plot(sin(0:0.01:pi))
axis tight
set(gca,'box','on','ticklength',[0.02 0.05])

then export the graph to PDF or whatever. The lines of the graph are on top of the tick labels and the axes. (Furthermore, the lines of the axes don't meet correctly, but that's another story.)

Is there a way (that can be automated) to have the axes drawn on top?

Answers


Try:

set(gca, 'Layer','top')

according to the documentation page:

Layer

{bottom} | top

Draw axis lines below or above graphics objects. Determines whether to draw axis lines and tick marks on top or below axes children objects for any 2-D view (for example, when you are looking along the x-, y-, or z-axis). Use this property to place grid lines and tick marks on top of images.

and to visually see the effect (zoomed in 1200%), I save the figure as a PDF file:

Default (Layer=bottom):

with Layer=top:


Need Your Help

Implementing an interface with two abstract methods by a lambda expression

java lambda java-8 functional-interface

In Java 8 the lambda expression is introduced to help with the reduction of boilerplate code. If the interface has only one method it works fine. If it consists of multiple methods, then none of the

Why use @Transactional with @Service instead of with @Controller

hibernate spring-mvc service controller transactional

I have seen many comments in stack-overflow articles I found certain things about either @Transactional use with @Service or with @Controller