R中的三元图

时间:2019-11-26 08:49:36

标签: r ggplot2 ggtern

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

我有两个不同的三元图,我想以一个彼此重叠的方式合并在一个图中。请在所附图片中看到它们。

pic 1 and 2

我想将它们合并成这样:

combined pic

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

# 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) )

有人可以帮忙吗?

0 个答案:

没有答案