Skip to content

Conversation

AtomChen0425
Copy link
Contributor

Summary

This PR fixes a bug in BuildPlots.R where the use of an incorrect bandwidth string in geom_density() caused runtime errors when generating density plots.

Changes

  • Replaced bw = "SJ" with bw = "sj" in all geom_density() calls:
    • Line 108
    • Line 121
    • Line 158

Problem

The original code used bw = "SJ" (uppercase), which is not a valid option for the bw parameter in geom_density(). This caused the following error:

2: Computation failed in `stat_density()`.
Caused by error in `precompute_bw()`:
! `bw` must be one of "nrd0", "nrd", "ucv", "bcv", "sj", "sj-ste", or
  "sj-dpi", not "SJ".
ℹ Did you mean "sj"? 
3: Computation failed in `stat_density()`.
Caused by error in `precompute_bw()`:
! `bw` must be one of "nrd0", "nrd", "ucv", "bcv", "sj", "sj-ste", or
  "sj-dpi", not "SJ".
ℹ Did you mean "sj"? 
4: Computation failed in `stat_density()`.
Caused by error in `precompute_bw()`:
! `bw` must be one of "nrd0", "nrd", "ucv", "bcv", "sj", "sj-ste", or
  "sj-dpi", not "SJ".
ℹ Did you mean "sj"? 
5: Computation failed in `stat_density()`.
Caused by error in `precompute_bw()`:
! `bw` must be one of "nrd0", "nrd", "ucv", "bcv", "sj", "sj-ste", or
  "sj-dpi", not "SJ".
ℹ Did you mean "sj"? 
6: Computation failed in `stat_density()`.
Caused by error in `precompute_bw()`:
! `bw` must be one of "nrd0", "nrd", "ucv", "bcv", "sj", "sj-ste", or
  "sj-dpi", not "SJ".
ℹ Did you mean "sj"? 

Fix

Changed the bandwidth method to lowercase "sj", which is a valid and robust choice for density estimation.

Impact

This fix ensures that density plots are generated correctly without runtime errors, improving the reliability of the plotting templates.

@AndreyAkinshin AndreyAkinshin merged commit 96620b6 into dotnet:master Sep 13, 2025
9 checks passed
@AndreyAkinshin AndreyAkinshin added this to the v0.15.3 milestone Sep 13, 2025
@AndreyAkinshin
Copy link
Member

@AtomChen0425 thanks!

This was referenced Sep 17, 2025
This was referenced Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants