Figure: Move axis background above all graphics objects

2 次查看(过去 30 天)
Here is a simple code which produces the figure on the left:
figure; box on; hold on;
line([0,1],[0,1],'LineWidth',10);
scatter(1,0,100,'filled');
Is it possible to stack gray background above graphics objects to get the figure on the right?
Command "set(gca,'Layer','top')" set just the black axis above the objects but not the gray background.

采纳的回答

Jan
Jan 2018-7-19
Start with
figure;
axes('ClippingStyle', 'rectangle', ... % Crops the line already
'box', 'on', ...
'NextPlot', 'add'); % Equivalent to: hold on
line([0,1],[0,1],'LineWidth',10);
scatter(1,0,100,'filled');
  2 个评论
Vojtech
Vojtech 2018-7-19
Thanks, that's what I was looking for. Unfortunately, it does not affect markers.
Jan
Jan 2018-7-20
编辑:Jan 2018-7-20
I did not find a solution for the marker also. What about using line objects to simulate markers? You need a modified version of scatter.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

产品


版本

R2015a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by