ggplotObjectiveSpace: Visualize Multi-Objective Gradient Landscape in the Objective...

Description Usage Arguments Value Examples

View source: R/ggplotObjectiveSpace.R

Description

Use the coloring of the cumulated path lengths (see computeCumulatedPathLengths) and visualize the corresponding points in the objective space.

Usage

1
2
3
ggplotObjectiveSpace(df, var1 = "y1", var2 = "y2", log.scale = TRUE,
  impute.zero = TRUE, minimalistic.image = FALSE, color.palette,
  legend.position, ...)

Arguments

df

[data.frame]
Data frame containing the positions of the individuals (per row) and their corresponding cumulated path length (denoted: "height") as returned by computeCumulatedPathLengths.

var1

[character(1L)]
Name of the variable indicating the first objective (default: "y1").

var2

[character(1L)]
Name of the variable indicating the second objective (default: "y2").

log.scale

[logical(1L)]
Should the resulting heights be displayed on a log-scale? The default is TRUE.

impute.zero

[logical(1L)]
Should height values, which are exactly zero be imputed by a value half the magnitude of the smallest non-zero height? Otherwise ggplot will automatically color the corresponding tiles by a color representing NA values (usually grey). Note that this parameter is only relevant in case of log.scale = TRUE. The default is TRUE.

minimalistic.image

[logical(1L)]
Should all information surrounding the image (axes, legends, background, etc.) be discarded? The default is FALSE.

color.palette

[character]
Vector of colors used for visualizing the different heights of the landscape. By default, this function tries to use the color palettes from fields::tim.color or viridis. However, if neither of these packages is installed, it will use terrain.colors.

legend.position

[character(1L)]
On which side of the plot, should the legend be located? If this information is not provided and minimalisitic.image = FALSE, the legend will be placed on the right side.

...

[any]
Further arguments to be passed to the geom_tile function of ggplot.

Value

[ggplot]
A ggplot object displaying the multi-objective gradient landscape.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# Define two single-objective test problems and a grid of points:
fn1 = function(x) sum((x - c(0.2, 1))^2)
fn2 = function(x) sum((x - c(0.5, 0.5))^2)
points = as.matrix(expand.grid(x1 = seq(0, 0.7, 0.01), x2 = seq(0, 1.25, 0.01)))

# Compute the corresponding gradients and the cumulated path lengths:
gradients = computeGradientField(points, fn1, fn2)
x = computeCumulatedPathLengths(points, gradients)

# Next, compute the image of the grid points in the objective space:
obj.space = apply(points, 1, function(x) c(y1 = fn1(x), y2 = fn2(x)))
obj.space = as.data.frame(t(obj.space))

# Append the cumulated path lengths:
obj.space$height = x$height

# Finally, visualize the resulting objective space:
ggplotObjectiveSpace(obj.space)

kerschke/mogsa documentation built on July 11, 2019, 11:52 p.m.