Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 979681f

Browse files
committed
ggridges: remove unnecessary test, put seed for jittered points
1 parent ab07c32 commit 979681f

File tree

6 files changed

+9
-38
lines changed

6 files changed

+9
-38
lines changed

‎tests/testthat/_snaps/ggridges/jittering-points.svg

Lines changed: 1 addition & 1 deletion
Loading[フレーム]

‎tests/testthat/_snaps/ggridges/raincloud-effect.svg

Lines changed: 1 addition & 1 deletion
Loading[フレーム]

‎tests/testthat/_snaps/ggridges/raincloud-vertical-line-points.svg

Lines changed: 1 addition & 1 deletion
Loading[フレーム]

‎tests/testthat/_snaps/ggridges/styling-points.svg

Lines changed: 1 addition & 1 deletion
Loading[フレーム]

‎tests/testthat/_snaps/ggridges/styling-points2.svg

Lines changed: 1 addition & 1 deletion
Loading[フレーム]

‎tests/testthat/test-ggridges.R

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ test_that(
99
data <- data.frame(x = 1:5, y = rep(1, 5), height = c(0, 1, 3, 4, 2))
1010
p <- ggplot(data, aes(x, y, height = height)) + geom_ridgeline()
1111

12-
expect_no_error(
13-
p2 <- plotly_build(p)
14-
)
1512
p2 <- ggplotly(p)
1613

1714
expect_doppelganger(p2, 'basic_ridgeline')
@@ -23,15 +20,13 @@ test_that(
2320

2421
## Negative height cut off
2522
p <- plot_base + geom_ridgeline()
26-
expect_no_error(plotly_build(p))
2723

2824
p2 <- ggplotly(p)
2925
expect_doppelganger(p2, 'negative_height_cut')
3026

3127

3228
## Negative height allowed
3329
p <- plot_base + geom_ridgeline(min_height = -2)
34-
expect_no_error(plotly_build(p))
3530

3631
p2 <- ggplotly(p)
3732
expect_doppelganger(p2, 'negative_height_retained')
@@ -46,15 +41,13 @@ test_that(
4641

4742
p <- ggplot(d, aes(x, y, height = height, group = y)) +
4843
geom_ridgeline(fill = "lightblue")
49-
expect_no_error(plotly_build(p))
5044

5145
p2 <- ggplotly(p)
5246
expect_doppelganger(p2, 'multiple_ridgelines')
5347

5448
# stat = identity (works)
5549
p <- ggplot(d, aes(x, y, height = height, group = y)) +
5650
geom_density_ridges(stat = "identity", scale = 1)
57-
expect_no_error(plotly_build(p))
5851

5952
p2 <- ggplotly(p)
6053
expect_doppelganger(p2, 'stat_identity')
@@ -69,13 +62,11 @@ test_that(
6962

7063
p <- ggplot(iris, aes(x = Sepal.Length, y = Species)) +
7164
geom_density_ridges()
72-
expect_no_error(plotly_build(p))
7365
p2 <- ggplotly(p)
7466
expect_doppelganger(p2, 'density_ridgeline')
7567

7668
# geom_density_ridges2 (closed polygon)
7769
p <- ggplot(iris, aes(x = Sepal.Length, y = Species)) + geom_density_ridges2()
78-
expect_no_error(plotly_build(p))
7970
p2 <- ggplotly(p)
8071
expect_doppelganger(p2, 'density_ridgeline2')
8172

@@ -88,47 +79,39 @@ test_that(
8879
y = Species_num,
8980
group = Species_num)) +
9081
geom_density_ridges()
91-
expect_no_error(plotly_build(p))
9282
p2 <- ggplotly(p)
9383
expect_doppelganger(p2, 'numeric_grouping')
9484

9585
# Cutting trailing tails (works)
9686
p <- ggplot(iris, aes(x = Sepal.Length, y = Species)) +
9787
geom_density_ridges(rel_min_height = 0.01)
98-
expect_no_error(plotly_build(p))
9988
p2 <- ggplotly(p)
10089
expect_doppelganger(p2, 'cutting_tails')
101-
ggplotly(p)
102-
10390

10491
# Non-overlapping ridges (Works)
10592
p <- ggplot(iris, aes(x = Sepal.Length, y = Species)) +
10693
geom_density_ridges(scale = 0.9)
107-
expect_no_error(plotly_build(p))
10894
p2 <- ggplotly(p)
10995
expect_doppelganger(p2, 'overlapping_none')
11096

11197

11298
# Exactly touching (Works)
11399
p <- ggplot(iris, aes(x = Sepal.Length, y = Species)) +
114100
geom_density_ridges(scale = 1)
115-
expect_no_error(plotly_build(p))
116101
p2 <- ggplotly(p)
117102
expect_doppelganger(p2, 'overlapping_touching')
118103

119104

120105
# scale = 5, substantial overlap (Works)
121106
p <- ggplot(iris, aes(x = Sepal.Length, y = Species)) +
122107
geom_density_ridges(scale = 5)
123-
expect_no_error(plotly_build(p))
124108
p2 <- ggplotly(p)
125109
expect_doppelganger(p2, 'overlapping_lot')
126110

127111

128112
# Panel scaling (Works)
129113
p <- ggplot(iris, aes(x = Sepal.Length, y = Species)) +
130114
geom_density_ridges(scale = 1) + facet_wrap(~Species)
131-
expect_no_error(plotly_build(p))
132115
p2 <- ggplotly(p)
133116
expect_doppelganger(p2, 'overlapping_facet_touching')
134117

@@ -150,7 +133,6 @@ test_that(
150133
p <- ggplot(d, aes(x, y, height = height, group = y, fill = factor(x+y))) +
151134
geom_ridgeline_gradient() +
152135
scale_fill_viridis_d(direction = -1, guide = "none")
153-
expect_no_error(plotly_build(p))
154136
p2 <- ggplotly(p)
155137
expect_doppelganger(p2, 'varying_fill_colours')
156138

@@ -168,14 +150,12 @@ test_that(
168150
# quantile multiple lines
169151
p <- ggplot(iris, aes(x = Sepal.Length, y = Species)) +
170152
stat_density_ridges(quantile_lines = TRUE)
171-
expect_no_error(plotly_build(p))
172153
p2 <- ggplotly(p)
173154
expect_doppelganger(p2, 'quantile_lines_multi')
174155

175156
# quantile single line
176157
p <- ggplot(iris, aes(x = Sepal.Length, y = Species)) +
177158
stat_density_ridges(quantile_lines = TRUE, quantiles = 2)
178-
expect_no_error(plotly_build(p))
179159
p2 <- ggplotly(p)
180160
expect_doppelganger(p2, 'quantile_lines_1')
181161

@@ -184,7 +164,6 @@ test_that(
184164
stat_density_ridges(quantile_lines = TRUE,
185165
quantiles = c(0.025, 0.975),
186166
alpha = 0.7)
187-
expect_no_error(plotly_build(p))
188167
p2 <- ggplotly(p)
189168
expect_doppelganger(p2, 'quantile_cut_points')
190169

@@ -199,10 +178,10 @@ test_that(
199178
) +
200179
scale_fill_viridis_d(name = "Quartiles")
201180
)
181+
202182
suppressWarnings(
203-
expect_no_error(plotly_build(p))
183+
p2<- ggplotly(p)
204184
)
205-
p2 <- ggplotly(p)
206185
expect_doppelganger(p2, 'quantile_colouring')
207186

208187

@@ -217,7 +196,6 @@ test_that(
217196
name = "Probability", values = c("#FF0000A0", "#A0A0A0A0", "#0000FFA0"),
218197
labels = c("(0, 0.025]", "(0.025, 0.975]", "(0.975, 1]")
219198
)
220-
expect_no_error(plotly_build(p))
221199
p2 <- ggplotly(p)
222200
expect_doppelganger(p2, 'quantile_colouring_tails_only')
223201

@@ -236,10 +214,10 @@ test_that(
236214
desc = "ggridges points",
237215
code = {
238216

217+
set.seed(123) # make jittering reproducible
239218
# jittering points (works)
240219
p <- ggplot(iris, aes(x = Sepal.Length, y = Species)) +
241220
geom_density_ridges(jittered_points = TRUE)
242-
expect_no_error(plotly_build(p))
243221
p2 <- ggplotly(p)
244222
expect_doppelganger(p2, 'jittering points')
245223

@@ -249,7 +227,6 @@ test_that(
249227
jittered_points = TRUE, position = "raincloud",
250228
alpha = 0.7, scale = 0.9
251229
)
252-
expect_no_error(plotly_build(p))
253230
p2 <- ggplotly(p)
254231
expect_doppelganger(p2, 'raincloud_effect')
255232

@@ -270,7 +247,6 @@ test_that(
270247
) +
271248
scale_point_color_hue(l = 40) +
272249
scale_discrete_manual(aesthetics = "point_shape", values = c(21, 22, 23))
273-
expect_no_error(plotly_build(p))
274250
p2 <- ggplotly(p)
275251
expect_doppelganger(p2, 'styling_points')
276252

@@ -282,7 +258,6 @@ test_that(
282258
) +
283259
scale_point_color_hue(l = 40) + scale_point_size_continuous(range = c(0.5, 4)) +
284260
scale_discrete_manual(aesthetics = "point_shape", values = c(21, 22, 23))
285-
expect_no_error(plotly_build(p))
286261
p2 <- ggplotly(p)
287262
expect_doppelganger(p2, 'styling_points2')
288263

@@ -295,7 +270,6 @@ test_that(
295270
point_size = 0.4, point_alpha = 1,
296271
position = position_raincloud(adjust_vlines = TRUE)
297272
)
298-
expect_no_error(plotly_build(p))
299273
p2 <- ggplotly(p)
300274
expect_doppelganger(p2, 'raincloud_vertical_line_points')
301275

@@ -312,9 +286,8 @@ test_that(
312286
p <- ggplot(iris, aes(x = Sepal.Length, y = Species, height = stat(density))) +
313287
geom_density_ridges(stat = "density")
314288

315-
expect_no_error(plotly_build(p))
289+
p2<- ggplotly(p)
316290
})
317-
p2 <- ggplotly(p)
318291
expect_doppelganger(p2, 'stat_density')
319292

320293

@@ -326,14 +299,12 @@ test_that(
326299

327300
p <- ggplot(iris_densities, aes(x = Sepal.Length, y = Species, height = density)) +
328301
geom_density_ridges(stat = "identity")
329-
expect_no_error(plotly_build(p))
330302
p2 <- ggplotly(p)
331303
expect_doppelganger(p2, 'manual_densities_stat_identity')
332304

333305
## histograms (works)
334306
p <- ggplot(iris, aes(x = Sepal.Length, y = Species, height = stat(density))) +
335307
geom_density_ridges(stat = "binline", bins = 20, scale = 0.95, draw_baseline = FALSE)
336-
expect_no_error(plotly_build(p))
337308
p2 <- ggplotly(p)
338309
expect_doppelganger(p2, 'histogram_ridges')
339310

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /