2017-05-19 293 views
0

我在Matlab中有一个scatterplot,想知道是否有任何方法来改变其中一个点的颜色?更改matlab中特定点的颜色?

+0

该解决方案适合您吗? – OmG

+0

不,不是真的。它只是在我的观点中间放一个红点,我想改变实际点的颜色。 – Lauren

+0

您的可视化有什么区别? – OmG

回答

2

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

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

尝试hold on,然后绘制点要以指定颜色(r),你有兴趣(x,y)

0

如果你不想覆盖在第一第二的情节,您可以分别绘制每个点并使用手柄。这样,您可以稍后在每个点上执行任意更改。

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

% 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 
0
x = rand(10,1) ; 
y = rand(10,1) ; 
scatter(x,y) ; 

[x1,y1] = getpts ; 

hold on 
plot(x1,y1,'Or') ; 

点击该点,你要在提示时改变颜色。