Skip to content

Commit

Permalink
fixed optional error visualization for butterfly plot
Browse files Browse the repository at this point in the history
  • Loading branch information
werpuc committed Oct 3, 2024
1 parent eb9a10d commit 500008d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions R/plot_butterfly.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,9 @@ plot_butterfly <- function(uptake_dat,
))
) else geom_point()

chosen_uncertainty_geom <- switch (
uncertainty_type,
ribbon = geom_ribbon(alpha = 0.5, size = 0, linetype = "blank"),
bars = geom_errorbar(width = 0.25, alpha = 0.5),
`bars + line` = geom_errorbar(width = 0.25, alpha = 0.5) + geom_line()
)
chosen_uncertainty_geom <- if(uncertainty_type == "ribbon") {
geom_ribbon(alpha = 0.5, size = 0, linetype = "blank")
} else { geom_errorbar(width = 0.25, alpha = 0.5) }

butterfly_plot <- ggplot(
plot_dat,
Expand All @@ -125,6 +122,8 @@ plot_butterfly <- function(uptake_dat,
y = y_label) +
theme(legend.position = "bottom")

if(uncertainty_type == "bars + line") butterfly_plot <- butterfly_plot + geom_line()

return(HaDeXify(butterfly_plot))

}

0 comments on commit 500008d

Please sign in to comment.