How to hide the lines of a graph in MATLAB so that they do not extend beyond the frame

Viewed 65

Is there any way to hide the overflow so that the lines don't protrude from the frame as in the attached image?

plot(sin(0:0.1:10),"LineWidth",10)

enter image description here

1 Answers

You can set the axes clipping style to rectangle

plot(sin(0:0.1:10),"LineWidth",10);
set( gca, 'ClippingStyle', 'rectangle' );

plot

Related