维恩图中标签位置、形状和重叠颜色的问题

Issues with Label positions, shape and overlap colors in Venn diagrams

我有以下数据:

dc <- c("CACNA1C",  "CACNA1D",  "KCNN4",    "CACNA1F",  "CACNA1D",  "CACNA1C",  "GNRHR",    "CD80",     "CD86",     "ITGA2B"  )
tc <- c("CACNA1C",  "CACNA1D",  "CACNA1C",  "CACNA1D",  "CACNA1F",  "KCNN4",    "APP",      "GNRHR",    "CD86",     "CD80"    )

我想使用 VennDiagram 包创建维恩图。

library(VennDiagram)
Vt <- venn.diagram(
  x = list(
    DC_Dataset=dc,
    TC_Dataset=tc
  ),
  #filename = "1B-double_Venn.tiff",
  main = "Targets",
  main.cex = 3,
  filename = NULL,
  lwd = 4,
  fill = c("cornflowerblue", "green"),
  alpha = 0.75,
  label.col = "black",
  cex = 2,
  fontfamily = "sansserif",
  fontface = "bold",
  cat.col = c("black", "black"),
  cat.cex = 1.5,
  cat.fontfamily = "sansserif",
  cat.fontface = "bold",
  cat.dist = c(0.03, 0.03),
  cat.pos = c(-20, 14)
)

grid.newpage()
grid.draw(Vt)

我有 3 个问题:

  1. 形状是椭圆形而不是 circles.Can这是要更改还是默认形状?

  2. 最好将这些标签放在 2 个形状主体的中央位置。使用 cat.pos = c(-20, 14) 我可以向左或向右移动 2 个标签,但不能上下颠倒。

  3. 我不喜欢 TC 数据集的唯一部分,具有 1 个唯一值,与更新脚本中的重叠 region.Ideally 颜色相同,例如选择紫色和绿色作为2个区域的颜色,然后可以使用第三种颜色作为重叠颜色。

回答这些问题中的任何一个都会很有帮助。

  1. 这完全取决于您 window/output 图片的缩放比例。将长宽比设置为 1:1 得到一个圆。

  2. cat.pos不是左右:

Vector giving the position (in degrees) of each category name along the circle, with 0 at 12 o'clock

此外,cat.dist 对此很有用:

Vector giving the distance (in npc units) of each category name from the edge of the circle (can be negative)

  1. 颜色不一样。不过,它们确实很相似,因为 alpha 的值很高,蓝色比绿色 "close" 高。似乎无法指定第三种颜色,但生成的颜色是其他两种颜色的混合是有道理的。

也就是说,您可以这样做:

Vt <- venn.diagram(
  x = list(
    DC_Dataset=dc,
    TC_Dataset=tc
  ),
  main = "Targets",
  main.cex = 3,
  filename = NULL,
  lwd = 4,
  fill = c("red", "blue"), # Modified
  alpha = 0.4, # Modified
  label.col = "black",
  cex = 2,
  fontfamily = "sansserif",
  fontface = "bold",
  cat.col = c("black", "black"),
  cat.cex = 1.5,
  cat.fontfamily = "sansserif",
  cat.fontface = "bold",
  cat.dist = c(-0.1, -0.1), # Modified
  cat.pos = c(-90, 90) # Modified
)
grid.newpage()
grid.draw(Vt)