1

我正在尝试使用包 ggtern 在 R 中制作三元图。

我有两个不同的三元图,我想将它们组合在一个图中,使它们彼此重叠。请在附图中查看它们。

图 1 和 2

我想将它们组合成这样:

组合图片

我制作这两个图的代码在这里。

# ternary density plot
comp.raw_data = data.frame((clo(comp.raw,total=100)), bp)
(plot <- ggtern(data = comp.raw_data, aes(x = sed, y = stand, z = walk)))
plot +
  stat_density_tern(geom = "polygon", n=200, contour = TRUE, 
                    aes(fill=..level.., alpha=..level..))+
  theme_custom(tern.panel.background = "white", 
               tern.plot.background = NULL, 
               col.T = "black", col.L = "black", col.R = "black", 
               col.grid.minor = NULL) + 
  scale_fill_gradient(low = " light green", high="dark green")+
  guides(color="none", fill="none", alpha="none")

# ternary plot 2. 
plot <- ggtern(data = work, aes(x = sed, y = stand, z = walk)) + 
  geom_point(aes(fill = "bp", size=bp),
             shape = 21) + 
  labs(fill = "bp"))
(plot1_grouplevel = plot + 
  theme_custom(tern.panel.background = "white", 
               tern.plot.background = NULL, 
               col.T = "black", col.L = "black", col.R = "black", 
               col.grid.minor = NULL) )

有人可以帮忙吗?

4

0 回答 0