2022) population <- c(1.23611, 1.24101, 1.24567, 1.24938, 1.25265, 1.2557, 1.25859, 1.26157, 1.26472, 1.26667, 1.26926, 1.27316, 1.27486, 1.27694, 1.27787, 1.27768, 1.27901, 1.28033, 1.28084, 1.28032, 1.28057, 1.27834, 1.27593, 1.27414, 1.27237, 1.27095, 1.27042, 1.26919, 1.26749, 1.26555, 1.26146, 1.25502, 1.24947) data <- data.frame(year = year, population = population) # 折れ線グラフの描画 ggplot(data, aes_string(x = "year", y = "population")) + geom_line(colour = "black", size = 1.2) + geom_point(colour = "red", size = 3) + labs(x = "西暦", y = "日本の総人口 [億人]") + theme_minimal() + theme(legend.position = "none") + scale_x_continuous(breaks = seq(1990, 2022, 5)) + scale_y_continuous(breaks = seq(1.24, 1.28, 0.02)) + grid(alpha = 0.5) # グラフの保存 ggsave("1_1_3_population_line_plot.png", width = 5, height = 3, dpi = 300)