Description Usage Arguments Value Author(s) Examples
View source: R/densityLegend.R
Plot a base-graphics scatterplot with accompanying density legend
| 1 2 | scatterplotDL(x, y, colorVar, colorPalette, side = "right",
  proportion = 0.3, legendTitle = NULL, ...)
 | 
| 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() | 
none, plot is added to device
Jason Waddell
| 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")
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.