How can I display axis ticks when using fill syntax?

2 ビュー (過去 30 日間)
Navid
Navid 2023 年 11 月 15 日
コメント済み: Star Strider 2023 年 11 月 16 日
Based on Figure 1, the axis ticks (bottom horizontal and right vertical) are hidden when using the fill syntax for my plot. Could you please help me display them again?
Figure 1:

採用された回答

Star Strider
Star Strider 2023 年 11 月 16 日
編集済み: Star Strider 2023 年 11 月 16 日
The easiest way is to bring the ticks to the top layer —
x = linspace(0, 1).';
y = x;
figure
fill([x; flip(x)], [zeros(size(y)); flip(y)], 'g')
Ax = gca;
Ax.Layer = 'top';
Ax.Box = 'on';
This uses the Layer property in the Axes Properties documentation.
Another option is to adjust the transparency ('FaceAlpha' value) of the patch.
.
EDIT — (16 Nov 2023 at 02:04)
Corrected typgraphical error.
.
  2 件のコメント
Navid
Navid 2023 年 11 月 16 日
I am grateful for your assistance. Thank you very much.
Star Strider
Star Strider 2023 年 11 月 16 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by