color_contour: Creates a contour plot with colored background.

Description Usage Arguments Author(s) See Also Examples

View source: R/plot.R

Description

This function is a wrapper around image and contour. See vignette('plotfunctions') for an example of how you could use image and contour.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
color_contour(
  x = seq(0, 1, length.out = nrow(z)),
  y = seq(0, 1, length.out = ncol(z)),
  z,
  main = NULL,
  xlab = NULL,
  ylab = NULL,
  xlim = NULL,
  ylim = NULL,
  zlim = NULL,
  col = NULL,
  color = topo.colors(50),
  nCol = 50,
  add.color.legend = TRUE,
  ...
)

Arguments

x

Locations of grid lines at which the values in z are measured. These must be in ascending order. By default, equally spaced values from 0 to 1 are used. If x is a list, its components x$x and x$y are used for x and y, respectively. If the list has component z this is used for z.

y

Locations of grid lines at which the values in z are measured.

z

a matrix containing the values to be plotted (NAs are allowed). Note that x can be used instead of z for convenience.

main

Text string, an overall title for the plot.

xlab

Label for x axis. Default is name of first view variable.

ylab

Label for y axis. Default is name of second view variable.

xlim

x-limits for the plot.

ylim

y-limits for the plot.

zlim

z-limits for the plot.

col

Color for the contour lines and labels.

color

a list of colors such as that generated by rainbow, heat.colors colors, topo.colors, terrain.colors or similar functions.

nCol

The number of colors to use in color schemes.

add.color.legend

Logical: whether or not to add a color legend. Default is TRUE. If FALSE (omitted), one could use the function gradientLegend to add a legend manually at any position.

...

Optional parameters for image and contour.

Author(s)

Jacolien van Rij

See Also

image, contour, filled.contour. See plotsurface for plotting model predictions using color_contour.

plotsurface

Other Functions for plotting: addInterval(), add_bars(), add_n_points(), alphaPalette(), alpha(), check_normaldist(), dotplot_error(), drawDevArrows(), emptyPlot(), errorBars(), fill_area(), getCoords(), getFigCoords(), getProps(), gradientLegend(), legend_margin(), marginDensityPlot(), plot_error(), plot_image(), plotsurface(), sortBoxplot()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# Volcano example of R (package datasets)
color_contour(z=volcano)
# change color and lines:
color_contour(z=volcano, color='terrain', col=alpha(1), lwd=2, lty=5)
# change x-axis values and zlim:
color_contour(x=seq(500,700, length=nrow(volcano)),
    z=volcano, color='terrain', col=alpha(1), lwd=2, zlim=c(0,200))

# compare with similar functions:
filled.contour(volcano, color.palette=terrain.colors)

# without contour lines:
color_contour(z=volcano, color='terrain', lwd=0, drawlabels=FALSE)
# without background:
color_contour(z=volcano, color=NULL, add.color.legend=FALSE)

plotfunctions documentation built on April 28, 2020, 5:10 p.m.