Repository navigation
plot.exp_loss(): readable labels on the log-scale y axis - #256
Merged
Merged
Conversation
With log_y = TRUE (the default), the y breaks came from number_ticks(), which spaces them evenly. On a log axis they bunched up at the top and left the lower curves without labels. Use scales::breaks_log(n_y_ticks) unless ybreaks is given.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #256 +/- ##
==========================================
+ Coverage 93.09% 93.15% +0.06%
==========================================
Files 18 18
Lines 1824 1826 +2
==========================================
+ Hits 1698 1701 +3
+ Misses 126 125 -1
🚀 New features to boost your workflow:
|
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.
Found while adding expected loss curves to the README (#254).
Problem
plot.exp_loss()draws the y axis on a log scale by default (log_y = TRUE), but it took its breaks fromnumber_ticks(), which spaces them evenly (0, 20,000, 40,000, …). On a log axis those labels bunch up at the top: 100,000 and 120,000 overlap. The lower part of the axis has no labels at all, and that's where the optimal strategy usually sits at low thresholds. Withcancer_psa_data, everything below 20,000 was unlabeled, although the frontier goes down to about 1,000.Change
With
log_y = TRUEand noybreaksgiven, the breaks now come fromscales::breaks_log(n_y_ticks), which gives 1,000, 3,000, 10,000, 30,000, 100,000 for that example. Ifybreaksis given, it's used as is. The linear axis (log_y = FALSE) is unchanged.Tests
A new test in
test_elc.Rchecks three things:ybreaksare kept;The test fails without the fix.
Verification
main. Only axis labels change.R CMD check --as-crangives only the development-version NOTE.Merge before #254, so the README's expected loss figure is rendered with the fix.