@@ -85,28 +85,32 @@ test_that("mcmc_intervals/areas with rhat", {
85
85
expect_error(expect_warning(mcmc_intervals(arr , rhat = rbad )))
86
86
87
87
expect_gg(g <- mcmc_intervals(arr , rhat = r ))
88
- rhat_map <- g $ layers [[3 ]][[" mapping" ]]
89
- expect_identical(as.character(rhat_map [[" colour" ]]), c(" ~" , " rhat_rating" ))
88
+ if (utils :: packageVersion(" ggplot2" ) > = " 3.0.0" ) {
89
+ rhat_map <- g $ layers [[3 ]][[" mapping" ]]
90
+ expect_identical(as.character(rhat_map [[" colour" ]]), c(" ~" , " rhat_rating" ))
91
+ }
90
92
91
93
# areas with rhat.
92
94
93
95
# layer 1 is maybe line vertical line. [skip]
94
96
95
97
# layer 2 is inner interval.
96
98
expect_gg(g2 <- mcmc_areas(arr , rhat = r ))
97
- rhat_map2 <- g2 $ layers [[2 ]][[" mapping" ]]
98
- expect_identical(as.character(rhat_map2 $ fill ), c(" ~" , " rhat_rating" ))
99
- expect_identical(as.character(rhat_map2 $ colour ), c(" ~" , " rhat_rating" ))
99
+ if (utils :: packageVersion(" ggplot2" ) > = " 3.0.0" ) {
100
+ rhat_map2 <- g2 $ layers [[2 ]][[" mapping" ]]
101
+ expect_identical(as.character(rhat_map2 $ fill ), c(" ~" , " rhat_rating" ))
102
+ expect_identical(as.character(rhat_map2 $ colour ), c(" ~" , " rhat_rating" ))
103
+ # layer 3 is point estimate. manually colored. [skip]
100
104
101
- # layer 3 is point estimate. manually colored. [skip]
105
+ # layer 4 is outer interval.
106
+ rhat_map4 <- g2 $ layers [[4 ]][[" mapping" ]]
107
+ expect_identical(as.character(rhat_map4 $ colour ), c(" ~" , " rhat_rating" ))
102
108
103
- # layer 4 is outer interval.
104
- rhat_map4 <- g2 $ layers [[4 ]][[" mapping" ]]
105
- expect_identical(as.character(rhat_map4 $ colour ), c(" ~" , " rhat_rating" ))
109
+ # layer 5 is bottom line.
106
110
107
- # layer 5 is bottom line.
108
- rhat_map5 <- g2 $ layers [[ 5 ]][[ " mapping " ]]
109
- expect_identical(as.character( rhat_map5 $ colour ), c( " ~ " , " rhat_rating " ))
111
+ rhat_map5 <- g2 $ layers [[ 5 ]][[ " mapping " ]]
112
+ expect_identical(as.character( rhat_map5 $ colour ), c( " ~ " , " rhat_rating " ))
113
+ }
110
114
})
111
115
112
116
test_that(" mcmc_areas_data computes density" , {
0 commit comments