Plot graph of points with known inter distances

  • #1
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:
  • #2
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
 

Suggested for: Plot graph of points with known inter distances

Replies
7
Views
377
Replies
2
Views
796
Replies
3
Views
900
Replies
2
Views
1K
Replies
0
Views
525
Replies
1
Views
919
Replies
3
Views
352
Back
Top