How to hide y axis?

I draw a horizontal frame in MATLAB - boxplot(y, group,'orientation','horizontal')and then straighten the y axis with set(gca,'box','off','ycolor','w').

It looks great on the screen - only the bottom X axis is visible. But whenever I save a digit to a file using either the function print()or matlabfrag.m, the left y axis appears again in the output file (although it does not appear in the MATLAB visualization of the figure).

How can I hide this y axis?

+5
source share
5 answers

I know this is an old post, but the following also removes the marks you probably want:

set(gca, 'YTick', []);
+4
source

To remove labels from the graph, use the following commands for the X axis or Y axis:

set(gca,'XTickLabel',{' '})
set(gca,'YTickLabel',{' '})
+2
source

set(gcf, 'InvertHardCopy', 'off');
+1

Try:

ax1 = gca;                   % gca = get current axis
ax1.YAxis.Visible = 'off';   % remove y-axis
ax1.XAxis.Visible = 'off';   % remove x-axis
+1

Something similar happened to me once with a different property. The only way to save the property is to save directly from the pictures menu! I know this is boring, but it helped me!

0
source

All Articles