remove y axis and box in matlab

To remove the y-axis and box in MATLAB, you can use the following code:

main.m
% create a sample plot
x = 1:10;
y = x.^2;
plot(x, y);

% remove y-axis and box
set(gca, 'YTick', []);
box off;
112 chars
9 lines

The gca function gets the handle to the current axis object, which allows us to modify its properties. The YTick property controls the y-axis tick marks, and setting it to an empty array removes them. The box off command removes the box around the plot.

related categories

gistlibby LogSnag