View source: R/np_plotting_functions.R
drawPoints | R Documentation |
takes a data frame of locations, values and an optional subgrouping factor and adds the data points to the active plot
drawPoints(
x,
type = "jitter",
col = "black",
size = 1,
shape = 1,
highlight = FALSE,
width = 0.2,
sidePlot = FALSE,
swarmOverflow = "random",
calcOnly = FALSE
)
x |
named list or data frame; |
type |
character; determines how the points are arranged. Options are 'jitter', 'linear', 'beeswarm' and 'distribution'. |
col |
character; vector of color names for plotting points. If length is greater than one it will be used for subgroups or will iterate over the groups. |
size |
numeric; vector of cex values for point size. If length is greater than one it will be used for subgroups or will iterate over the groups. |
shape |
numeric; vector determining point shapes (pch). If length is greater than one it will be used for subgroups or will iterate over the groups. |
highlight |
logical; Should the point highlighting option be turned on (assumes that pfact is defined). |
width |
numeric; determines how far points can deviate from the center category label for |
sidePlot |
logical; plots dots for a horizontal rather than vertical axis. |
swarmOverflow |
character; How to handle beeswarms that would normally overflow the |
calcOnly |
logical; Will return just xy plotting data but will plot nothing if set to |
This function adds data points to a chart. These can be organized exactly as specified (linear), as a jitter cloud (jitter), as a waterfall plot (distribution) or as a swarm (beeswarm).
A factor labeled pfact can be included in x
and used to highlight individual data points by setting subgroup=TRUE
. All graphic customization options can given as vectors and will be iterated over during plotting.
Note that the size/cex option can not be used to highlight pfact levels in a beeswarm plot and only the first element of the vector will be used.
The function silently returns the final xy positions.
points
, stripchart
, beeswarm
data(iris)
boxplot(iris$Sepal.Length~iris$Species,ylab="Sepal Length")
iData<-data.frame(at=as.numeric(iris$Species),data=iris$Sepal.Length)
drawPoints(iData,type="jitter",col=c("red","blue","purple"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.