addGGContour: Add Contour Lines to Gradient Field Heatmap.

Description Usage Arguments Value Examples

View source: R/addGGContour.R

Description

Add contour lines of the separate objectives to the heatmap of the cumulated path lengths.

Usage

1
2
3
addGGContour(g, lower, upper, fn1, fn2, fn3, log.scale = TRUE,
  col1 = "goldenrod1", col2 = "white", col3 = "cyan3",
  n.points = 30L, ...)

Arguments

g

[ggplot]
ggplot-object as created by ggplotHeatmap.

lower

[numeric(d)]
Vector of lower bounds.

upper

[numeric(d)]
Vector of upper bounds.

fn1

[function]
The first objective used for computing the multi-objective gradient.

fn2

[function]
The second objective used for computing the multi-objective gradient.

fn3

[function]
The third objective (if existing) used for computing the multi-objective gradient.

log.scale

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

col1

[character(1L)]
Color used for the contour lines of the first objective (default: "goldenrod1").

col2

[character(1L)]
Color used for the contour lines of the second objective (default: "white").

col3

[character(1L)]
Color used for the contour lines of the third objective (default: "cyan3").

n.points

[integer(1L)]
Number of points used for computing the contour lines. The default is 30L.

...

[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
# 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.005), x2 = seq(0, 1.25, 0.005)))

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

# Visualize the resulting multi-objective "landscape":
g = ggplotHeatmap(x)
g

# Add dashed contour lines to the plot:
addGGContour(g = g, lower = c(0, 0), upper = c(0.7, 1.25),
  fn1 = fn1, fn2 = fn2, linetype = "dashed")

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