Skip to content

Commit

Permalink
Make ribbons easier to see
Browse files Browse the repository at this point in the history
  • Loading branch information
mhesselbarth committed Jan 4, 2024
1 parent 54e10e6 commit 1625415
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions R/bdproto-biodiversityscenario.R
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ BiodiversityScenario <- bdproto(
ymin = suitability_q25,
ymax = suitability_q75)) +
ggplot2::theme_classic(base_size = 18) +
ggplot2::geom_ribbon(fill = "grey90") +
ggplot2::geom_ribbon(fill = "grey85") +
ggplot2::geom_line(size = 2) +
ggplot2::labs(x = "Time", y = expression(Area(km^2)), title = "Relative suitable habitat")
}
Expand Down Expand Up @@ -541,12 +541,12 @@ BiodiversityScenario <- bdproto(
if(oftype == "stars"){
if(plot){
suppressWarnings(
stars:::plot.stars(out, breaks = "fisher", col = c(ibis_colours$divg_bluered[1:10],"grey90",ibis_colours$divg_bluered[11:20]))
stars:::plot.stars(out, breaks = "fisher", col = c(ibis_colours$divg_bluered[1:10],"grey85",ibis_colours$divg_bluered[11:20]))
)
}
} else {
out <- terra::rast(out)
if(plot) terra::plot(out, col = c(ibis_colours$divg_bluered[1:10],"grey90",ibis_colours$divg_bluered[11:20]))
if(plot) terra::plot(out, col = c(ibis_colours$divg_bluered[1:10],"grey85",ibis_colours$divg_bluered[11:20]))
}
return(out)
},
Expand Down
2 changes: 1 addition & 1 deletion R/engine_breg.R
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ engine_breg <- function(x,
# Make a plot
g <- ggplot2::ggplot(data = o, ggplot2::aes(x = partial_effect)) +
ggplot2::theme_classic() +
ggplot2::geom_ribbon(ggplot2::aes(ymin = q05, ymax = q95), fill = "grey90") +
ggplot2::geom_ribbon(ggplot2::aes(ymin = q05, ymax = q95), fill = "grey85") +
ggplot2::geom_line(ggplot2::aes(y = mean)) +
ggplot2::facet_wrap(. ~ variable, scales = "free") +
ggplot2::labs(x = "Variable", y = "Partial effect")
Expand Down
2 changes: 1 addition & 1 deletion R/engine_inlabru.R
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,7 @@ engine_inlabru <- function(x,
if(plot){
g <- ggplot2::ggplot(data = o, ggplot2::aes(x = partial_effect)) +
ggplot2::theme_classic() +
ggplot2::geom_ribbon(ggplot2::aes(ymin = lower, ymax = upper), fill = "grey90") +
ggplot2::geom_ribbon(ggplot2::aes(ymin = lower, ymax = upper), fill = "grey85") +
ggplot2::geom_line(ggplot2::aes(y = mean)) +
ggplot2::facet_wrap(. ~ variable, scales = "free") +
ggplot2::labs(x = "Variable", y = "Partial effect")
Expand Down
2 changes: 1 addition & 1 deletion R/engine_stan.R
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ engine_stan <- function(x,
ymin = mean-stats::sd,
ymax = mean+stats::sd) ) +
ggplot2::theme_classic() +
ggplot2::geom_ribbon(fill = "grey90") +
ggplot2::geom_ribbon(fill = "grey85") +
ggplot2::geom_line() +
ggplot2::labs(x = x.var, y = "Partial effect")
print(pm)
Expand Down
4 changes: 2 additions & 2 deletions R/misc.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ NULL
#' @keywords internal
#' @noRd
ibis_colours <- list(
sdm_colour = colorRampPalette(c('grey90','steelblue4','steelblue1','gold','red1','red4'))(100),
prob_colour = colorRampPalette(c("grey90","springgreen4","cornflowerblue","dodgerblue4","yellow","orange","mediumvioletred","red"))(100),
sdm_colour = colorRampPalette(c('grey85','steelblue4','steelblue1','gold','red1','red4'))(100),
prob_colour = colorRampPalette(c("grey85","springgreen4","cornflowerblue","dodgerblue4","yellow","orange","mediumvioletred","red"))(100),
ohsu_palette = colorRampPalette(c("white","#fbcc3f", "#56ab6c", "#5e9dcc", "#575d5f"))(100),
divg_bluegreen = c("#2C194C","#284577","#4B76A0","#8CA7C3","#D0DCE6","#D4E6D6","#98C39B","#5C9F61","#3E7229","#434C01"),
divg_bluered = c("#4E193D","#44234E","#3B3264","#34487B","#376091","#4B7BA5","#6996B6","#8DADC3","#B1BEC7","#CCC1BE","#D8B7A7",
Expand Down
2 changes: 1 addition & 1 deletion R/utils-bart.R
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ bart_partial_effect <- function(model, x.var, equal = FALSE,
# Construct overall plot.
g <- ggplot2::ggplot(data = out, ggplot2::aes(x = partial_effect)) +
ggplot2::theme_classic() +
ggplot2::geom_ribbon(ggplot2::aes(ymin = q05, ymax = q95), fill = "grey90") +
ggplot2::geom_ribbon(ggplot2::aes(ymin = q05, ymax = q95), fill = "grey85") +
ggplot2::geom_line(ggplot2::aes(y = mean)) +
ggplot2::facet_wrap(. ~ variable, scales = "free") +
ggplot2::labs(x = "Variable", y = "Partial effect")
Expand Down

0 comments on commit 1625415

Please sign in to comment.