-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I also tried to remove the definition of titleGrob() because of the conflict with ggplot2 but it does not seem to be exported by ggplot2.
- Loading branch information
Showing
6 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ Package: ggpp | |
Type: Package | ||
Title: Grammar Extensions to 'ggplot2' | ||
Version: 0.5.6.9001 | ||
Date: 2024-03-04 | ||
Date: 2024-04-18 | ||
Authors@R: | ||
c( | ||
person("Pedro J.", "Aphalo", email = "[email protected]", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-3385-972X")), | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
context("compute_npc") | ||
|
||
test_that("character input value returns correct numeric value", { | ||
expect_equal(compute_npc("right"), 0.95) | ||
expect_equal(compute_npc("left"), 0.05) | ||
expect_equal(compute_npc(c("left", "right")), c(0.05, 0.95)) | ||
expect_equal(compute_npc("centre"), 0.5) | ||
expect_equal(compute_npc("center"), 0.5) | ||
expect_equal(compute_npc("middle"), 0.5) | ||
expect_equal(compute_npc("bottom"), 0.05) | ||
expect_equal(compute_npc("top"), 0.95) | ||
}) | ||
|
||
test_that("factor input values returns correct numeric value", { | ||
x <- factor(c("right", "left")) | ||
expect_equal(compute_npc(x), c(0.95, 0.05)) | ||
|
||
}) | ||
|
||
test_that("numeric input value returns the same value if | ||
between 0 and 1", { | ||
x <- c(0.5, 1) | ||
expect_equal(compute_npc(x), x) | ||
}) | ||
|
||
test_that("numeric input value | ||
returns 0 if less than 0, | ||
returns 1 if greater than 1", { | ||
x <- c(-0.5, 2) | ||
expect_equal(compute_npc(x), c(0,1)) | ||
}) | ||
|
||
test_that("Value is returned 'AsIs'", { | ||
expect_is(as_npc("right"), "AsIs") | ||
expect_equal(as_npc("right"), I(0.95)) | ||
expect_equal(as_npc("left"), I(0.05)) | ||
expect_equal(as_npc("centre"), I(0.5)) | ||
expect_equal(as_npc("center"), I(0.5)) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters