Hi,

I was very clear in the mail that i want to create a four edged Barycentric
diagram like Ternary plot (like the rhombus in the piper diagram (
http://en.wikipedia.org/wiki/Piper_diagram)).  The idea is to graphically
depicts the ratios of the four variables as positions in an rhombus/diamond
shape. The more the value, then the point will be towards that edge. In a
four edged plot, the proportions of the four variables *a*, *b*, c, d must
sum to some constant, *K*. Usually, this constant is represented as 1.
The code is simple for 3-edged ternary plot:

>grid.polygon(c(0, 0.5, 1), c(0, sqrt(3)/2, 0), gp = gpar(col = "black"))
>xp <- proportionvalueofB + proportionvalueofC / 2
>yp <- proportionvalueofC * sqrt(3)/2
> grid.points(xp, yp, pch = 1, size=size, default.units = "snpc")

(example if a=10,b=20,c=40; then proportionvalueofB=20/70)

The second two line in the above code converts the proportion value into a
cartesian co-oridinate to plot. This is for the triangle. The question is
how do i convert the proportions of 4 values into a cartesian co-ordinate
in a rhombus or a diamond.


Best regards,
Alaguraj.V


On Fri, Mar 14, 2014 at 6:08 AM, Jim Lemon <j...@bitwrit.com.au> wrote:

> On 03/14/2014 06:03 AM, al Vel wrote:
>
>> Hello R users,
>> I am trying to make a baricentric diagram like the ternary plot, but with
>> 4
>> edges. I want to know how to calculate the centroid of the diamond. The 4
>> edges are A, B, C, D. If value of A=B=C=D, then the point should be at the
>> centre of the diamond. If A>B and B=C=D=0, Then the point should be at the
>> corner of A.
>>
>> For diamond, how to convert the value of A,B,C,D into cartesian
>> co-ordinates ?. if x1,x2,y1,y2 are A,B,C,D, then someone suggested:
>>
>>    new_point<- function(x1, x2, y1, y2, grad=1.73206){
>>      b1<- y1-(grad*x1)
>>      b2<- y2-(-grad*x2)
>>      M<- matrix(c(grad, -grad, -1,-1), ncol=2)
>>      intercepts<- as.matrix(c(b1,b2))
>>      t_mat<- -solve(M) %*% intercepts
>>      data.frame(x=t_mat[1,1], y=t_mat[2,1])
>>    }
>> But this is not working. Please do suggest some help.
>> thanks and best regards,
>> Alaguraj.V
>>
>>  Hi Alaguraj,
> A lot depends upon what you mean by "diamond". A rhombus is out because
> you say that the lengths of the sides can be different (and as you note,
> the answer is easy). If you mean a parallelogram (opposite sides are equal)
> the answer is also easy, the intersection of the lines joining opposite
> vertices. If you mean a kite (sides of equal length are adjacent) it is a
> matter of finding the point along the line joining the two vertices that
> join the two sets of equal sides. I suspect that what you have to calculate
> is the centroid of a quadrilateral with arbitrary length sides. We can
> probably assume that it is convex, as Rolf noted, as the centroid may be
> outside quadrilaterals that are very concave (think boomerang, sport). So
> if you could tell us a bit more about what constraints you wish to place on
> your quadrilateral, somebody may be able to help.
>
> Jim
>
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to