How to use a different color palette in a Ternary plot for separate data being added to the same plot?

36 views Asked by At

here is my original code that works great.

ggmacrem <- ggtern(remnant, aes(x = `tn.g.kg`, y = `P.ppm`, z = `K.ppm`)) +
  stat_density_tern(geom = "polygon", aes(fill = ..level..), bins = 50, 
                    alpha = 0.9) +
  scale_fill_distiller(palette = "PRGn") +
  
  labs(title = "A",
       x = "N",
       y = "P",
       z = "K") +
  theme(legend.position = "none")  # Remove all legends

Ternary Plot output

What I have tried to do is add another set of data to that same plot to show the shift in data from one treatment to another. Below is the example. I would like to make the second set of data a different color and alpha to show the difference. Any advice would be greatly appreciated.

If I change the color palette in the second data set it changes the whole color of both datasets.

Combined data from ggmacrest with ggmacrem

  ggmacrem <- ggmacrem +
  stat_density_tern(data = restoration, geom = "polygon", aes(fill = ..level..),
                    bins = 50, alpha = 0.1) +
  scale_fill_distiller(palette = "PGRN") +
  labs(title = "B", x = "N", y = "P", z = "K") +
  theme(legend.position = "none")


    print(ggmacrem)

Ternary Plot output

0

There are 0 answers