Figure: Move axis background above all graphics objects

1 回表示 (過去 30 日間)
Vojtech
Vojtech 2018 年 7 月 19 日
編集済み: Jan 2018 年 7 月 20 日
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 Center および File Exchange2-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