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 28 29 30 31 32 33 34 35 36 37 38
|
test_that("USA state map drawn", {
skip_if(packageVersion("base") < "3.5.0")
us_map <- map_data("usa")
p_us <- ggplot(us_map, aes(x = long, y = lat, group = group))
expect_doppelganger(
"USA mercator",
p_us +
geom_polygon(fill = NA, colour = "grey50") +
coord_map("mercator")
)
})
test_that("coord_map scale position can be switched", {
skip_if(packageVersion("base") < "3.5.0")
us_map <- map_data("usa")
p_us <- ggplot(us_map, aes(x = long, y = lat, group = group))
expect_doppelganger(
"coord_map switched scale position",
p_us +
geom_polygon(fill = NA, colour = "grey50") +
coord_map("mercator") +
scale_y_continuous(position = "right") +
scale_x_continuous(position = "top")
)
})
test_that("Inf is squished to range", {
skip_if(packageVersion("base") < "3.5.0")
d <- cdata(
ggplot(data_frame(x = 0, y = 0)) +
geom_point(aes(x,y)) +
annotate("text", -Inf, Inf, label = "Top-left") +
coord_map()
)
expect_equal(d[[2]]$x, 0)
expect_equal(d[[2]]$y, 1)
})
|