利用队列,时期以及出生,死亡和婚姻计数的数据,我绘制了队列和时期的每个点的死亡和婚姻情况。尽管每个时期的出生率都保持不变,这就是为什么我不想在其他数字被写的地方而是在情节的前面写它们。换句话说,我有一个数据框:
Lexisres <- structure(list(Cohort = c(1760L, 1760L, 1760L, 1760L, 1760L,
1760L, 1770L, 1770L, 1770L, 1770L, 1770L, 1770L, 1780L, 1780L,
1780L, 1780L, 1780L, 1780L, 1780L, 1780L, 1790L, 1790L, 1790L,
1790L, 1790L, 1790L, 1790L, 1790L, 1790L, 1800L, 1800L, 1800L,
1800L, 1800L, 1800L, 1800L, 1800L, 1800L, 1810L, 1810L, 1810L,
1810L, 1810L, 1810L, 1810L, 1810L, 1820L, 1820L, 1820L, 1820L,
1820L, 1820L, 1820L, 1830L, 1830L, 1830L, 1830L, 1830L, 1830L,
1840L, 1840L, 1840L, 1840L, 1840L, 1850L, 1850L, 1850L, 1850L,
1860L, 1860L, 1860L, 1870L, 1870L, 1870L, 1880L), Births = c(0L,
0L, 0L, 0L, 0L, 0L, 8L, 8L, 8L, 8L, 8L, 8L, 69L, 69L, 69L, 69L,
69L, 69L, 69L, 69L, 331L, 331L, 331L, 331L, 331L, 331L, 331L,
331L, 331L, 472L, 472L, 472L, 472L, 472L, 472L, 472L, 472L, 472L,
508L, 508L, 508L, 508L, 508L, 508L, 508L, 508L, 469L, 469L, 469L,
469L, 469L, 469L, 469L, 550L, 550L, 550L, 550L, 550L, 550L, 595L,
595L, 595L, 595L, 595L, 656L, 656L, 656L, 656L, 656L, 656L, 656L,
361L, 361L, 361L, 1L), Period = c(1810L, 1820L, 1830L, 1840L,
1850L, 1860L, 1810L, 1820L, 1830L, 1840L, 1850L, 1860L, 1810L,
1820L, 1830L, 1840L, 1850L, 1860L, 1870L, 1880L, 1810L, 1820L,
1830L, 1840L, 1850L, 1860L, 1870L, 1880L, 1890L, 1810L, 1820L,
1830L, 1840L, 1850L, 1860L, 1870L, 1880L, 1890L, 1820L, 1830L,
1840L, 1850L, 1860L, 1870L, 1880L, 1890L, 1830L, 1840L, 1850L,
1860L, 1870L, 1880L, 1890L, 1840L, 1850L, 1860L, 1870L, 1880L,
1890L, 1850L, 1860L, 1870L, 1880L, 1890L, 1860L, 1870L, 1880L,
1890L, 1870L, 1880L, 1890L, 1880L, 1890L, 1890L, 1890L), Marriages = c(0L,
0L, 0L, 0L, 0L, 0L, 3L, 5L, 0L, 0L, 0L, 0L, 32L, 34L, 3L, 0L,
0L, 0L, 0L, 0L, 67L, 236L, 24L, 4L, 0L, 0L, 0L, 0L, 0L, 1L, 160L,
272L, 35L, 4L, 0L, 0L, 0L, 0L, 1L, 207L, 251L, 45L, 4L, 0L, 0L,
0L, 0L, 137L, 296L, 34L, 2L, 0L, 0L, 1L, 184L, 330L, 35L, 0L,
0L, 2L, 255L, 289L, 49L, 0L, 0L, 174L, 429L, 53L, 0L, 232L, 538L,
0L, 0L, 361L, 1L), Deaths = c(5L, 12L, 13L, 17L, 5L, 3L, 13L,
25L, 24L, 44L, 33L, 6L, 13L, 21L, 28L, 39L, 40L, 44L, 9L, 1L,
22L, 37L, 71L, 65L, 61L, 112L, 96L, 30L, 1L, 1L, 45L, 95L, 69L,
81L, 117L, 130L, 121L, 25L, 5L, 63L, 73L, 80L, 82L, 114L, 144L,
106L, 5L, 67L, 46L, 69L, 91L, 108L, 143L, 2L, 48L, 67L, 80L,
89L, 120L, 2L, 54L, 83L, 79L, 82L, 5L, 56L, 62L, 99L, 3L, 43L,
72L, 1L, 35L, 0L, 1L)), .Names = c("Cohort", "Births", "Period",
"Marriages", "Deaths"), class = c("tbl_df", "tbl", "data.frame"
), row.names = c(NA, -75L), spec = structure(list(cols = structure(list(
Cohort = structure(list(), class = c("collector_integer",
"collector")), Births = structure(list(), class = c("collector_integer",
"collector")), Period = structure(list(), class = c("collector_integer",
"collector")), Marriages = structure(list(), class = c("collector_integer",
"collector")), Deaths = structure(list(), class = c("collector_integer",
"collector"))), .Names = c("Cohort", "Births", "Period",
"Marriages", "Deaths")), default = structure(list(), class = c("collector_guess",
"collector"))), .Names = c("cols", "default"), class = "col_spec"))
我绘制这样的婚姻和死亡:
ggplot(data = Lexisres) +
geom_blank(aes(x = Period, y = Cohort)) +
geom_text(aes(x = Period, y = Cohort,
label = paste("\nDeaths: ", Deaths, "\nMarriages: ", Marriages)),
size = 3.25, check_overlap = TRUE) +
scale_x_continuous(breaks=seq(0, 1900, 10)) +
scale_y_continuous(breaks=seq(0, 1880, 10)) +
theme_bw()
我的想法只是添加一个独立的列,分别在每个同类群组的左侧显示出生情况。因此,我能够为分娩做到这一点,但是,其余的并没有被完全摧毁。
ggplot(data = Lexisres) +
geom_blank(aes(x = Period, y = Cohort)) +
geom_text(aes(x = Period, y = Cohort,
label = paste("\nDeaths: ", Deaths, "\nMarriages: ", Marriages)),
size = 3.25, check_overlap = TRUE) +
scale_x_continuous(breaks=seq(0, 1900, 10)) +
scale_y_continuous(breaks=seq(0, 1880, 10)) +
theme_bw() +
geom_text(aes(x = 0, y = Cohort, label = paste("\nBirths: ", Births)))
我在这里可以做什么?