# How to calculate grid coordinates of the centroid based on four attributes in a spider chart

04/06/15

After more research I found a candidate algorithm but it seems to be incomplete. I have also reworked the spider chart to number all of the boxes using an x,y ((origin = 1,1) lower left) coordinate method.

The following sample spider chart shows attribute values of A=80 (19,19) B=30 (14,8) C=40 (7,7) and D=70 (4,18).

I learned that one can find the centroid (modern term for center of gravity) of a quadrilateral by drawing lines to create two triangles, finding the centroid of those, then draw a line between them, the center point of that line is the centroid.

Using this method the centroid of these sample scores is (10,13).

Based on knowing the x,y coordinates of the four attributes what calculation can duplicate the drawing lines method to find the centroid? 04/05/15

Here is another thought on finding the center of gravity. Find the mid-point of each axis and draw a perpendicular line, the lines intersect. Is this intersection the center of gravity? If so how can this be calculated as a plot point? 04/04/15 For clarity purposes I am putting new thoughts at the top of this question. Geoff suggested using a Radar Graph.

Here is sample radar chart. How could the "center of gravity" be calculated as a plot point? Do the intersecting lines indicate the "center of gravity"? Original question follows:

This question involves writing an algorithm (or a table) to plot a point on a square grid based on four attributes each with five levels.

Each Attribute, A, B, C and D is assigned one of five Levels, Very High, High, Moderate, Low and Very Low. All four attributes affect the plot point.

How many plot points are possible based on these quantities?

### Examples

The following are some examples of how the points are to be plotted in the grid shown below based on various combinations of levels for the attributes. Essentially, Very High levels are near the four corners going down to Very Low in the XX-opposite corner-XX middle of the grid.

Plot point 1 -
A=Very High
B=Very Low
C=Very Low
D=Very Low


These levels place the plot point as close as possible to box number 1, since it has the highest level of the four attributes.

Plot point 625 (old 32) -
A=Moderate
B=Moderate
C=Moderate
D=Moderate


These levels place the plot point as close as possible to box number 625, since all four levels are moderate (in the middle) of the four attributes.

Plot point 469 (old 19) -
A=Very High
B=High
C=Very High
D=Low


These levels place the plot point near box number 469, based on Moderate B and Low D.

Thus each combination of Attributes and Levels creates a pre-defined number of plot points.

Does this make sense?

### This section is in reply to Tyler

Yes, I do have a defined order that the plot points need to be in. Attribute A represents point 1, B point 25, C point 49 and D point 73. Thus when the score is Very High, the plot point is 1, 25, 49 or 73.

Reiterating my example for Plot point 1/97 (above) the attribute ranks would be: A=Very High B=Very Low C=Very Low D=Very Low. On the opposite corner, plot point 49/141, the attribute ranks are: A=Very Low B=Very Low C=Very High and D=Very Low. The middle plot point, 625, consists of all attributes raking the same (though only one is possible in my scoring algorithm, Moderate)

This repeats for all of the attributes and possible combinations of ranks. What I need an algorithm that will plot these points, essentially making a table of all possible points, such that each box has at least one reference to a ranking.

Such an algorithm would be able to tell which exact plot point the following rank is: A=High B=Very Low C=High D=Very High

Point       Sample Rankings
1   =   A=Very High B=Very Low C=Very Low D=Very Low
25  =   A=Very Low B=Very High C=Very Low D=Very Low
49  =   A=Very Low B=Very Low C=Very High D=Very Low
73  =   A=Very Low B=Very Low C=Very Low D=Very High
625 =   All Moderate (other combinations, such as All Very High, not possible)


Which point 337, 401,457,505? would be created from: A=Very High B=Very High, C=Very Low D= Very High

Here is the sample grid. This is a new(er) grid with 25 boxes. Edit: 04/04/15 6:10 PM EDT Here is another way to look at this using scores for the diagonal axis instead of rankings.

