Skip to content

Commit

Permalink
additional plot cusomization options
Browse files Browse the repository at this point in the history
  • Loading branch information
Dwightbaldwin committed Sep 13, 2024
1 parent c1b468e commit b49c15f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions R/plot_combined.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
#' @param bear1d_list Bear1D list as retrieved by \code{\link{calculate_bear1d}}
#' @param text_size size of plot title and axis labels, default: 20
#' @param line_width line width, default: 1.25
#' @param xbreaks breaks on x axis, default: 200
#' @return combined plot
#' @export
#' @importFrom rlang .data
#' @importFrom ggplot2 ggplot theme_bw geom_line scale_color_gradient2
#' scale_y_continuous scale_x_continuous theme element_text xlab ylab labs
plot_combined <- function(bear1d_list, text_size = 20, line_width = 1.25)

plot_combined <- function(bear1d_list, text_size = 20, line_width = 1.25, xbreaks = 200)
{
inputs <- attr(bear1d_list, "inputs")

Expand Down Expand Up @@ -60,7 +62,7 @@ plot_combined <- function(bear1d_list, text_size = 20, line_width = 1.25)
) + # Adjust the tick spacing as needed
ggplot2::scale_x_continuous(
limits = c(0, tmax),
breaks = seq(0, tmax, by = 400)
breaks = seq(0, tmax, by = xbreaks)
)

list(plot = combined_plot,
Expand Down
4 changes: 3 additions & 1 deletion man/plot_combined.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vignettes/Generic_Model.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ bear1d_Generic_combined <- kwb.1dbear::calculate_bear1d(
)
# Combine the plots
Generic_combined <- kwb.1dbear::plot_combined(bear1d_Generic_combined)
Generic_combined <- kwb.1dbear::plot_combined(bear1d_Generic_combined, xbreaks = 500)
print(Generic_combined$plot)
Expand Down
2 changes: 1 addition & 1 deletion vignettes/case-studies.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ bear1d_vienna_combined <- kwb.1dbear::calculate_bear1d(
hl_values = c(500, 2000),
D_values = 10,
v_values = 21.3,
t_values = seq(0, 350, by = 1),
t_values = seq(0, 400, by = 1),
x_values = 141
)
Expand Down

0 comments on commit b49c15f

Please sign in to comment.