Repository navigation
fix: plot coverage as numeric in R plot_cross_validation_metric - #2783
Open
ZainnQureshii wants to merge 1 commit into
Open
ZainnQureshii wants to merge 1 commit into
ZainnQureshii wants to merge 1 commit into
Conversation
coverage() returns logical per-point values, which ggplot2 4.0 puts on a discrete axis (FALSE/TRUE at 1/2) beside a numeric rolling average. Convert both plotted columns to numeric. Fixes meta#2721 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Fixes #2721.
plot_cross_validation_metric(df_cv, 'coverage')plots the per-point coverage, whichcoverage()returns as logical, so with ggplot2 4.0 the y axis turns discrete: FALSE/TRUE land at 1 and 2 while the rolling average of 0.5 sits below them. This converts both plotted columns to numeric afterperformance_metrics()inR/R/plot.R, so the points sit at 0/1 on the same axis as the average. Both frames are converted because a negativerolling_windowmakes the average logical too. Numeric metrics are unchanged.The new test in
R/tests/testthat/test_diagnostics.Rchecks the y scale is continuous and both layers' values, forrolling_window = -1and1.Tested with R 4.5.3, ggplot2 4.0.0, testthat 3.3.1:
Rscript testthat.RinR/tests: without the fix 371 passed, 5 failed; with it 376 passed, 0 failed.rcmdcheckwith CI's--no-manual --as-cranflags: 0 errors, 0 warnings, 2 notes (clock lookup, unused imports, neither in the changed files).devtools::document()leavesman/unchanged.Prepared with AI assistance (Claude Code) and reviewed with GitHub Copilot.
🤖 Generated with Claude Code