Skip to content

Commit

Permalink
Fixes #1249 consistent casing in plots (#1253)
Browse files Browse the repository at this point in the history
  • Loading branch information
pchelle authored Jul 20, 2024
1 parent f87fa38 commit d94be5b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
9 changes: 5 additions & 4 deletions R/gof-plot-task.R
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ GofPlotTask <- R6::R6Class(

# Plot the residuals across the simulations by output path
for (output in allOutputs) {
Legend <- "Residuals\nlog(Observed)-log(Simulated)"
if (isIncluded(output$residualScale, ResidualScales$Logarithmic)) {
Legend <- "Residuals\nObserved-Simulated"
Legend <- "Residuals\nlog(observed)-log(simulated)"
if (isIncluded(output$residualScale, ResidualScales$Linear)) {
Legend <- "Residuals\nobserved-simulated"
}
residualsMetaData <- list(
"Time" = list(dimension = "Time", unit = structureSets[[1]]$simulationSet$timeUnit),
Expand Down Expand Up @@ -473,7 +473,8 @@ GofPlotTask <- R6::R6Class(
)
residualsQQPlot <- tlf::setPlotLabels(
residualsQQPlot,
ylabel = reEnv$residualsQQLabel
xlabel = reEnv$residualsQQLabelX,
ylabel = reEnv$residualsQQLabelY
)

resultID <- defaultFileNames$resultID(
Expand Down
3 changes: 2 additions & 1 deletion R/reportingengine-env.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ reEnv$fontScaleFactor <- 2
reEnv$workflowWatermarkMessage <- "preliminary analysis"
reEnv$residualsHistogramLabel <- "Relative frequency"
reEnv$demographyHistogramLabel <- "Percentage of population [%]"
reEnv$residualsQQLabel <- "Quantiles of residuals"
reEnv$residualsQQLabelX <- "Standard normal quantiles"
reEnv$residualsQQLabelY <- "Quantiles of residuals"
reEnv$referenceColor <- "grey50"
reEnv$referenceFill <- "grey50"
reEnv$defaultErrorbarCapSize <- 3
Expand Down
4 changes: 2 additions & 2 deletions R/utilities-goodness-of-fit.R
Original file line number Diff line number Diff line change
Expand Up @@ -969,11 +969,11 @@ getResidualsPlotResults <- function(timeRange, residualsData, metaDataFrame, str
output$residualScale
})
if (all(residualScales %in% ResidualScales$Logarithmic)) {
residualsLegend <- "Residuals\nlog(Observed)-log(Simulated)"
residualsLegend <- "Residuals\nlog(observed)-log(simulated)"
residualScale <- ResidualScales$Logarithmic
}
if (all(residualScales %in% ResidualScales$Linear)) {
residualsLegend <- "Residuals\nObserved-Simulated"
residualsLegend <- "Residuals\nobserved-simulated"
residualScale <- ResidualScales$Linear
}

Expand Down
10 changes: 9 additions & 1 deletion R/utilities-plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,15 @@ getGOFPlotConfiguration <- function(plotType,
plotConfiguration$labels$ylabel$text <- reEnv$residualsHistogramLabel
}
if (plotType %in% "resQQPlot") {
plotConfiguration$labels$ylabel$text <- reEnv$residualsQQLabel
# Set quadratic qqplot
newDimension <- mean(c(
plotConfiguration$export$width,
plotConfiguration$export$height
))
plotConfiguration$export$width <- newDimension
plotConfiguration$export$height <- newDimension
plotConfiguration$labels$xlabel$text <- reEnv$residualsQQLabelX
plotConfiguration$labels$ylabel$text <- reEnv$residualsQQLabelY
}

plotConfiguration$points$color <- getColorFromOutputGroup(
Expand Down
Binary file modified inst/extdata/re-env.RData
Binary file not shown.

0 comments on commit d94be5b

Please sign in to comment.