MATLAB Answers

Vojtech
1

Figure: Move axis background above all graphics objects

Asked by Vojtech
on 19 Jul 2018
Latest activity Edited by Jan
on 20 Jul 2018
Accepted Answer by Jan
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.

  0 Comments

Sign in to comment.

Products


Release

R2015a

1 Answer

Answer by Jan
on 19 Jul 2018
 Accepted Answer

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 Comments

Thanks, that's what I was looking for. Unfortunately, it does not affect markers.
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.

Sign in to comment.