-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtest-plotPoint.R
More file actions
27 lines (26 loc) · 922 Bytes
/
Copy pathtest-plotPoint.R
File metadata and controls
27 lines (26 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
require(ggplot2, quietly=TRUE)
require(spatialdataR, quietly=TRUE)
x <- file.path("extdata", "blobs.zarr")
x <- system.file(x, package="spatialdataR")
x <- readSpatialData(x, tables=FALSE)
test_that("plotPoint(),SpatialData", {
p <- plotSpatialData()
y <- point(x, i <- "blobs_points")
df <- dplyr::collect(data(y))
# invalid
expect_error(plotPoint(x, "."))
expect_error(plotPoint(x, 100))
expect_error(show(ggplot() + plotPoint(x, i, color=".")))
# simple
q <- p + plotPoint(x, i)
expect_s3_class(q, "ggplot")
expect_identical(q$layers[[1]]$data, df)
expect_null(q$layers[[1]]$mapping$colour)
# coloring by color
q <- p + plotPoint(x, i, colour=. <- "red")
expect_identical(q$layers[[1]]$data, df)
expect_identical(q$layers[[1]]$aes_params$colour, .)
# coloring by value
q <- p + plotPoint(x, i, colour="genes")
expect_s3_class(q, "ggplot")
})