Plot coloured points using plot function istead of scatter

1 回表示 (過去 30 日間)
fjnb86
fjnb86 2012 年 3 月 23 日
Hello,
Until now I was using this code to plot a coloured dots representation:
scatter(X,Y,S,C)
where:
X - independent data
Y - dependent data
C - vector values (0-1) same length as X and Y
S - size of the point, in my case constant value
I would rather prefer use the function plot instead of scatter due to is faster but, I do not know how to specified the colour for each X-Y point.
Thanks in advance!!
Edit: Example get the same representation but without scatter and, if its possible, not using loops (high dimensional data)
load seamount
scatter(x,y,5,z)

回答 (1 件)

Richard
Richard 2012 年 3 月 23 日
you could do something like:
clear all
load seamount % example dataset
Colors = hsv(length(x));%length of your data
figure(1);
for i = 1:length(x);
plot(x(i),y(i),'.','color',Colors(i,:));hold on
end
Is that what you mean?
  1 件のコメント
fjnb86
fjnb86 2012 年 3 月 23 日
Almost;
Is this what I want but without scatter
%
load seamount
scatter(x,y,5,z)
%

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeScatter Plots についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by