簡體   English   中英

Cowplot plot_grid() :圖中的標題

[英]Cowplot plot_grid() : Title in plot

我試圖在使用plot_grid()構建的組裝圖中包含一個標題。 我嘗試了@Claus Wilke在此處cowplot參考指南中提出的解決方案,以及此處建議的解決方法作為問題本身的一部分(從空的ggplot對象中提取標題)。

在這兩種情況下,我都可以單獨使用標題構造一個對象。 但是,當我嘗試將它與其他兩個對象一起包含在一個單列圖中時,會發生一些奇怪的事情。 如果我嘗試將它包含在頂部(例如指定plot_grid()參數rel_heights(0.1,1,0.5) ,類似於我上面發布的第一個鏈接所建議的,輸出僅包含一些空白空間。相反,如果我嘗試反轉圖的順序(即包括主圖下方的標題),輸出完全符合預期,標題繪制在圖下方。

為什么會發生這種情況的任何想法? 我的設置與我包含的參考文獻中的示例沒有顯着不同,除了主圖的方向(它被網格化為單列而不是單行)

我的代碼


# Building the main plots

# ----------
# Upper plot
# ----------

plot.new() ## clean up device

par(mar = c(2, 4, 2, 4), 
    mfrow=c(1,1))

plot(x = range(dato_reg$date[dato_reg$reg == 'ECA']), y = range(dato_reg$sector_any_food_l[dato_reg$sub_reg == 'ECA: W. Eur. and Balcans']), 
     type ="n", 
     ylab = "Number of Measures",
     #main = "Western Europe and Balcans", sub = "Food", xlab = "",
     #col = "blue", 
     bty = "n",
     xaxs="i",
     yaxs="i",
     xaxt = "n",
     cex.axis = 0.9,
     cex.lab = 0.8,
     cex.main = 0.9,
     fg = 'grey')
lines(x = dato_reg$date[dato_reg$sub_reg == 'ECA: W. Eur. and Balcans'], y = dato_reg$sector_any_food_l[dato_reg$sub_reg == 'ECA: W. Eur. and Balcans'], col = "darkgreen")
lines(x = dato_reg$date[dato_reg$sub_reg == 'ECA: W. Eur. and Balcans'], y = dato_reg$sector_any_food_r[dato_reg$sub_reg == 'ECA: W. Eur. and Balcans'], col = "maroon")

# Secondary axis
par(new = TRUE, mar = c(2, 4, 2, 4), 
    mfrow=c(1,1))
plot(x = dato_reg$date[dato_reg$sub_reg == 'ECA: W. Eur. and Balcans'], y = dato_reg$Tot_cov[dato_reg$sub_reg == 'ECA: W. Eur. and Balcans'], 
     type = "l", 
     xaxt = "n", yaxt = "n", # Set null superposition of axis on LHS
     ylab = "", xlab = "", 
     col = "black", lty = 2, lwd = 1.5,
     xaxs="i", yaxs="i", bty = "n", fg = 'grey')

markers <- c(0,400000,800000, 1200000)

axis(side = 4, at = markers, labels=format(markers, scientific=FALSE), fg = 'grey', cex.axis = 0.9, cex.lab = 0.8)
mtext("Total Number of Covid Cases", side = 4, line = 3, srt = -180, cex = 0.8)

legend("topleft", c("# Policies - Lib", "# Policies - Res", "Total Cases"),
       col = c("darkgreen", "maroon", 'black'), 
       lty = c(1, 1, 2),
       bty = "n", 
       cex = 0.7)

up_plot <- recordPlot()

# -----------
# Bottom plot
# -----------

plot.new() ## clean up device

par(mar = c(2, 4, 1, 4))
plot(x = dato_reg$date[dato_reg$sub_reg == 'ECA: W. Eur. and Balcans'], 
     y = dato_reg$delta_cases_week_sh[dato_reg$sub_reg == 'ECA: W. Eur. and Balcans'], 
     #main = 'Weekly variation of new cases',
     type = 'l',
     col = 'darkgrey',
     cex = 0.5,
     #xaxt = "n", yaxt = "n", # Set null superposition of axis on LHS
     ylab = "", xlab = "", 
     lty = 5, lwd = 1.2,
     xaxs="i", yaxs="i", bty = "n",
     cex.axis = 0.9,
     cex.lab = 0.8,
     cex.main = 0.9,
     fg = 'grey')

bot_plot <- recordPlot()

# ------------------------
# Building the title object
# ------------------------

# First method

tit <- ggdraw() + 
        draw_label(
                "Western Europe and Balcans",
                #fontface = 'bold',
                #fontfamily = 'Open Sans',
                x = 0,
                hjust = 0#,
                #vjust = 1
        ) +
    theme_delabj() #+

# Second Method
tit2 <- ggplot() + 
        labs(title = "Western Europe and Balcans") + 
        theme_delabj()
tit2 <- ggpubr::as_ggplot(get_title(tit2))

# Does not work
plot_grid(tit, up_plot, bot_plot,
          ncol = 1,
          rel_heights = c(0.1,1,0.5))

# Works
plot_grid(up_plot, bot_plot, tit
          ncol = 1,
          rel_heights = c(1,0.5,0.1))

為什么會發生這種情況的任何想法? 我嘗試構建圖表,之前構建柱狀圖並在第二步中添加標題,但沒有成功。 下面,我提供了數據的子樣本。

數據

dato_reg <- structure(list(date = structure(c(18263, 18264, 18265, 18266, 
18267, 18268, 18269, 18270, 18271, 18272, 18273, 18274, 18275, 
18276, 18277, 18278, 18279, 18280, 18281, 18282, 18283, 18284, 
18285, 18286, 18287, 18288, 18289, 18290, 18291, 18292, 18293, 
18294, 18295, 18296, 18297, 18298, 18299, 18300, 18301, 18302, 
18303, 18304, 18305, 18306, 18307, 18308, 18309, 18310, 18311, 
18312, 18313, 18314, 18315, 18316, 18317, 18318, 18319, 18320, 
18321, 18322, 18323, 18324, 18325, 18326, 18327, 18328, 18329, 
18330, 18331, 18332, 18333, 18334, 18335, 18336, 18337, 18338, 
18339, 18340, 18341, 18342, 18343, 18344, 18345, 18346, 18347, 
18348, 18349, 18350, 18351, 18352, 18353, 18354, 18355, 18356, 
18357, 18358, 18359, 18360, 18361, 18362, 18363, 18364, 18365, 
18366, 18367, 18368, 18369, 18370, 18371, 18372, 18373, 18374, 
18375, 18376, 18377, 18378, 18379, 18380, 18381, 18382, 18383, 
18384, 18385, 18386, 18387, 18388, 18389, 18390, 18391, 18392, 
18393, 18394, 18395, 18396, 18397, 18398, 18399, 18400, 18401, 
18402, 18403, 18404, 18405, 18406, 18407, 18408, 18409, 18410, 
18411, 18412, 18413, 18414, 18415, 18416, 18417, 18418, 18419, 
18420, 18421, 18422, 18423, 18424, 18425, 18426, 18427, 18428, 
18429, 18430, 18431, 18432, 18433, 18434, 18435, 18436, 18437, 
18438, 18439, 18440, 18441, 18442, 18443, 18444, 18445, 18446, 
18447, 18448, 18449, 18450, 18451, 18452, 18453, 18454, 18455, 
18456, 18457, 18458), class = "Date", format.stata = "%td"), 
    reg = c("ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", 
    "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", 
    "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", 
    "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", 
    "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", 
    "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", 
    "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", 
    "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", 
    "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", 
    "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", 
    "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", 
    "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", 
    "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", 
    "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", 
    "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", 
    "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", 
    "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", 
    "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", 
    "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", 
    "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", 
    "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", 
    "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA", "ECA"
    ), sub_reg = c("ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans", 
    "ECA: W. Eur. and Balcans", "ECA: W. Eur. and Balcans"), 
    sector_any_food_l = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 
    3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 
    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 
    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 
    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 
    5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 
    4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4), sector_any_food_r = c(0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 
    2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 
    3, 3, 3, 4, 4, 4, 4, 4, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
    2, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
    1, 1, 1, 1, 1), sector_any_med_l = c(0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 
    2, 2, 4, 4, 4, 4, 7, 7, 7, 9, 7, 7, 7, 7, 8, 8, 8, 8, 8, 
    8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 10, 10, 
    9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 
    9, 9, 9, 9, 9, 9, 8, 8, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 
    11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 
    11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 
    11, 11, 11, 11, 11, 11, 11, 11), sector_any_med_r = c(0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 
    2, 2, 2, 3, 5, 5, 5, 5, 6, 7, 7, 8, 10, 12, 13, 14, 15, 18, 
    19, 19, 24, 24, 24, 25, 26, 28, 30, 31, 31, 31, 32, 34, 35, 
    36, 38, 38, 38, 40, 41, 42, 41, 41, 41, 41, 41, 41, 40, 41, 
    41, 41, 41, 41, 41, 42, 44, 44, 44, 44, 44, 44, 45, 45, 45, 
    46, 46, 46, 46, 46, 46, 45, 45, 45, 46, 45, 45, 44, 44, 43, 
    43, 42, 42, 43, 43, 43, 43, 43, 43, 42, 41, 42, 42, 42, 42, 
    40, 40, 40, 40, 41, 41, 41, 43, 44, 44, 44, 44, 44, 43, 38, 
    39, 40, 39, 39, 39, 39, 39, 39, 39, 39, 40, 39, 39, 39, 39, 
    40, 41, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 42, 42
    ), Tot_cov = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 3, 4, 8, 9, 9, 14, 18, 20, 
    28, 29, 30, 30, 32, 41, 43, 43, 46, 50, 52, 53, 57, 64, 66, 
    77, 78, 80, 101, 145, 245, 324, 435, 593, 899, 1179, 1526, 
    2267, 2855, 3499, 4528, 5957, 7667, 9682, 12008, 14502, 17207, 
    21948, 25650, 33781, 40850, 48336, 57182, 65965, 78327, 92443, 
    109238, 104109, 119291, 133670, 150189, 166726, 186787, 207880, 
    229033, 247545, 268153, 292001, 317213, 340228, 366347, 391125, 
    408620, 431075, 455340, 480191, 506435, 531235, 553995, 597601, 
    616404, 636598, 660851, 694167, 716686, 735861, 756772, 774963, 
    796650, 814188, 835028, 855914, 872891, 886168, 902710, 921151, 
    934798, 954629, 968834, 981640, 991798, 1002663, 1016059, 
    1038908, 1053239, 1067231, 1079238, 1087868, 1097826, 1111055, 
    1122862, 1135539, 1148532, 1152011, 1160828, 1168828, 1178849, 
    1189528, 1199234, 1215186, 1222710, 1228846, 1235014, 1242656, 
    1251069, 1263659, 1271301, 1280131, 1285518, 1289965, 1006491, 
    1011167, 1015849, 1021596, 1030570, 1034475, 1038257, 1043582, 
    1048289, 1053243, 1058091, 1063284, 1067521, 1068086, 1073092, 
    1077711, 1082519, 1087033, 1090777, 1094066, 1097409, 1101924, 
    1107192, 1111933, 1116564, 1121333, 1124695, 1127855, 1132052, 
    1135751, 1139260, 1143411, 1147672, 1151121, 1153914, 1157815, 
    1163128, 1167502, 1172161, 1177010, 1181115, 1184497, 1189332, 
    1194167), delta_cases_week_sh = c(NA, NA, NA, NA, NA, NA, 
    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
    NA, NA, NA, NA, NA, NA, 6.15, 6.15, 6.15, 6.15, 6.15, 6.15, 
    6.15, 1.02097902097902, 1.02097902097902, 1.02097902097902, 
    1.02097902097902, 1.02097902097902, 1.02097902097902, 1.02097902097902, 
    0.294117647058824, 0.294117647058824, 0.294117647058824, 
    0.294117647058824, 0.294117647058824, 0.294117647058824, 
    0.294117647058824, 2.25133689839572, 2.25133689839572, 2.25133689839572, 
    2.25133689839572, 2.25133689839572, 2.25133689839572, 2.25133689839572, 
    9.35608552631579, 9.35608552631579, 9.35608552631579, 9.35608552631579, 
    9.35608552631579, 9.35608552631579, 9.35608552631579, 4.91439688715953, 
    4.91439688715953, 4.91439688715953, 4.91439688715953, 4.91439688715953, 
    4.91439688715953, 4.91439688715953, 3.61151987110634, 3.61151987110634, 
    3.61151987110634, 3.61151987110634, 3.61151987110634, 3.61151987110634, 
    3.61151987110634, 2.18097278915526, 2.18097278915526, 2.18097278915526, 
    2.18097278915526, 2.18097278915526, 2.18097278915526, 2.18097278915526, 
    1.30624242601752, 1.30624242601752, 1.30624242601752, 1.30624242601752, 
    1.30624242601752, 1.30624242601752, 1.30624242601752, 0.658109956784521, 
    0.658109956784521, 0.658109956784521, 0.658109956784521, 
    0.658109956784521, 0.658109956784521, 0.658109956784521, 
    0.363328034068481, 0.363328034068481, 0.363328034068481, 
    0.363328034068481, 0.363328034068481, 0.363328034068481, 
    0.363328034068481, 0.24245404589266, 0.24245404589266, 0.24245404589266, 
    0.24245404589266, 0.24245404589266, 0.24245404589266, 0.24245404589266, 
    0.133501787648649, 0.133501787648649, 0.133501787648649, 
    0.133501787648649, 0.133501787648649, 0.133501787648649, 
    0.133501787648649, 0.0834565412298084, 0.0834565412298084, 
    0.0834565412298084, 0.0834565412298084, 0.0834565412298084, 
    0.0834565412298084, 0.0834565412298084, 0.0625291317023914, 
    0.0625291317023914, 0.0625291317023914, 0.0625291317023914, 
    0.0625291317023914, 0.0625291317023914, 0.0625291317023914, 
    0.0449483257607112, 0.0449483257607112, 0.0449483257607112, 
    0.0449483257607112, 0.0449483257607112, 0.0449483257607112, 
    0.0449483257607112, 0.0348509652307993, 0.0348509652307993, 
    0.0348509652307993, 0.0348509652307993, 0.0348509652307993, 
    0.0348509652307993, 0.0348509652307993, 0.0290414713215884, 
    0.0290414713215884, 0.0290414713215884, 0.0290414713215884, 
    0.0290414713215884, 0.0290414713215884, 0.0290414713215884, 
    0.0250526276453955, 0.0250526276453955, 0.0250526276453955, 
    0.0250526276453955, 0.0250526276453955, 0.0250526276453955, 
    0.0250526276453955, 0.0240567914961615, 0.0240567914961615, 
    0.0240567914961615, 0.0240567914961615, 0.0240567914961615, 
    0.0240567914961615, 0.0240567914961615, 0.0247184338499397, 
    0.0247184338499397, 0.0247184338499397, 0.0247184338499397, 
    0.0247184338499397, 0.0247184338499397, 0.0247184338499397, 
    0.0240095369396734, 0.0240095369396734, 0.0240095369396734, 
    0.0240095369396734, 0.0240095369396734, 0.0240095369396734, 
    0.0240095369396734, 0.0231936536897942, 0.0231936536897942, 
    0.0231936536897942, 0.0231936536897942, 0.0231936536897942, 
    0.0231936536897942, 0.0231936536897942, 0.0233031474558156, 
    0.0233031474558156, 0.0233031474558156, 0.0233031474558156, 
    0.0233031474558156, 0.0233031474558156, 0.0233031474558156, 
    -0.709567845919194)), row.names = c(NA, -196L), class = c("tbl_df", 
"tbl", "data.frame"))

嘗試這個。 它將標題添加為標簽並將其從 rel_heights 位置刪除。 還要注意 rel_heights 等於 1。

titnew = "Western Europe and Balcans"

plot_grid(up_plot, bot_plot, ncol = 1, labels = titnew, label_y = 1, rel_heights = c(.65,.35))

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM