Why does setting the "Visible" property for axes to "Off" also set the "Visible" property for title and axis labels, which are its children?

71 visualizaciones (últimos 30 días)
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'])

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 21 de Jul. de 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')

Más respuestas (0)

Etiquetas

Aún no se han introducido etiquetas.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by