Repository navigation
More small plot updates - #969
Conversation
- h_plot_doses_tried() now uses a data-driven y-axis instead of always extending to 100%. - The calculation now pools all patients across all simulated trials: patients at dose / total patients across simulations
There was a problem hiding this comment.
🟡 Changes recommended
A newly added test computes the true-MTD selection percentage incorrectly when multiple true MTD doses exist, which can make the assertion wrong or flaky.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR updates several plotting helpers and nextBest() visualizations to improve interpretability and alignment of probability plots, and expands simulation summary plotting to surface “true MTD” information (including legend control) while updating snapshot expectations across OSes.
Changes:
- Updated dose-tried plots to reflect pooled patient proportions and revised y-axis labeling.
- Added
safe_dose_markersupport tonextBest()/NCRM loss plots (line vs triangle marker) and introduced configurable y-axis behavior for probability plots. - Extended
GeneralSimulationsSummarywith atrue_mtdslot and enhanced summary plotting/tests/docs accordingly (including new snapshots and Rd updates).
File summaries
| File | Description |
|---|---|
| tests/testthat/test-Simulations-methods.R | Adds/updates plot expectations for simulations + summary plots (labels, trajectory geom, true MTD markers, meanFit behavior). |
| tests/testthat/test-Simulations-class.R | Extends GeneralSimulationsSummary generator test to include new true_mtd slot. |
| tests/testthat/test-Rules-methods.R | Expands nextBest() plotting tests for y-axis alignment and triangle safety marker option. |
| tests/testthat/test-helpers_rules.R | Adds helper tests for full-probability y-limits and reference-line linetypes. |
| tests/testthat/_snaps/Windows/Simulations-methods/plot-pseudodualsims-dosestried.svg | Snapshot update for doses-tried y-axis label change (Windows). |
| tests/testthat/_snaps/Windows/Simulations-methods/plot-pseudodualflexisims-dosestried.svg | Snapshot update for doses-tried y-axis label change (Windows). |
| tests/testthat/_snaps/Windows/Simulations-methods/plot-generalsims-dosestried.svg | Snapshot update for doses-tried y-axis label change (Windows). |
| tests/testthat/_snaps/Linux/Simulations-methods/plot-pseudodualsims-dosestried.svg | Snapshot update for doses-tried y-axis label change (Linux). |
| tests/testthat/_snaps/Linux/Simulations-methods/plot-pseudodualflexisims-dosestried.svg | Snapshot update for doses-tried y-axis label change (Linux). |
| tests/testthat/_snaps/Linux/Simulations-methods/plot-generalsims-dosestried.svg | Snapshot update for doses-tried y-axis label change (Linux). |
| tests/testthat/_snaps/Darwin/Simulations-methods/plot-pseudodualsims-trajectory.new.svg | New/updated snapshot for trajectory plot rendering (Darwin). |
| tests/testthat/_snaps/Darwin/Simulations-methods/plot-pseudodualsims-dosestried.svg | Snapshot update for doses-tried y-axis label change (Darwin). |
| tests/testthat/_snaps/Darwin/Simulations-methods/plot-pseudodualsims-dosestried.new.svg | New/updated snapshot variant for doses-tried plot (Darwin). |
| tests/testthat/_snaps/Darwin/Simulations-methods/plot-pseudodualflexisims-trajectory.new.svg | New/updated snapshot for trajectory plot rendering (Darwin). |
| tests/testthat/_snaps/Darwin/Simulations-methods/plot-pseudodualflexisims-dosestried.svg | Snapshot update for doses-tried y-axis label change (Darwin). |
| tests/testthat/_snaps/Darwin/Simulations-methods/plot-generalsims-trajectory.new.svg | New/updated snapshot for trajectory plot rendering (Darwin). |
| tests/testthat/_snaps/Darwin/Simulations-methods/plot-generalsims-dosestried.svg | Snapshot update for doses-tried y-axis label change (Darwin). |
| tests/testthat/_snaps/Darwin/Simulations-methods/plot-generalsims-dosestried.new.svg | New/updated snapshot variant for doses-tried plot (Darwin). |
| tests/testthat/_snaps/Darwin/Rules-methods/plot-of-nextbest-nextbestncrmloss-p2.svg | Snapshot update reflecting reference-line linetype changes / axis scaling (Darwin). |
| tests/testthat/_snaps/Darwin/Rules-methods/plot-of-nextbest-nextbestncrmloss-p1.svg | Snapshot update reflecting reference-line linetype changes / axis scaling (Darwin). |
| tests/testthat/_snaps/Darwin/Rules-methods/plot-of-nextbest-nextbestncrm-p2.svg | Snapshot update reflecting reference-line linetype changes / axis scaling (Darwin). |
| tests/testthat/_snaps/Darwin/Rules-methods/plot-of-nextbest-nextbestncrm-p1.svg | Snapshot update reflecting reference-line linetype changes / axis scaling (Darwin). |
| tests/testthat/_snaps/Darwin/Rules-methods/plot-of-nextbest-nextbestewoc.svg | Snapshot update reflecting reference-line linetype changes / axis scaling (Darwin). |
| tests/testthat/_snaps/Darwin/Rules-methods/plot-of-nextbest-nextbestdualendpoint-p2.svg | Snapshot update reflecting reference-line linetype changes / axis scaling (Darwin). |
| tests/testthat/_snaps/Darwin/Rules-methods/plot-of-nextbest-nextbestdualendpoint-p1.svg | Snapshot update reflecting reference-line linetype changes / axis scaling (Darwin). |
| tests/testthat/_snaps/Darwin/Rules-methods/plot-nextbest-nextbestncrm-lollipop-uneven-dose-grid.svg | Snapshot update reflecting probability y-axis scaling and reference lines (Darwin). |
| tests/testthat/_snaps/Darwin/Rules-methods/plot-nextbest-nextbestncrm-log-dose-scale.svg | Snapshot update reflecting probability y-axis scaling and reference lines (Darwin). |
| tests/testthat/_snaps/Darwin/helpers_rules/h-next-best-ncrm-loss-plot-unacpt-p2.svg | Snapshot update reflecting probability y-axis scaling and reference lines (Darwin). |
| tests/testthat/_snaps/Darwin/helpers_rules/h-next-best-ncrm-loss-plot-unacpt-p1.svg | Snapshot update reflecting probability y-axis scaling and reference lines (Darwin). |
| tests/testthat/_snaps/Darwin/helpers_rules/h-next-best-ncrm-loss-plot-p2.svg | Snapshot update reflecting probability y-axis scaling and reference lines (Darwin). |
| tests/testthat/_snaps/Darwin/helpers_rules/h-next-best-ncrm-loss-plot-p1.svg | Snapshot update reflecting probability y-axis scaling and reference lines (Darwin). |
| R/Simulations-class.R | Adds true_mtd slot to GeneralSimulationsSummary class and documents it. |
| R/Rules-methods.R | Adds safe_dose_marker argument and switches probability plot y-axis handling via helper behavior. |
| R/helpers_simulations.R | Extends h_barplot_percentages() to support explicit discrete level ordering. |
| R/helpers_rules.R | Refactors probability plot y-axis handling (fixed_y_axis), adjusts reference-line linetypes, and adds h_next_best_safety_marker(). |
| man/plot-SimulationsSummary-missing-method.Rd | Documents true_mtd_legend and clarifies meanFit target display behavior. |
| man/plot-GeneralSimulationsSummary-missing-method.Rd | Documents true_mtd_legend and expands details on available plot types. |
| man/nextBest.Rd | Documents new safe_dose_marker parameter across nextBest() methods. |
| man/h_plot_doses_tried.Rd | Updates description to reflect pooled patient proportions. |
| man/h_next_best_safety_marker.Rd | New Rd entry for the new internal helper. |
| man/h_next_best_probability_plot.Rd | Documents new fixed_y_axis argument. |
| man/h_next_best_ncrm_loss_plot.Rd | Documents new safe_dose_marker argument. |
| man/h_next_best_marker.Rd | Documents new label/colour parameters for markers. |
| man/h_barplot_percentages.Rd | Documents new discrete_levels argument. |
| man/GeneralSimulationsSummary-class.Rd | Documents the new true_mtd slot. |
Review details
Files not reviewed (10)
- man/GeneralSimulationsSummary-class.Rd: Generated file
- man/h_barplot_percentages.Rd: Generated file
- man/h_next_best_marker.Rd: Generated file
- man/h_next_best_ncrm_loss_plot.Rd: Generated file
- man/h_next_best_probability_plot.Rd: Generated file
- man/h_next_best_safety_marker.Rd: Generated file
- man/h_plot_doses_tried.Rd: Generated file
- man/nextBest.Rd: Generated file
- man/plot-GeneralSimulationsSummary-missing-method.Rd: Generated file
- man/plot-SimulationsSummary-missing-method.Rd: Generated file
- Files reviewed: 9/61 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Unit Tests Summary 1 files 59 suites 2m 28s ⏱️ Results for commit fd0d4e4. ♻️ This comment has been updated with latest results. |
Unit Test Performance Difference
Additional test case details
Results for commit 9ac3d67 ♻️ This comment has been updated with latest results. |
This PR updates several plotting helpers and
nextBest()visualizations to improve interpretability and alignment of probability plots, and expands simulation summary plotting to surface “true MTD” information (including legend control) while updating snapshot expectations across OSes.Changes:
safe_dose_markersupport tonextBest()/NCRM loss plots (line vs triangle marker) and introduced configurable y-axis behavior for probability plots.GeneralSimulationsSummarywith atrue_mtdslot and enhanced summary plotting/tests/docs accordingly (including new snapshots and Rd updates).