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.开发者_如何学C)
Is there a way (that can be automated) to have the axes drawn on top?
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:
精彩评论