Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export(plot_landings)
export(plot_natural_mortality)
export(plot_recruitment)
export(plot_recruitment_deviations)
export(plot_spawn_recruitment)
export(plot_spawning_biomass)
export(plot_stock_recruitment)
export(plot_timeseries)
export(process_data)
export(reference_line)
Expand Down
8 changes: 4 additions & 4 deletions R/plot_spawn_recruitment.R → R/plot_stock_recruitment.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Plot Spawn-Recruit Relationship
#' Plot Stock Recruit Relationship
#'
#' @inheritParams plot_spawning_biomass
#' @param interactive Indicate whether the environment the
Expand All @@ -8,21 +8,21 @@
#' @param spawning_biomass_label Units for spawning biomass
#' @param recruitment_label units for recruitment
#'
#' @return Plot the spawn recruitment relationship from an assessment model output file
#' @return Plot the stock recruitment relationship from an assessment model output file
#' translated to a standardized output (\link[asar]{convert_output}). There are options to return a
#' [ggplot2::ggplot()] object or export an rda object containing associated
#' caption and alternative text for the figure.
#' @export
#'
#' @examples
#' plot_spawn_recruitment(
#' plot_stock_recruitment(
#' dat = stockplotr:::example_data,
#' interactive = FALSE,
#' spawning_biomass_label = "metric tons",
#' recruitment_label = "metric tons",
#' module = "SPAWN_RECRUIT"
#' )
plot_spawn_recruitment <- function(
plot_stock_recruitment <- function(
dat,
spawning_biomass_label = "mt",
recruitment_label = "mt",
Expand Down
4 changes: 2 additions & 2 deletions R/save_all_plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ save_all_plots <- function(
# imported from plot_landings
landings_unit_label = "mt",
# imported from plot_recruitment_deviations- zero unique arguments
# imported from plot_spawn_recruitment
# imported from plot_stock_recruitment
spawning_biomass_label = "mt",
spawning_biomass_scale_amount = 1,
# imported from plot_spawning_biomass
Expand Down Expand Up @@ -189,7 +189,7 @@ save_all_plots <- function(
}
)

# plot_spawn_recruitment(dat,
# plot_stock_recruitment(dat,
# spawning_biomass_label,
# recruitment_label = recruitment_unit_label,
# make_rda,
Expand Down
4 changes: 2 additions & 2 deletions R/utils_rda.R
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ add_more_key_quants <- function(
}

if (!is.null(sr_ssb_units)) {
### this is for plot_spawn_recruitment, since there are two units
### this is for plot_stock_recruitment, since there are two units
#### replace sr.ssb.units with sr_ssb_units
topic_cap_alt <- topic_cap_alt |>
dplyr::mutate(alt_text = stringr::str_replace_all(
Expand All @@ -562,7 +562,7 @@ add_more_key_quants <- function(
}

if (!is.null(sr_recruitment_units)) {
### this is for plot_spawn_recruitment, since there are two units
### this is for plot_stock_recruitment, since there are two units
#### replace sr.units with sr_recruitment_units
topic_cap_alt <- topic_cap_alt |>
dplyr::mutate(alt_text = stringr::str_replace_all(
Expand Down
16 changes: 8 additions & 8 deletions man/plot_spawn_recruitment.Rd → man/plot_stock_recruitment.Rd

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

Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ load(file.path(
"std_output.rda"
))

test_that("plot_spawn_recruitment generates plots without errors", {
test_that("plot_stock_recruitment generates plots without errors", {
# expect error-free plot with minimal arguments
expect_no_error(
stockplotr::plot_spawn_recruitment(
stockplotr::plot_stock_recruitment(
dat = out_new
)
)

# expect error-free plot with many arguments
expect_no_error(
stockplotr::plot_spawn_recruitment(
stockplotr::plot_stock_recruitment(
out_new,
spawning_biomass_label = "mt",
recruitment_label = "mt",
Expand All @@ -26,7 +26,7 @@ test_that("plot_spawn_recruitment generates plots without errors", {

# expect ggplot object is returned
expect_s3_class(
stockplotr::plot_spawn_recruitment(
stockplotr::plot_stock_recruitment(
out_new,
spawning_biomass_label = "mt",
recruitment_label = "mt",
Expand All @@ -39,7 +39,7 @@ test_that("plot_spawn_recruitment generates plots without errors", {

test_that("rda file made when indicated", {
# export rda
plot_spawn_recruitment(
plot_stock_recruitment(
out_new,
spawning_biomass_label = "mt",
recruitment_label = "mt",
Expand Down
Loading