scatterplotDL: Plot a base-graphics scatterplot with accompanying density...

Description Usage Arguments Value Author(s) Examples

View source: R/densityLegend.R

Description

Plot a base-graphics scatterplot with accompanying density legend

Usage

1
2
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

1
2
3
4
5
6
7
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")

oaPlots documentation built on May 2, 2019, 6:46 a.m.