Skip to content

Commit 4cf8ad2

Browse files
committed
r/R/symdevplot.R: Rename functions following moocore.
r/DESCRIPTION: Requires moocore >= 0.1.5.
1 parent 670564f commit 4cf8ad2

File tree

5 files changed

+31
-28
lines changed

5 files changed

+31
-28
lines changed

r/DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Imports:
1616
grDevices,
1717
graphics,
1818
matrixStats,
19-
moocore
19+
moocore (>= 0.1.5)
2020
Suggests:
2121
extrafont,
2222
viridisLite,

r/NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# mooplot 0.1.1
22

3+
* Requires `moocore >= 0.1.5` because `moocore` renamed `vorobT()` and
4+
`vorobDev()` to `moocore::vorob_t()` and `moocore::vorob_dev()` to be consistent with other
5+
function names.
36
* Fix bug in `eafdiffplot` where colors were plotted in the wrong order.
47

58
# mooplot 0.1.0

r/R/symdevplot.R

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
#' the objective space to belong to the symmetric difference between the
55
#' Vorob'ev expectation and a realization of the (random) attained set.
66
#'
7-
#' @inheritParams moocore::vorobT
7+
#' @inheritParams moocore::vorob_t
88
#'
9-
#' @param VE,threshold Vorob'ev expectation and threshold, e.g., as returned
10-
#' by [moocore::vorobT()].
9+
#' @param ve,threshold Vorob'ev expectation and threshold, e.g., as returned
10+
#' by [moocore::vorob_t()].
1111
#'
1212
#' @param nlevels (`integer(1)`)\cr Number of levels in which is divided the range of the
1313
#' symmetric deviation.
@@ -27,11 +27,11 @@
2727
#'
2828
#' @author Mickael Binois
2929
#'
30-
#' @seealso [moocore::vorobT()] [moocore::vorobDev()] [eafplot()]
30+
#' @seealso [moocore::vorob_t()] [moocore::vorob_dev()] [eafplot()]
3131
#'
3232
#' @examples
3333
#' data(CPFs, package = "moocore")
34-
#' res <- moocore::vorobT(CPFs, reference = c(2, 200))
34+
#' res <- moocore::vorob_t(CPFs, reference = c(2, 200))
3535
#' print(res$threshold)
3636
#'
3737
#' ## Display Vorob'ev expectation and attainment function
@@ -43,19 +43,19 @@
4343
#' # Second style
4444
#' eafplot(CPFs[,1:2], sets = CPFs[,3], percentiles = c(0, 20, 40, 60, 80, 100),
4545
#' col = gray(seq(0.8, 0.1, length.out = 6)^0.5), type = "area",
46-
#' legend.pos = "bottomleft", extra.points = res$VE, extra.col = "cyan",
46+
#' legend.pos = "bottomleft", extra.points = res$ve, extra.col = "cyan",
4747
#' extra.legend = "VE", extra.lty = "solid", extra.pch = NA, extra.lwd = 2,
4848
#' main = substitute(paste("Empirical attainment function, ",beta,"* = ", a, "%"),
4949
#' list(a = formatC(res$threshold, digits = 2, format = "f"))))
5050
#' # Vorob'ev deviation
51-
#' VD <- moocore::vorobDev(CPFs, reference = c(2, 200), VE = res$VE)
51+
#' VD <- moocore::vorob_dev(CPFs, reference = c(2, 200), ve = res$ve)
5252
#' # Display the symmetric deviation function.
53-
#' symdevplot(CPFs, VE = res$VE, threshold = res$threshold, nlevels = 11)
53+
#' symdevplot(CPFs, ve = res$ve, threshold = res$threshold, nlevels = 11)
5454
#' # Levels are adjusted automatically if too large.
55-
#' symdevplot(CPFs, VE = res$VE, threshold = res$threshold, nlevels = 200, legend.pos = "none")
55+
#' symdevplot(CPFs, ve = res$ve, threshold = res$threshold, nlevels = 200, legend.pos = "none")
5656
#'
5757
#' # Use a different palette.
58-
#' symdevplot(CPFs, VE = res$VE, threshold = res$threshold, nlevels = 11, col.fun = heat.colors)
58+
#' symdevplot(CPFs, ve = res$ve, threshold = res$threshold, nlevels = 11, col.fun = heat.colors)
5959
#'
6060
#' @references
6161
#'
@@ -72,7 +72,7 @@
7272
# surfaces and does not create the plot nor the legend (but returns the info
7373
# needed to create a legend), so that one can use the function to add stuff to
7474
# another plot.
75-
symdevplot <- function(x, sets, VE, threshold, nlevels = 11,
75+
symdevplot <- function(x, sets, ve, threshold, nlevels = 11,
7676
ve.col = "blue", xlim = NULL, ylim = NULL,
7777
legend.pos = "topright", main = "Symmetric deviation function",
7878
col.fun = function(n) gray(seq(0, 0.9, length.out = n)^2))
@@ -137,7 +137,7 @@ symdevplot <- function(x, sets, VE, threshold, nlevels = 11,
137137
plot_eaf_axis (xaxis_side, xlab, las = las, sci.notation = sci.notation)
138138
plot_eaf_axis (yaxis_side, ylab, las = las, sci.notation = sci.notation,
139139
line = 2.2)
140-
plot_eaf_full_lines(list(VE), extreme, maximise,
140+
plot_eaf_full_lines(list(ve), extreme, maximise,
141141
col = ve.col, lty = 1, lwd = 2)
142142
})
143143

r/man/symdevplot.Rd

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

r/tests/testthat/test-symdevplot.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
test_that("symdevplot", {
22
skip_on_cran()
33
data(CPFs, package="moocore")
4-
res <- vorobT(CPFs, reference = c(2, 200))
5-
VD <- vorobDev(CPFs, VE = res$VE, reference = c(2, 200))
4+
res <- vorob_t(CPFs, reference = c(2, 200))
5+
VD <- vorob_dev(CPFs, ve = res$ve, reference = c(2, 200))
66
expect_snapshot_plot("symdevplot-CPFs-nlevels11", {
7-
symdevplot(CPFs, VE = res$VE, threshold = res$threshold, nlevels = 11)
7+
symdevplot(CPFs, ve = res$ve, threshold = res$threshold, nlevels = 11)
88
})
99
expect_snapshot_plot("symdevplot-CPFs-nlevels200", {
10-
symdevplot(CPFs, VE = res$VE, threshold = res$threshold, nlevels = 200, legend.pos = "none")
10+
symdevplot(CPFs, ve = res$ve, threshold = res$threshold, nlevels = 200, legend.pos = "none")
1111
})
1212
expect_snapshot_plot("symdevplot-CPFs-heatcolors", {
13-
symdevplot(CPFs, VE = res$VE, threshold = res$threshold, nlevels = 11, col.fun = heat.colors)
13+
symdevplot(CPFs, ve = res$ve, threshold = res$threshold, nlevels = 11, col.fun = heat.colors)
1414
})
1515
})

0 commit comments

Comments
 (0)