MATLAB: Does setting the “Visible” property for axes to “Off” also set the “Visible” property for title and axis labels, which are its children

MATLAB

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'])

Best Answer

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')