Hi,
I want to make a scatterplot of x, y, z coordinates and include the weight (which differs per particle) the locations have. So every particle has a specific weight and I want to combine all the weight of all the particles that have the same coordinates and visualize it as a heat plot. Is this possible?
Thanks!

 採用された回答

sloppydisk
sloppydisk 2018 年 5 月 1 日

0 投票

You could pass color values as follows
n = 1000;
X = rand(n, 1); Y = rand(n, 1); Z = rand(n, 1); C = hypot(X, Y);
size = 500;
scatter3(X, Y, Z, size, C, '.');
colormap jet
Or do you want to take a slice along the xy-plane? Then you should probably look at this page .

7 件のコメント

Gabriella Tany
Gabriella Tany 2018 年 5 月 1 日
編集済み: Gabriella Tany 2018 年 5 月 1 日
What does hypot do? So if I have the weights in vector E I can plot it like this
scatter3(X, Y, Z, size, E, '.'); colormap jet
and it will consider the weight depending on the location of the particle?
sloppydisk
sloppydisk 2018 年 5 月 1 日
Hypot just computes the diagonal length of X and Y, I used it as an example weight. Yes, the colors of the points will be interpolated based on the values in your weight vector E.
See also
doc scatter3
Gabriella Tany
Gabriella Tany 2018 年 5 月 1 日
Thanks!!
Gabriella Tany
Gabriella Tany 2018 年 5 月 1 日
Is it also possible to add the weight when the particle position overlap with each other? so let's say that particle 10 and particle 50 have the same position and weight of the first one is 3 and the second one is 6. Is it possible to let matlab have as an output 9 as its weight?
sloppydisk
sloppydisk 2018 年 5 月 1 日
For sure, look into the unique and ismember functions. You can probably find some ideas online of how to construct the algorithm.
Kayode Adetunji
Kayode Adetunji 2019 年 1 月 12 日
Hi, Please did you find out how to directly add weights to data points, especially depending on a condition? And also the consideration of data points of same location?
I will appreciate your feedback. I am struglling with this aspect. Thank you.
sloppydisk
sloppydisk 2019 年 1 月 12 日
Do you want to add the weights to the color or to the size of the data points? In what way should they depend on a condition? Please state your problem more clearly.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeData Distribution Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by