Why does setting the "Visible" property for axes to "Off" also set the "Visible" property for title and axis labels, which are its children?
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 10 Sep 2012
Modifié(e) : MathWorks Support Team
le 21 Juil 2020
I expected the axes "Visible" property to work as documented in the MATLAB Function Reference (Graphics Section). According to the documentation,
The Visible property of an axes object does not affect the children of axes.
But if I create a new axes, and add title and/or axis labels to it, and turn off the "Visible" option, then title and axis labels, which are children of the axes, also become invisible.
The documentation for the "Visible" property of axes is available here:
or you can execute the following command at the MATLAb command prompt:
web([docroot '/techdoc/ref/axes_props.html#Visible'])
Réponse acceptée
MathWorks Support Team
le 21 Juil 2020
The documentation on axes properties ("Visible" and "Children") is incorrect regarding the inheritance of parent object properties for the associated child objects, like TITLE and XLABEL.
As a workaround, to ensure that title and axis labels do not become invisible on making the axes invisible, you can use something like,
axes
title(‘axes title’)
xlabel(‘X-axis label’)
set(gca, 'visible', 'off')
set(findall(gca, 'type', 'text'), 'visible', 'on')
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Axis Labels dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!