MATLAB: How to stop patches from covering axes and ticks

axescover uplimitspatchticks

Hello, I am trying to add vertical gray bars to a figure, and am using "patch" to do so. I have no issues creating the polygons, but they cover up the figure axis and ticks if the patch goes right to the edge/limits of the figure. I have searched around and haven't found a way around this, except for manually changing the limits of the patches to be ever-so-slightly less than the figure limits (which is very time-consuming). I want to either send the patch to the very back or bring the axes and ticks to the front so they aren't covered up by the patches. I am running R2016b. Any ideas? Thank you in advance!

Best Answer

set(gca, 'Layer', 'top')
... not difficult, but certainly not well known.