From 61e58a4ef1954c42088494f06fc97665a927117d Mon Sep 17 00:00:00 2001 From: Gustav Delius Date: Sat, 4 Sep 2021 10:30:04 +0200 Subject: [PATCH] `plotGrowthCurves()` with `species_panels = TRUE` now plots the panels in the correct order. Closes #201 --- NEWS.md | 5 +++-- R/plots.R | 4 ++-- docs/dev/news/index.html | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/NEWS.md b/NEWS.md index 71a241e70..90e1a0d1d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -86,8 +86,9 @@ `plotGrowthCurves()` are now correct, and no longer extend above the asymptotic size. * `plotGrowthCurves()` with `species_panel = TRUE` now respects the `species` - argument to only show growth curves for selected species, and it works with - a MizerParams object as well as a MizerSim object. + argument to only show growth curves for selected species, it works with + a MizerParams object as well as a MizerSim object, and it shows the panels + in the correct order. #201 * Reinstated the example .csv files that were missing from the package because the vignettes are no longer included. diff --git a/R/plots.R b/R/plots.R index b133e0a1d..cb6bc68e2 100644 --- a/R/plots.R +++ b/R/plots.R @@ -1156,12 +1156,12 @@ 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[sp_sel], + data = tibble(Species = factor(legend_levels), 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[sp_sel], + data = tibble(Species = factor(legend_levels), w_inf = params@species_params$w_inf[sp_sel]), linetype = "solid", colour = "grey") + diff --git a/docs/dev/news/index.html b/docs/dev/news/index.html index 2852a0237..05c0ddd5f 100644 --- a/docs/dev/news/index.html +++ b/docs/dev/news/index.html @@ -255,7 +255,7 @@

  • Changing linecolour or linetype in the species parameters now actually changes the linecolours and linetypes as intended.
  • Growth curves calculated with getGrowthCurves() and plotted with plotGrowthCurves() are now correct, and no longer extend above the asymptotic size.
  • -plotGrowthCurves() with species_panel = TRUE now respects the species argument to only show growth curves for selected species, and it works with a MizerParams object as well as a MizerSim object.
  • +plotGrowthCurves() with species_panel = TRUE now respects the species argument to only show growth curves for selected species, it works with a MizerParams object as well as a MizerSim object, and it shows the panels in the correct order. #201
  • Reinstated the example .csv files that were missing from the package because the vignettes are no longer included.