0

我创建了这个小包来组织“家庭”数据,希望使用 ggraph/tidygraph 创建家谱树。我设法获得了这样的图表(可以在没有包的情况下加载数据 - 参见最后的代码):

remotes::install_github("DominiqueMakowski/tidyfamily")
library(tidyfamily)
library(ggraph)
library(tidygraph)

data <- dynasty_capetian()

edges <- tidyfamily:::.family_get_edges(data)
nodes <- tidyfamily:::.family_get_nodes(data)


tidygraph::tbl_graph(nodes=nodes, edges=edges) %>%
  ggraph(layout = "nicely") +
  geom_edge_link(aes(color = link)) +
  geom_node_label(aes(label = label)) +
  ggraph::theme_graph()

reprex 包(v0.2.1)于 2021-04-15 创建

然而,图表并不是最清晰的可视化,看起来更像树或树状图的东西会更好。

我相信其中一种方法(或至少是第一步)是根据人们的出生日期来组织节点(birth_year可作为节点的属性)。

换句话说,我想在这个图中隐含一个“y”轴,并将节点放在它们的高度,这取决于它们的一些属性。那可能吗?

不安装包的数据

data <- structure(list(id = c("Charles", "Louis XIV", "Louis XV", "Louis1661", 
"Louis1682", "Marie-Adélaïde de Savoie", "Marie-Thérèse d'Autriche", 
"Marie-Thérèse de France", "Marie Anne Christine de Bavière", 
"Philippe-Charles de France", "Philippe V"), name = c("Charles", 
"Louis XIV", "Louis XV", "Louis de France", "Louis de France", 
"Marie-Adélaïde de Savoie", "Marie-Thérèse d'Autriche", "Marie-Thérèse de France", 
"Marie Anne Christine de Bavière", "Philippe-Charles de France", 
"Philippe V d'Espagne"), text = c(NA, NA, NA, NA, "Duc de Bourgogne", 
NA, NA, "La Petite Madame", NA, "Duc d'Anjou", NA), sex = c("Male", 
"Male", "Male", "Male", "Male", "Female", "Female", "Female", 
"Female", "Male", "Male"), birth_year = c(1686, 1638, 1710, 1661, 
1682, 1685, 1638, 1667, 1660, 1668, 1683), birth_month = c(7, 
9, 2, 11, NA, 12, 10, NA, NA, 8, NA), birth_day = c(31L, 5L, 
15L, 1L, NA, 6L, 10L, NA, NA, 5L, NA), birth_text = c("31 Jul 1686", 
"05 Sep 1638", "15 Feb 1710", "01 Nov 1661", "1682", "06 Dec 1685", 
"10 Oct 1638", "1667", "1660", "05 Aug 1668", "1683"), death_year = c(NA, 
1715, 1774, 1711, 1712, 1712, 1683, 1672, NA, 1671, 1746), death_month = c(NA, 
9, 5, 4, NA, 2, 7, NA, NA, 7, NA), death_day = c(NA, 1L, 10L, 
14L, NA, 12L, 30L, NA, NA, 10L, NA), death_text = c("Unknown", 
"01 Sep 1715", "10 May 1774", "14 Apr 1711", "1712", "12 Feb 1712", 
"30 Jul 1683", "1672", "Unknown", "10 Jul 1671", "1746"), father = c("Louis1661", 
NA, "Louis1682", "Louis XIV", "Louis1661", NA, NA, "Louis XIV", 
NA, "Louis XIV", "Louis1661"), mother = c("Marie Anne Christine de Bavière", 
NA, "Marie-Adélaïde de Savoie", "Marie-Thérèse d'Autriche", "Marie Anne Christine de Bavière", 
NA, NA, "Marie-Thérèse d'Autriche", NA, "Marie-Thérèse d'Autriche", 
"Marie Anne Christine de Bavière"), born_of = c("Wedding", "Wedding", 
"Wedding", "Wedding", "Wedding", "Wedding", "Wedding", "Wedding", 
"Wedding", "Wedding", "Wedding")), row.names = c(NA, -11L), class = "data.frame")
4

1 回答 1

0

价格合理的产品是 GenoPro。它从进口的 gedcom 中创建了吸引人的家谱。文件。它也可以通过编程方式作为 com 对象寻址,允许您对颜色等进行注释。我一直在将它与 VB.NET 代码一起使用。输出是他们专有的 gno 格式,但很容易保存为 pdf 或以多种格式导出。它是为遗传咨询而开发的,但也适用于家谱。

于 2021-11-05T16:28:40.573 回答