擦除matlab plot a posteriori的区域
Erase area of matlab plot a posteriori
是否可以在不直接操作输入到绘图的数据的情况下擦除绘图区域(后验)?
例如y=x 下方的区域,同时保留上方的区域。
您可以使用 area
和白色面颜色来空白给定线下方的绘图区域:
t = linspace(0,20,500);
plot(t, sin(t)) % example plot
yl = ylim;
hold on
y = .4 - t * .05; % example limit line
area(t, y, yl(1), 'Facecolor', 'w', 'edgecolor', 'none');
这是一种方法,只需绘制所需的内容,并将所有其他值替换为 nan
:
[X,Y,Z] = peaks;
Z(X>Y) = nan;
contour(X,Y,Z,20)
是否可以在不直接操作输入到绘图的数据的情况下擦除绘图区域(后验)?
例如y=x 下方的区域,同时保留上方的区域。
您可以使用 area
和白色面颜色来空白给定线下方的绘图区域:
t = linspace(0,20,500);
plot(t, sin(t)) % example plot
yl = ylim;
hold on
y = .4 - t * .05; % example limit line
area(t, y, yl(1), 'Facecolor', 'w', 'edgecolor', 'none');
这是一种方法,只需绘制所需的内容,并将所有其他值替换为 nan
:
[X,Y,Z] = peaks;
Z(X>Y) = nan;
contour(X,Y,Z,20)