Put an array inside 'MarkerSize' value field.

13 ビュー (過去 30 日間)
Leonardo Mutti
Leonardo Mutti 2017 年 1 月 4 日
コメント済み: Leonardo Mutti 2017 年 1 月 4 日
Hello, I'm plotting a set of points and I'd like their sizes to be variable. I salved the points' coordinates inside the matrix p, where the first row contains the x coordinates and the second the y coordinates. For a constant marker size running this kind of instruction makes things very fast:
plot(p(1,:),p(2,:),'.r','MarkerSize',5);
but since I wanted the marker size to change, I generated a size for each point in the array s, but the solution I came up with is very time taking:
for i=1:n
plot(p(1,i),p(2,i),'.r','MarkerSize',s(i));
end
I wondered if there was a more efficient solution, such as a way to define the marker size with according to the array s. Thanks in advance.

採用された回答

Walter Roberson
Walter Roberson 2017 年 1 月 4 日
Use scatter. The third argument can be a vector
  1 件のコメント
Leonardo Mutti
Leonardo Mutti 2017 年 1 月 4 日
Thanks a lot, that's exactly what I was looking for.

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

その他の回答 (0 件)

カテゴリ

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