How to hide y axis?

Rory picture Rory · Feb 20, 2013 · Viewed 16.6k times · Source

I plot a horizontal boxplot in MATLAB -- boxplot(y, group,'orientation','horizontal'), and then hide the y-axis using set(gca,'box','off','ycolor','w').

It looks fine on the screen - only the bottom x-axis is visible. But whenever I save the figure to file, using either the print() function or matlabfrag.m, the left y-axis reappears in the output file (although it doesn't show up in MATLAB's visualization of the figure).

How can I keep this y-axis hidden?

Answer

CharlieB picture CharlieB · Feb 20, 2017

I know this is an old post, but the following also remove the tick marks which is probably what you want:

set(gca, 'YTick', []);