Skip to content

Commit

Permalink
wraps the crossbar geom in suppressWarnings to avoid console messages…
Browse files Browse the repository at this point in the history
… about unknown aesthetics, issue tracked #82
  • Loading branch information
craig-parylo committed Oct 31, 2024
1 parent 92ec0ed commit 878301f
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions R/fct_plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -402,21 +402,27 @@ plot_mixture_distributions <- function(
## geoms ----
# add nee as first geom (to put behind pointrange)
if (input$toggle_nee_reference_range_density) {
plot <- plot +
ggplot2::geom_crossbar(
data = stats::na.omit(focal_pointrange),
ggplot2::aes(
y = y_mid_point,
x = nee_mean * 100,
xmin = nee_p90 * 100,
xmax = nee_p10 * 100,
width = y_mid_point / 5, # set width based on highest point on density
),
#fill = "lightgrey",
colour = "grey60",
#width = 0.015,
alpha = 0.6,
)

# Note - suppressing a warning about width being an unknown aesthetic
# this is tracked in issue #82
suppressWarnings({
plot <- plot +
ggplot2::geom_crossbar(
data = stats::na.omit(focal_pointrange),
ggplot2::aes(
y = y_mid_point,
x = nee_mean * 100,
xmin = nee_p90 * 100,
xmax = nee_p10 * 100,
width = y_mid_point / 5, # set width based on highest point on density
),
#fill = "lightgrey",
colour = "grey60",
#width = 0.015,
alpha = 0.6,
)
})

}

return(plot)
Expand Down

0 comments on commit 878301f

Please sign in to comment.