如何在Matlab中绘制XOR'ed线(或绘图)

时间:2021-09-05 04:17:09

I remember in pascal we had such a thing to draw line with XOR drawmode(or writemode in assembly) e.g. to draw a line from (5,5) to (100,5) we would do this in Pascal:

我记得在pascal中我们有这样的事情用XOR drawmode(或汇编中的writemode)绘制线条,例如从(5,5)到(100,5)绘制一条线,我们将在Pascal中执行此操作:

MoveTo(5, 5);
Pen.Mode := pmXOR;

LineTo(100,5);

Do we have similar thing for matlab plot (or line) functions? e.g:

我们对matlab图(或线)函数有类似的东西吗?例如:

%  Pen.Mode = pmXOR;
plot(X,Y,'r+');

1 个解决方案

#1


2  

It looks like the property you are looking for is called EraseMode. It is available on some graphics objects, but not all ... you'll have to experiment for you particular application.

看起来您正在寻找的属性称为EraseMode。它可用于某些图形对象,但不是全部...您必须为特定应用程序进行实验。

Some examples:

一些例子:


figure
hPatch = patch([10 90 90 10],[1 1 8 8],'r');
set(hPatch,'eraseMode','xor');
hold on
plot([5 100],[5 5])

figure; hold on;
[x,y,z] = peaks;
hPeaks = surface(x,y,z);
hLine = line([-4 4],[4 -4],[10 -10])
set(hLine,'EraseMode','xor')
view(3)

Use get(hLine), get(hPeaks) etc. to see what properties are available for a given graphics object.

使用get(hLine),get(hPeaks)等来查看给定图形对象可用的属性。

To see all object which support the EraseMode property, type

要查看支持EraseMode属性的所有对象,请键入

docsearch EraseMode

#1


2  

It looks like the property you are looking for is called EraseMode. It is available on some graphics objects, but not all ... you'll have to experiment for you particular application.

看起来您正在寻找的属性称为EraseMode。它可用于某些图形对象,但不是全部...您必须为特定应用程序进行实验。

Some examples:

一些例子:


figure
hPatch = patch([10 90 90 10],[1 1 8 8],'r');
set(hPatch,'eraseMode','xor');
hold on
plot([5 100],[5 5])

figure; hold on;
[x,y,z] = peaks;
hPeaks = surface(x,y,z);
hLine = line([-4 4],[4 -4],[10 -10])
set(hLine,'EraseMode','xor')
view(3)

Use get(hLine), get(hPeaks) etc. to see what properties are available for a given graphics object.

使用get(hLine),get(hPeaks)等来查看给定图形对象可用的属性。

To see all object which support the EraseMode property, type

要查看支持EraseMode属性的所有对象,请键入

docsearch EraseMode