File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+ # In R devel from 4.3.0 onwards, the density calculation has slightly changed,
3
+ # which affects visual snapshots that use a density calculation, like
4
+ # `geom_violin()` and `geom_density()`.
5
+ # See https://developer.r-project.org/blosxom.cgi/R-devel/NEWS/2023/05/03#n2023-05-03
6
+ #
7
+ # It has a backwards compatibility argument called 'old.coords' that can be used
8
+ # to perform the classic density calculation, which means we can stably use
9
+ # visual tests in R devel.
10
+ #
11
+ # Since that argument is not available in older versions, we have to use the
12
+ # following workaround. Here, we conditionally override the default
13
+ # density method to use `old.coords = TRUE`.
14
+ if (" old.coords" %in% names(formals(stats :: density.default ))) {
15
+ registerS3method(
16
+ " density" , " default" ,
17
+ function (... , old.coords = TRUE ) {
18
+ stats :: density.default(... , old.coords = old.coords )
19
+ }
20
+ )
21
+ }
You can’t perform that action at this time.
0 commit comments