如何在 MATLAB 中隐藏图形的线条,使其不超出框架

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

有什么方法可以隐藏溢出,使线条不会像附图中那样从框架中突出来吗?

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

您可以将坐标轴 clipping style 设置为 rectangle

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