diff --git a/R/creer_carte_2_2.R b/R/creer_carte_2_2.R index 0b151221e04256f0bc976eb7a7c96e09dc51d9f6..676aad749b5125eec3d843282d313407529fc282 100644 --- a/R/creer_carte_2_2.R +++ b/R/creer_carte_2_2.R @@ -12,6 +12,7 @@ #' @importFrom glue glue #' @importFrom sf read_sf st_bbox st_buffer st_crs #' @importFrom attempt stop_if stop_if_not +#' @importFrom mapfactory format_fr #' #' @export #' @@ -52,28 +53,41 @@ creer_carte_2_2 <- function(millesime_obs_artif) { carte_2_2 <- ggplot2::ggplot(data) + ggplot2::geom_sf(data = monde, fill = "light grey") + - ggplot2::geom_sf(fill = "white") + - ggplot2::stat_sf_coordinates(ggplot2::aes( - size = .data$`total en hectares`, - fill = .data$`total en hectares` - ), - color = "black", - shape = 21, - alpha = 0.8 - ) + - ggplot2::coord_sf( - xlim = c(x_min, x_max), - ylim = c(y_min, y_max), - expand = FALSE, - crs = sf::st_crs(data), - datum = NA - ) + + # carte modifiee + # ggplot2::geom_sf(ggplot2::aes(fill= .data$`total en hectares`), + # color = "black")+ + ggplot2::geom_sf(ggplot2::aes(fill= .data$`total en hectares`))+ + ggplot2::coord_sf( + xlim = c(x_min, x_max), + ylim = c(y_min, y_max), + expand = FALSE, + crs = sf::st_crs(data), + datum = NA + ) + + + + # ggplot2::geom_sf(fill = "white") + + # ggplot2::stat_sf_coordinates(ggplot2::aes( + # size = .data$`total en hectares`, + # fill = .data$`total en hectares` + # ), + # color = "black", + # shape = 21, + # alpha = 0.8 + # ) + + # ggplot2::coord_sf( + # xlim = c(x_min, x_max), + # ylim = c(y_min, y_max), + # expand = FALSE, + # crs = sf::st_crs(data), + # datum = NA + # ) + ggplot2::theme( panel.background = ggplot2::element_rect(fill = "light blue") ) + - gouvdown::scale_fill_gouv_continuous(palette = "pal_gouv_h", reverse = TRUE, name = "", labels = function(x) format_fr(x, dec = 0)) + + gouvdown::scale_fill_gouv_continuous(palette = "pal_gouv_h", reverse = TRUE, name = "", labels = function(x) mapfactory::format_fr(x, dec = 0)) + # ggplot2::scale_size_area(name="")+ - ggplot2::scale_size_continuous(range = c(0, 20), labels = function(x) format_fr(x, dec = 0)) + + ggplot2::scale_size_continuous(range = c(0, 20), labels = function(x) mapfactory::format_fr(x, dec = 0)) + ggplot2::labs( title = glue::glue("Nouvelles surfaces consomm\u00e9es entre {millesime_debut} et {millesime_fin} (10 ans)"), subtitle = "", diff --git a/R/creer_carte_2_7.R b/R/creer_carte_2_7.R index f73cdb7f882a8e9c9a8712ed87251392931bb74f..262cd5a8b89b69570975d04e80a0725e032d5121 100644 --- a/R/creer_carte_2_7.R +++ b/R/creer_carte_2_7.R @@ -52,7 +52,9 @@ creer_carte_2_7 <- function(millesime_obs_artif= NULL, code_reg = NULL) { dplyr::pull(.data$NCCENR) fond_cartographique <- mapfactory::fond_carto(nom_reg = nom_region) - bins <- stats::quantile(data$valeur,probs = c(0,0.1, 0.25, 0.5,0.75,0.9,1),na.rm=TRUE) + # bins <- stats::quantile(data$valeur,probs = c(0,0.1, 0.25, 0.5,0.75,0.9,1),na.rm=TRUE) + bins <- stats::quantile(data$valeur,probs = c(0,0.2, 0.4, 0.6,0.8,1),na.rm=TRUE) + carte_2_7 <- mapfactory::creer_carte_communes(data = data, code_region=code_reg, diff --git a/R/creer_graphe_1_4.R b/R/creer_graphe_1_4.R index 23e50297c2a50508faac12f1c5a37652f26eec08..2a89401614462fdc642f130d59679a5522000e40 100644 --- a/R/creer_graphe_1_4.R +++ b/R/creer_graphe_1_4.R @@ -42,6 +42,7 @@ creer_graphe_1_4 <- function(millesime_teruti, code_reg){ COGiter::filtrer_cog(reg = code_reg) %>% dplyr::filter(.data$TypeZone == "D\u00e9partements", .data$date == lubridate::make_date(millesime_teruti,"01","01")) %>% + # dplyr::filter(.data$date == lubridate::make_date(millesime_teruti,"01","01")) %>% tidyr::spread(key=.data$variable,value=.data$valeur,fill=0) %>% tricky::set_standard_names() %>% dplyr::arrange(.data$typezone,.data$zone) %>% diff --git a/inst/rmarkdown/templates/publication/skeleton/skeleton.Rmd b/inst/rmarkdown/templates/publication/skeleton/skeleton.Rmd index ad093b6e32a2dbb84d84ec2674b3fd61442faba4..5c77a81a7af3b46859de78896d3d1da66476a6f0 100644 --- a/inst/rmarkdown/templates/publication/skeleton/skeleton.Rmd +++ b/inst/rmarkdown/templates/publication/skeleton/skeleton.Rmd @@ -34,6 +34,10 @@ texte d'introduction... texte...... ```{r diag barres taux artificialisation par region} +ggplot2::theme_set(ggplot2::theme_minimal() + + ggplot2::theme(plot.caption.position = "plot", + plot.title.position = "plot", + plot.title = ggplot2::element_text(size = 14))) creer_graphe_1_1(millesime_teruti = params$millesime_teruti, code_reg = params$code_reg ) ``` @@ -54,18 +58,25 @@ creer_carte_1_3(millesime_ocsge = params$millesime_ocsge, texte...... +<div class = "row"> +<div class = "col-md-6"> + ```{r graph surfaces artificialisees en volume} creer_graphe_1_4(millesime_teruti = params$millesime_teruti, code_reg = params$code_reg) ``` -texte... +</div> +<div class = "col-md-6"> + ```{r graph part surfaces artificialisees} creer_graphe_1_5(millesime_teruti = params$millesime_teruti, code_reg = params$code_reg) ``` +</div> +</div> texte... @@ -75,6 +86,7 @@ creer_graphe_1_6(millesime_ocsge = params$millesime_ocsge, millesime_population = params$millesime_population, code_reg = params$code_reg) ``` + texte... ```{r tableau artificialisation OCSGE} @@ -103,7 +115,7 @@ creer_graphe_2_3(millesime_obs_artif = params$millesime_obs_artif, ``` -```{r graph conso espace departements 10 ans,fig.width=5,fig.height=7} +```{r graph conso espace departements 10 ans,fig.width=7,fig.height=7} creer_graphe_2_4(millesime_obs_artif = params$millesime_obs_artif, code_reg = params$code_reg ) ``` @@ -139,7 +151,11 @@ creer_graphe_3_1(millesime_stock_artif = params$millesime_stock_artif, millesime_population = params$millesime_population, code_reg = params$code_reg) ``` -```{r carte communale de l etalement urbain,fig.width=12,fig.height=8} +```{r carte communale de l etalement urbain,fig.width=9,fig.height=7} +ggplot2::theme_set(ggplot2::theme_minimal() + + ggplot2::theme(plot.caption.position = "plot", + plot.title.position = "plot", + plot.title = ggplot2::element_text(size = 14))) creer_carte_3_2(millesime_etalement_urbain = params$millesime_etalement_urbain, police_annotation = "Marianne", code_reg = params$code_reg ) @@ -147,6 +163,10 @@ creer_carte_3_2(millesime_etalement_urbain = params$millesime_etalement_urbain, ```{r graph croissance comparee population artificialisation,fig.width=9,fig.height=7} +ggplot2::theme_set(ggplot2::theme_minimal() + + ggplot2::theme(plot.caption.position = "plot", + plot.title.position = "plot", + plot.title = ggplot2::element_text(size = 14))) creer_graphe_3_3(millesime_stock_artif = params$millesime_stock_artif, millesime_population = params$millesime_population, code_reg = params$code_reg) @@ -156,12 +176,20 @@ creer_graphe_3_3(millesime_stock_artif = params$millesime_stock_artif, ```{r graph surfaces artificialisees par habitant,fig.width=9,fig.height=7} +ggplot2::theme_set(ggplot2::theme_minimal() + + ggplot2::theme(plot.caption.position = "plot", + plot.title.position = "plot", + plot.title = ggplot2::element_text(size = 14))) creer_graphe_3_4(millesime_stock_artif = params$millesime_stock_artif, millesime_population = params$millesime_population, code_reg = params$code_reg) ``` ```{r graph surfaces artificialisees par habitant par type territoire,fig.width=9,fig.height=7} +ggplot2::theme_set(ggplot2::theme_minimal() + + ggplot2::theme(plot.caption.position = "plot", + plot.title.position = "plot", + plot.title = ggplot2::element_text(size = 14))) creer_graphe_4_2(millesime_stock_artif = params$millesime_stock_artif, millesime_population = params$millesime_population, code_reg = params$code_reg) @@ -174,8 +202,8 @@ creer_graphe_4_2(millesime_stock_artif = params$millesime_stock_artif, #### Et si l'artificialisation se poursuivait... ```{r creer_graphe_5_1, fig.height=2.5,fig.width=8} -creer_graphe_5_1(millesime_stock_artif = params$millesime_stock_artif, - code_reg = params$code_reg) +# creer_graphe_5_1(millesime_stock_artif = params$millesime_stock_artif, +# code_reg = params$code_reg) ``` #### Quel développement sans objectif de réduction de la consommation d'espace ?