Let's say the scores for the axis are A=90, B=40, C=50 and D=60. How can the average of these for scores be calculated and plotted on this graph? This is the original grid with 15 boxes. • Unless I misunderstood your question, you have 4 quantities, each of which can take any of 5 values. This gives you 5^4 = 625 different possible points. Your grid does not make sense to me. – Tyler Olsen Apr 3 '15 at 20:55
• Thanks Tyler. I just found the you can Google "5^4" and it returns "625". My grid is an example, not final result, since I didn't know the total was 625. Right now I have 15 boxes across and down, with 625 there would be 25. Also, when the ranks are created not all combinations are possible since not all Attributes can rank Very High at the same time. The mechanism used to create the ranks is a "forced choice" survey, the result being that one of the Attributes, must be lower than the others. So the question is, "What algorithm would calculate each of these 625 plot points?" – Eric Langley Apr 4 '15 at 1:51
• Your question is under-defined. You can order these 625 points in many (625! <-- factorial, not excitement. This is an very large number.) different ways. It looks like you've already got an ordering in mind since you already have a grid drawn, and you're not providing any details about what combinations of values are actually legal. Therefore, no one can help you with what you're trying to do unless you define your problem more fully. – Tyler Olsen Apr 4 '15 at 4:00
• Hi Tyler, thanks for taking the time to reply. Please forgive my failure to adequately communicate what I want to achieve. The comment box does not allow enough characters to fully reply to I am editing the question. Also, just realized what (625! <-- factorial, not excitement) means! As you can tell I am not a compsci guy... – Eric Langley Apr 4 '15 at 14:09
• So each corner has one attribute that is very high and the other three very low? So why isn't the set of attributes at point 19: A=low, B=high, C=low, D=low? – Bill Greene Apr 4 '15 at 15:22

I'm going to suggest something different than your proposal to see what you think: try a radar chart. The main advantage of that chart is that axis values will correspond to the scores you are talking about, so they're good for ordinal measurements, like the type you are describing.

A challenge I see with the graphic you are proposing is that you're flattening (projecting) a 5 by 5 by 5 by 5 4-dimensional hypercube with discrete data onto a square. This necessarily means that some weird things are going to happen. For the sake of argument, I'm going to label Very Low through Very High as 1 through 5. Then at point 1, we have $(A=5, B=1, C=1, D=1)$, and at point 25, we have $(A=1, B=5, C=1, D=1)$. There are 25 points between point 1 and point 25 inclusive, which means you can't do something intuitive like assume $C$ and $D$ are constant, have $A$ decrease monotonically from point 1 to point 25 while $B$ increases monotonically from point 1 to point 25, and make sure that the values of $A$ and $B$ are still whole numbers. Instead, you'll need to assign every possible combination of $(A,B)$ values along that side of your square, giving you some counterintuitive visual effect (to me, anyway).

• Geoff, yes, I think you are on the right track with a radar chart. I was just writing up some notes and had to change the ranks to values 1 through 5 as you did. (Internally my scores are 0-100 be we break them down into the ranks) I am posting another sample radar chart in the question. – Eric Langley Apr 4 '15 at 23:20
• I would up vote Geoff's response but...not enough reputation. – Eric Langley Apr 6 '15 at 21:03

I am answering my own question here, based on research on various sites. Thanks Geoff for helping with the radar chart idea. It is what I am using.

First, I needed to calculate the centroid of four x,y coordinates

Find the centroid of triangle 1 (x1+x2+x4)/3 (y1+y2+y4)/3 The result is a coordinate such as (12,10.6). Fractions are possible.

Find the centroid of triangle 2 (x2+x3+x4)/3 (y2+y3+y4)/3 The result is a coordinate such as (8.3,7.0)

Find the midpoint of the line between the centroids of triangle 1 and triangle 2 (x1+x2)/2 (y1+y2)/2 The result is a coordinate that represents the centroid of the four original x,y coordinates.

Example  