在matlab中更改特定点的颜色?

在matlab中更改特定点的颜色?,matlab,plot,colors,Matlab,Plot,Colors,我在Matlab中有一个散点图,我想知道是否有任何方法可以只改变其中一个点的颜色?你可以绘制图形,然后重新绘制你想要的点 % plot the curve or graph hold on plot(x,y,'.r') 尝试按住,然后用您感兴趣的指定颜色(r)绘制所需的点。您可以绘制图形,然后重新绘制所需的点 % plot the curve or graph hold on plot(x,y,'.r') 尝试按住,然后用您感兴趣的指定颜色(r)绘制所需的

我在Matlab中有一个散点图,我想知道是否有任何方法可以只改变其中一个点的颜色?

你可以绘制图形,然后重新绘制你想要的点

   % plot the curve or graph
   hold on
   plot(x,y,'.r')

尝试按住,然后用您感兴趣的指定颜色(
r
)绘制所需的点。

您可以绘制图形,然后重新绘制所需的点

   % plot the curve or graph
   hold on
   plot(x,y,'.r')

尝试按住,然后用您感兴趣的指定颜色(
r
)绘制所需的点。

如果不想在第一个点上覆盖第二个点,可以单独绘制每个点并使用控制柄。这样,以后可以对每个点执行任意更改

你可以在下面找到一个例子

% Generate some numbers
x = randn(10,1);
y = randn(10,1);

% Plot each point individually
figure
hold on
for idx = 1 : numel(x)
    hdl(idx) =  plot(x(idx),y(idx),'marker','.','color','k')
end

% change color, markerstyle, x-position, etc...
hdl(2).Color  = [1 0 0]
hdl(3).Marker  = 'o'
hdl(5).XData = 1

如果不希望在第一个打印上覆盖第二个打印,可以单独打印每个点并使用控制柄。这样,以后可以对每个点执行任意更改

你可以在下面找到一个例子

% Generate some numbers
x = randn(10,1);
y = randn(10,1);

% Plot each point individually
figure
hold on
for idx = 1 : numel(x)
    hdl(idx) =  plot(x(idx),y(idx),'marker','.','color','k')
end

% change color, markerstyle, x-position, etc...
hdl(2).Color  = [1 0 0]
hdl(3).Marker  = 'o'
hdl(5).XData = 1
出现提示时,单击要更改颜色的点


出现提示时,单击要更改颜色的点

这个解决方案对你有效吗?不,不太有效。它只是在我的中间点了一个红点,我想改变实际点的颜色。你的可视化有什么区别?!这个解决方案对你有效吗?不,不太有效。它只是在我的中间点了一个红点,我想改变实际点的颜色。你的可视化有什么区别?!