Hi,
Exactly the matrix transformation is the one that pasted in my first mail.
That is here:

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])
 }


The problem is: the points are going out of the rhombus.


On Fri, Mar 14, 2014 at 9:22 AM, Jim Lemon <jim@bitwrit.com.au> wrote:

> On 03/14/2014 07:05 PM, al Vel wrote:
>
>> 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
>>
>>  Hi Alaguraj,
> Okay, the A, B, C, and D represent distances along the sides of a rhombus.
> The important thing is that you have answered your own question. The
> Wikipedia page above has the matrix transformation to solve your problem.
> Also have a look at this site:
>
> http://water.usgs.gov/nrp/gwsoftware/GW_Chart/GW_Chart.html
>
> where there is free software to draw Piper diagrams. Unfortunately, it is
> written in Pascal so that I can't easily translate it into R. There is an R
> package "hydrogeo" that may have a Piper diagram function in it. If you
> manage to sort this out, please let me know as I had a Piper diagram
> function that was contributed to the plotrix package but didn't work.
>
> Jim
>
>

	[[alternative HTML version deleted]]


