Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide y axis?

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?

like image 800
Rory Avatar asked Feb 20 '13 18:02

Rory


2 Answers

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

set(gca, 'YTick', []);
like image 192
CharlieB Avatar answered Oct 16 '22 10:10

CharlieB


Try:

ax1 = gca;                   % gca = get current axis
ax1.YAxis.Visible = 'off';   % remove y-axis
ax1.XAxis.Visible = 'off';   % remove x-axis
like image 35
user8260285 Avatar answered Oct 16 '22 09:10

user8260285