Plot graph of points with known inter distances

Click For Summary
The discussion centers on plotting clusters based on known Euclidean inter-distances between their centroids. The proposed solution involves placing one centroid at the origin and positioning others along the x-axis according to their distances from it. To accurately determine the positions of all centroids, the law of cosines is suggested to calculate the necessary angles for their arrangement. The conversation also highlights the desire for a method that could be implemented in spreadsheet software like Excel, while also seeking a deeper understanding of the underlying concepts for potential coding applications. Overall, the goal is to create a visual representation of the clusters that reflects their relative distances accurately.
noplacebos
Messages
2
Reaction score
0
Greetings,

I am a biochemist/bioinformatician. I have a bunch of clusters, of which I have already calculated all their respective (euclidean) inter distances, from centroid to centroid.

I need to plot a graph with these clusters for visual inspection and publication.
My problem is how to calculate the coordinates of each clusters' centroid in a classic cartesian system, in order to properly display a "map" of cluster distances.
Each cluster's centroid should show as a single point on the graph - I will worry about representing each cluster's irregular shape later...


I am sure this is a trivial problem, but didn't have the chance to work with this before. So, by putting the problem down onto paper, I figured that one way to solve this (algorithmically) is by positioning the centroid of one cluster at the origin (0,0) and position all other centroids onto the x axis, each at its respective known distance from the first centroid at (0,0).

Then, all the centroids should make a circular move of angle phi around the origin, in order to adopt the position that satisfies all their known inter-distances.

In the end, we should obtain a cicle with radius equal to the most distant centroid from the one placed at the origin, and all the other centroids scattered within.

It appears to me that a huge set of equations of the form (law of cosines):
a^2 = b^2 + c^2 - 2bc*cosA

would need to be solved, in order to obtain all the correct angles that a specific centroid would need to "rotate" to assume its appropriate position.
In the above formula, "a" is the distance between centroids B and C, while b and c are the distances from the origin for B and C, respectively.

This looks to me like a job that includes some Matrix calculations, but couldn't find exactly what I am looking for, so far.

I would be grateful if you could point me at some direction so to continue my reading with regards to this problem.

Thank you very much in advance

PS. A way to achieve this with the use of some spreadsheet formula (eg excel) is desirable, although I would also like to understand the concept to the solution, in case I had to implement some kind of code.
 
Last edited:
Physics news on Phys.org
If I may add a less abstract example, I see the whole problem as having a list of furniture that exist in a 2D room, and I am given all their respective inter distances,

eg I know how far away the couch lies from the armchair, the TV set, the lounge table, etc.,

then how far away the armchair is from the TV set and the lounge table,

and finally the distance between the TV set and the table.

What I need is to draw this room with all furniture correctly positioned (of course we don't care about room dimensions as this is just an example), i.e. their correct relative locations.

Thanks
 
Thread 'How to define a vector field?'
Hello! In one book I saw that function ##V## of 3 variables ##V_x, V_y, V_z## (vector field in 3D) can be decomposed in a Taylor series without higher-order terms (partial derivative of second power and higher) at point ##(0,0,0)## such way: I think so: higher-order terms can be neglected because partial derivative of second power and higher are equal to 0. Is this true? And how to define vector field correctly for this case? (In the book I found nothing and my attempt was wrong...

Similar threads

Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
6
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
Replies
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 20 ·
Replies
20
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K