Skip to content

Commit 17cfd10

Browse files
committed
Fix bug in eafdiffplot where colors were plotted in the wrong order.
1 parent 5c836f8 commit 17cfd10

20 files changed

+28
-18
lines changed

r/DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: mooplot
22
Type: Package
33
Title: Graphical Visualizations for Multi-Objective Optimization
4-
Version: 0.1.0
4+
Version: 0.1.1
55
Authors@R: c(person("Manuel", "López-Ibáñez", role = c("aut", "cre"),
66
email = "manuel.lopez-ibanez@manchester.ac.uk",
77
comment = c(ORCID = "0000-0001-9974-1295")),

r/NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# mooplot 0.1.1
2+
3+
* Fix bug in `eafdiffplot` where colors were plotted in the wrong order.
4+
15
# mooplot 0.1.0
26

37
* Initial version uploaded to CRAN.

r/R/eafdiffplot.R

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,6 @@ eafdiffplot <-
189189
data_right <- transform_maximise(data_right, maximise)
190190
}
191191

192-
compute_attsurfs <- function(x, cumsizes, percentiles, maximise) {
193-
x <- compute_eaf_call(x, cumsizes = cumsizes, percentiles = percentiles)
194-
if (any(maximise))
195-
x[,-ncol(x)] <- transform_maximise(x[, -ncol(x), drop=FALSE], maximise)
196-
eaf_as_list(x)
197-
}
198-
199192
attsurfs_left <- attsurfs_right <- list()
200193
if (!any(is.na(percentiles))) {
201194
attsurfs_left <- compute_attsurfs(data_left, cumsizes_left, percentiles = percentiles, maximise = maximise)
@@ -262,7 +255,7 @@ eafdiffplot <-
262255

263256
# FIXME: This does not generate empty space between the two plots, but the
264257
# plots are not squared.
265-
layout(matrix(1:2, ncol=2L, byrow=TRUE), respect=TRUE)
258+
layout(matrix(c(1L,2L), ncol=2L, byrow=TRUE), respect=TRUE)
266259
bottommar <- 5L
267260
topmar <- 4L
268261
leftmar <- 4L
@@ -364,7 +357,7 @@ plot_eafdiff_side <- function (eafdiff, attsurfs = list(),
364357
# Colors are correct for !full.eaf && type == "area"
365358
if (full.eaf || type == "point") {
366359
diff_values <- eafdiff[,3L]
367-
eafdiff <- eafdiff[, 1L:2L, drop=FALSE]
360+
eafdiff <- eafdiff[, c(1L,2L), drop=FALSE]
368361
# FIXME: This is wrong, we should color (0.0, 1] with col[1], then (1, 2]
369362
# with col[1], etc, so that we never color the value 0.0 but we always
370363
# color the maximum value color without having to force it.
@@ -406,6 +399,7 @@ plot_eafdiff_side <- function (eafdiff, attsurfs = list(),
406399
## The maximum value should also be painted.
407400
diff_values[diff_values > length(col)] <- length(col)
408401
eafdiff <- eafdiff[order(diff_values, decreasing = FALSE), , drop=FALSE]
402+
diff_values <- diff_values[order(diff_values, decreasing = FALSE)]
409403
points(eafdiff[,1L], eafdiff[,2L], col = col[diff_values], type = "p", pch=20)
410404
}
411405
}
@@ -419,3 +413,11 @@ plot_eafdiff_side <- function (eafdiff, attsurfs = list(),
419413
mtext(title, 1, line = 3.5, cex = par("cex.lab"), las = 0, font = 2)
420414
box()
421415
}
416+
417+
compute_attsurfs <- function(x, cumsizes, percentiles, maximise)
418+
{
419+
x <- compute_eaf_call(x, cumsizes = cumsizes, percentiles = percentiles)
420+
if (any(maximise))
421+
x[,-ncol(x)] <- transform_maximise(x[, -ncol(x), drop=FALSE], maximise)
422+
eaf_as_list(x)
423+
}
761 Bytes
Loading
434 Bytes
Loading
-5.53 KB
Loading
221 Bytes
Loading
-3.29 KB
Loading
57.3 KB
Loading
43.6 KB
Loading

0 commit comments

Comments
 (0)