Skip to content

Commit d2e9a7d

Browse files
committed
Add sample.id to tooltip mouseover for scatterplots
1 parent c4de919 commit d2e9a7d

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

R/mod_plot_fct_plot.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
if (hexbin) {
6969
p <- p + geom_hex(aes_string())
7070
} else {
71-
p <- p + geom_point(aes_string(color = group_var_str))
71+
p <- p + geom_point(aes_string(color = group_var_str, label = "sample.id"))
7272
}
7373

7474
if (abline) {

tests/testthat/test-mod-plot-fct.R

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ library(vdiffr)
55
set.seed(123)
66
n <- 100
77
dat <- data.frame(
8+
sample.id = sprintf("samp%03d", 1:n),
89
quant1 = rnorm(n),
910
quant2 = rnorm(n),
1011
cat1 = sample(letters[1:3], n, replace = T),
@@ -100,7 +101,7 @@ test_that("generate plot with lm and loess option", {
100101

101102
test_that("generate plot with yintercept line", {
102103
expect_doppelganger("xy scatterplot yintercept", .generate_plot(dat, "quant1", "quant2", yintercept = TRUE))
103-
expect_doppelganger("xy boxplot yintercept", .generate_plot(dat, "cat1", "quant1", yintercept = TRUE))
104+
expect_doppelganger("xy boxplot yintercept", .generate_plot(dat, "cat1", "quant1", yintercept = TRUE))
104105
expect_doppelganger("xy flipped boxplot yintercept", .generate_plot(dat, "quant1", "cat1", yintercept = TRUE))
105106
})
106107

tests/testthat/test-mod-plot-server.R

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Test data for tests.
22
testdata <- tibble::tibble(
3+
sample.id = sprintf("samp%03d", 1:100),
34
quant1 = rnorm(100),
45
quant2 = rnorm(100),
56
cat1 = sample(letters[1:3], 100, replace = T),

0 commit comments

Comments
 (0)