Skip to content

Commit

Permalink
Merge pull request #104 from StoXProject/ecaMeanPlotBug
Browse files Browse the repository at this point in the history
Fixed issue with plotting mean weight/length at age when no groupingv…
  • Loading branch information
edvinf authored Jan 11, 2024
2 parents 75e0203 + ffc2c90 commit 2cb00c9
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: RstoxFDA
Version: 1.3.0-9001
Date: 2023-08-24
Version: 1.3.0-9002
Date: 2023-12-07
Title: Fisheries Dependent Analysis with RstoX
Authors@R: c(
person(given = "Arne Johannes",
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# RstoxFDA v1.3-9002
* Fixed issue with PlotMeanWeightAtAge and PlotMeanLengthAtAge that would not plot mean values for configurations with no grouping variables

# RstoxFDA v1.2.1-9001
* Fixed issue where the DefineCarNeighbours would format column headers differently depending on the chosen DefinitionMethods. The column header 'CarValue' is now consistently written in the singular form, which means that output from the DefinitionMethod 'StratumPolygon' has changed, and the json schema for CarNeighbours has changed.
* Fixed the behavior of AddStratumStoxLanding so that it assigns area NA, rather than halting with error, when positions cannot be assigned to an area.
Expand Down
2 changes: 1 addition & 1 deletion R/StoxPlots.R
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ PlotMeanVariableAtAge <- function(ReportFdaVariableAtAgeData, tableName="MeanWei
if (nrow(ReportFdaVariableAtAgeData$GroupingVariables) == 0){

pl <- ggplot2::ggplot(ReportFdaVariableAtAgeData[[tableName]], ggplot2::aes(group=1)) +
ggplot2::geom_line(ggplot2::aes(x=.data[["AgeGroup"]], y=variable), linetype="solid") +
ggplot2::geom_line(ggplot2::aes(x=.data[["AgeGroup"]], y=.data[[variable]]), linetype="solid") +
ggplot2::geom_line(ggplot2::aes(x=.data[["AgeGroup"]], y=.data[["High"]]), linetype="dashed") +
ggplot2::geom_line(ggplot2::aes(x=.data[["AgeGroup"]], y=.data[["Low"]]), linetype="dashed")
}
Expand Down
Binary file added inst/testresources/meanWeightReportIssue.rds
Binary file not shown.
3 changes: 3 additions & 0 deletions inst/tinytest/test-StoxPlots.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ MeanLengthReport <- RstoxFDA::ReportRecaLengthAtAge(catchAtAgeFlat, Decimals = 4
RstoxFDA:::PlotMeanLengthAtAge(MeanLengthReport)
expect_error(RstoxFDA:::PlotMeanLengthAtAge(catchAtAgeFlat), "Malformed argument: 'ReportFdaLengthAtAgeData'")

# test based on reported bug
mwal <- readRDS(system.file("testresources", "meanWeightReportIssue.rds", package = "RstoxFDA"))
RstoxFDA:::PlotMeanWeightAtAge(mwal)

#
# test traceplot
Expand Down

0 comments on commit 2cb00c9

Please sign in to comment.