Search code examples
matlabplotmatlab-figure

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


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


Solution

  • You can set the axes clipping style to rectangle

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

    plot