开发者

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

开发者 https://www.devze.com 2023-01-15 05:59 出处:网络
Consider something like figure plot(sin(0:0.01:pi)) axis tight set(gca,\'box\',\'on\',\'ticklength\',[0.02 0.05])

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:

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

Default (Layer=bottom):

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

with Layer=top:

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号