Skip to content

Commit

Permalink
Now plotGrowthCurves() with species_panel = TRUE respects `specie…
Browse files Browse the repository at this point in the history
…s` argument. Partially addressing #201
  • Loading branch information
gustavdelius committed Aug 15, 2021
1 parent 7203aa1 commit f08b74c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions R/plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,7 @@ plotGrowthCurves <- function(object, species = NULL,
params <- validParams(object)
}
species <- valid_species_arg(params, species)
sp_sel <- params@species_params$species %in% species
ws <- getGrowthCurves(params, species, max_age, percentage)
plot_dat <- reshape2::melt(ws)
plot_dat$Species <- factor(plot_dat$Species, params@species_params$species)
Expand Down Expand Up @@ -1086,7 +1087,7 @@ plotGrowthCurves <- function(object, species = NULL,
VBdf$a[sel] * length ^ VBdf$b[sel]
})
plot_dat2$Legend <- "von Bertalanffy"
plot_dat <- rbind(plot_dat,plot_dat2)
plot_dat <- rbind(plot_dat, plot_dat2)
}
if (return_data) return(plot_dat)

Expand Down Expand Up @@ -1133,13 +1134,13 @@ plotGrowthCurves <- function(object, species = NULL,
scale_x_continuous(name = "Age [years]") +
scale_y_continuous(name = "Size [g]") +
geom_hline(aes(yintercept = w_mat),
data = tibble(Species = params@species_params$species[],
w_mat = params@species_params$w_mat[]),
data = tibble(Species = params@species_params$species[sp_sel],
w_mat = params@species_params$w_mat[sp_sel]),
linetype = "dashed",
colour = "grey") +
geom_hline(aes(yintercept = w_inf),
data = tibble(Species = params@species_params$species[],
w_inf = params@species_params$w_inf[]),
data = tibble(Species = params@species_params$species[sp_sel],
w_inf = params@species_params$w_inf[sp_sel]),
linetype = "solid",
colour = "grey") +
facet_wrap(~Species, scales = "free_y")
Expand Down

0 comments on commit f08b74c

Please sign in to comment.