Interactively plotting the EAF difference
Source:R/interactive_eafdiff_plot.R
interactiveeafdiffplot.Rd
Interactively plotting the EAF difference
Usage
interactiveeafdiffplot(
data_left,
data_right,
intervals = 5L,
maximise = FALSE,
grand.lines = TRUE,
col = c("white", "#808080", "black"),
type = "point",
full.eaf = FALSE,
lty = "solid",
psize = 0.1,
pshape = 16,
legend.pos = "topright",
xlabel = NULL,
ylabel = NULL,
sci.notation = FALSE,
plot = "plotly",
title_left = "Data 1",
title_right = "Data 2"
)
Arguments
- data_left, data_right
Data frames corresponding to the input data of left and right sides, respectively. Each data frame has at least three columns, the third one being the set of each point. See also
read_datasets()
.- intervals
(integer(1)|character())
- The absolute range of the differences[0, 1]
is partitioned into the number of intervals provided. If an integer is provided, then labels for each interval are computed automatically. If a character vector is provided, its length is taken as the number of intervals.- maximise
(logical() | logical(1))
- Whether the objectives must be maximised instead of minimised. Either a single logical value that applies to all objectives or a vector of logical values, with one value per objective.- grand.lines
Whether to plot the grand-best and grand-worst attainment surfaces.
- col
A character vector of colors for the magnitude of the differences. Intermediate colors are computed automatically given the value of
intervals
. Alternatively, a function such asviridisLite::viridis()
that generates a colormap given an integer argument.- type
Whether the EAF differences are plotted as points
'point'
or whether to color the areas that have at least a certain value'area'
.- full.eaf
Whether to plot the EAF of each side instead of the differences between the EAFs.
- lty
Line type. See
plot.default()
.- psize
Size of plotted point
- pshape
Shape of plotted point. See
plot.default()
.- legend.pos
The position of the legend, valid values are
'topright'
,'top'
,'topleft'
,'right'
,'left'
,'bottom'
,'bottomright'
,'bottomleft'
and'center'
. A value of'none'
hides the legend.- xlabel, ylabel
Axes labels.
- sci.notation
Generate scientific labels
- plot
Interactive or none interactive plot. Valid values are
'plotly'
and'ggplot'
.- title_left, title_right
Title for left and right plots, respectively.
Examples
# The plots in the website look squashed because of how pkgdown
# generates them. They should look fine when you generate them yourself
# in a full-sized html window.
options("warn"=-1)
library(interactiveeafplots)
extdata_dir <- system.file(package="interactiveeafplots", "extdata")
A1 <- moocore::read_datasets(file.path(extdata_dir, "ALG_1_dat.xz"))
A2 <- moocore::read_datasets(file.path(extdata_dir, "ALG_2_dat.xz"))
interactiveeafdiffplot(data_left=A1, data_right=A2, maximise = FALSE,
type = "area", legend.pos = "topright",psize = 1,
xlabel = "Objective 1", ylabel = "Objective 2",
title_left="Plot 1", title_right="Plot 2",
sci.notation = TRUE, grand.lines=TRUE, plot = "plotly",
full.eaf=TRUE,intervals = 5,
col = c("red","orange","yellow"))
#> Scale for y is already present.
#> Adding another scale for y, which will replace the existing scale.
#> Scale for y is already present.
#> Adding another scale for y, which will replace the existing scale.
if (requireNamespace("viridisLite", quietly=TRUE)) {
viridis_r <- function(n) viridisLite::viridis(n, direction=-1)
interactiveeafdiffplot(data_left=A1, data_right=A2, maximise = c(FALSE,TRUE),
type = "area", legend.pos = "bottomright",psize = 1,
xlabel = "Objective 1", ylabel = "Objective 2",
title_left="Plot 1", title_right="Plot 2",
sci.notation = TRUE, grand.lines=TRUE, plot = "plotly",
full.eaf=FALSE,intervals = 5,col = viridis_r(5))
}
#> Scale for y is already present.
#> Adding another scale for y, which will replace the existing scale.
#> Scale for y is already present.
#> Adding another scale for y, which will replace the existing scale.