Streamline plotting code and unify array comparison methods - #541
Merged
Conversation
- Add size_axis, llim, per_log_size, and proportion scaling support to ArrayResourceBySize and ArrayTimeByResourceBySize plotting methods (plot2, plotRelative, addPlot), achieving full symmetry with species arrays. - Add array_log_y() and array_ylim() to plot2.ArraySpeciesBySize, plot2.ArrayTimeBySpecies, and animate.ArrayTimeBySpeciesBySize so proportion arrays default to linear [0, 1] y-axes uniformly. - Streamline plotYield.MizerSim to delegate single-simulation plotting directly to plot(getYield(sim)) and deprecate the two-simulation sim2 argument in favour of plot2(getYield(sim1), getYield(sim2)). - Remove redundant internal parseTimePlotLog in favour of parsePlotLog. - Refactor plotFeedingLevel to delegate to plot() and addPlot() on ArraySpeciesBySize, with non-clipping cartesian coordinates for proportion ranges, and simplify plotlyFeedingLevel to plotHover(plotFeedingLevel(...)). - Ensure length-axis Total calculation in plot_cdf(), plotSpectra2(), plotSpectraRelative(), and plotCDF2() properly evaluates species-specific conversions before total aggregation. - Add tests covering resource array methods on length/log-size axes, comparison totals, and feeding level delegation.
gustavdelius
force-pushed
the
refactor-plotting-streamline
branch
from
August 16, 2026 08:06
18c1472 to
4237b22
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
This pull request streamlines the plotting codebase and makes method behaviours more uniform, logical, and maintainable on top of PRs #538, #539, and #540:
1. Resource Array Method Symmetry
size_axis,llim,per_log_size,array_log_y(),array_ylim(), and unit-aware axis labelling helpers (plot_size_xlab(),plot_size_xlim()) acrossplot2(),plotRelative(), andaddPlot()for bothArrayResourceBySizeandArrayTimeByResourceBySize.2. Uniform Proportion Array Scaling
array_log_y()andarray_ylim()toplot2.ArraySpeciesBySize,plot2.ArrayTimeBySpecies, andanimate.ArrayTimeBySpeciesBySize.[0, 1]y-axes (widening to accommodate data when needed) across both single and comparison plots.3.
plotYieldStreamlining & Redundant Parser RemovalparseTimePlotLogwithparsePlotLogacrossplotBiomassandplotYieldGear.plotYield.MizerSimso that a single simulation delegates directly toplot(getYield(object))(settingvalue_name = "Yield"for proper labelling).sim2argument ofplotYield()withlifecycle::deprecate_warn("2.6.0", "plotYield(sim2)", "plot2()", details = "Use plot2(getYield(sim1), getYield(sim2)) instead.").4. Length-axis Total Calculation
plot_cdf()withvalidParams(params)so that missing length–weight coefficientsaandbare resolved before conversion.plot_cdf(),plotSpectra2(),plotSpectraRelative(), andplotCDF2()to properly evaluate species-specific length conversions before computing total curves and normalisations.5.
plotFeedingLevel&plotlyFeedingLevelRefactoringplotFeedingLevel()to delegate directly toplot()andaddPlot()onArraySpeciesBySize, using non-clipping cartesian coordinate limits for proportion ranges.plotlyFeedingLevel()toplotHover(plotFeedingLevel(...)).6. Testing & Documentation
tests/testthat/test-ArrayResourceBySize-class.Randtests/testthat/test-plots.R.NEWS.mdand package documentation.Testing
test-plots.R, 91 in array classes, and full test suite passing cleanly).