Limit axes so that they go from one range to another without problem

1

I am trying to generate a ternary graph with types of soils made up of different combinations of Arcilla , Arena and MO . In turn, I calculate the growth of the plants in the types of conformed soils. Values range from 0 to 100% in Arcilla and Arena , while for MO is from 0 to 10%. The problem is that using coord_tern and / or tern_limits I can not shorten the eje R (MO) so that the points are distributed throughout the graph and not only concentrate on one end since the scales default for the axes are from 0 to 100.

If I was not clear in the query, please let me know.

ggtern(data = Libro1,mapping = aes(x= Arcilla, y= Arena, z= MO)) +
coord_tern(Tlim = ("0,100"), Llim = ("0,100"), Rlim = ("0,10")) +
tern_limit(T = 1, L = 1, R= 0.1) + stat_density_tern(geom='polygon', 
  aes(fill=..level..), bins=5, color='grey') + geom_point()

    
asked by Ignacio 12.09.2017 в 17:00
source

1 answer

2

It is not possible to do what you need due to limitations of the ggtern package. Each axis in the graph must add the same as the rest. As T 0: 100, L 20: 120 and R 100: 200. In the case of what you want to do, raise the following error (for the same reason I explain):

library(ggtern)

Libro1 <- data.frame(Arcilla=1:100,Arena=1:100, MO = seq(from=0,to=10, length.out = 100))

ggtern(data = Libro1,mapping = aes(x= Arcilla, y= Arena, z= MO)) +
  scale_T_continuous(limits = c(0,100))+
  scale_L_continuous(limits = c(0,100))+
  scale_R_continuous(limits = c(0,10))

##     T   L  R Sum
## 1 100   0  0 100
## 2   0 100  0 100
## 3   0   0 10  10
## Error: Invalid Ternary Limits, Each Point Must Sum to Unity...

I recommend expressing the units differently (as MO x 10 ^ -1) to be able to use the same scale as Arena and Arcilla :

library(ggtern)

Libro1 <- data.frame(Arcilla=1:100,Arena=1:100, MO = seq(from=0,to=10, length.out = 100))

Libro1$MO <- Libro1$MO*10

ggtern(data = Libro1,mapping = aes(x= Arcilla, y= Arena, z= MO)) +
  Tlab('Arena')+Llab('Arcilla')+Rlab(expression(paste('MOx10'^-1)))

    
answered by 12.09.2017 / 20:36
source