How can I display axis ticks when using fill syntax?

5 vues (au cours des 30 derniers jours)
Navid
Navid le 15 Nov 2023
Commenté : Star Strider le 16 Nov 2023
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:

Réponse acceptée

Star Strider
Star Strider le 16 Nov 2023
Modifié(e) : Star Strider le 16 Nov 2023
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 commentaires
Navid
Navid le 16 Nov 2023
I am grateful for your assistance. Thank you very much.
Star Strider
Star Strider le 16 Nov 2023
As always, my pleasure!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Produits


Version

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by