scatterplotDL {oaPlots}R Documentation

Plot a base-graphics scatterplot with accompanying density legend

Description

Plot a base-graphics scatterplot with accompanying density legend

Usage

scatterplotDL(x, y, colorVar, colorPalette, side = "right",
  proportion = 0.3, legendTitle = NULL, ...)

Arguments

x

the x coordinates to be handed to plot()

y

the y coordinates of points in the plot()

colorVar

the numeric vector of values used to color the points

colorPalette

a color palette. If 'colorPalette' contains, for example, 6 colors, then the values of colorVar will be split and assigned to these 6 colors

side

the side of the plot to put the density legend on ("left", "right", "top", or "bottom")

proportion

the proportion of the plot (from 0 to 1) to allocate to the density legend (defaults to 0.3)

legendTitle

string for labelling the density legend

...

additional parameters to be passed to plot()

Value

none, plot is added to device

Author(s)

Jason Waddell

Examples

library(ggplot2)
library(RColorBrewer)
colorPalette <- brewer.pal(9, "YlOrRd")[4:9]
scatterplotDL(x = mtcars$mpg, y = mtcars$wt, colorVar = mtcars$hp,
legendTitle = "Horse Power", colorPalette = colorPalette, pch = 19,
		xlab = "MPG (miles per gallon)", ylab = "Weight (tonnes)",
		main = "MPG by Weight in Cars \n Colored by Horse Power")

[Package oaPlots version 0.0.25 Index]