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

209 views (last 30 days)
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'])

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 21 Jul 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,
title(axes title)
xlabel(X-axis label)
set(gca, 'visible', 'off')
set(findall(gca, 'type', 'text'), 'visible', 'on')
George Baltas
George Baltas on 11 Feb 2019
Furthermore, the documentation of the current release contains no information about children line objects staying visible after axes visible is set to 'off'. This is pretty inconsistent with the behavior of most parent/children graphics objects.
Please update documentation to reflect this

Sign in to comment.

More Answers (0)


No tags entered yet.


Community Treasure Hunt

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

Start Hunting!