Points | R Documentation |
Number of cases in each location reflected in the point size
Points(x, y, pch=1, centers=FALSE, scale=1, cex.min=1, col=1, na.omit=TRUE, plot=TRUE, ...) PPoints(groups, x, y, cols=as.numeric(groups), pchs=as.numeric(groups), na.omit.all=TRUE, ...)
x, y |
Coordinates |
pch |
Point type |
pchs |
Types of point groups |
centers |
If TRUE, show centers of each location as a pixel-size dot (pch=".") |
cex.min |
Minimal point size |
col |
Color of points |
cols |
Color of point groups |
na.omit |
If TRUE (default), skip data points with NAs |
plot |
If FALSE, does not plot |
na.omit.all |
If TRUE (default), skip data points and corresponding factor values with NAs, then make 'na.omit' for internal Points() FALSE |
scale |
Scale factor for point size |
groups |
Factor defining groups |
... |
Points() passes other arguments to points(), PPoints() passes other arguments to Points() |
Frequently, more then one data point is located in one coordinate place (so called "overplotting"). How to show overplotting? One way is 'jitter()', these is also (really advanced) 'sunflowerplot()'. 'Points()' does it in its own way: number of cases in each point will be reflected in the point size. 'Points()' is a low-level graphic function, analogous to 'points()'.
'PPoints()' is the same as 'Points()' but for multiple subgroups.
To prettify plot, it is recommended to change 'scale' and optionally also 'cex.min'.
Alternative is the base R 'sunflowerplot()' but it is hard to read and there is no possibility to show multiple groups in data. Another alternative might be points with transparent color.
Invisibly returns vector of "multiplication indexes", in case of PPoints() it is group-wise so overplotting between groups does not count. Please keep in mind that these indexes only indicate how many times the point is overplotted, but do not show groups of duplicates. Use Alldups() for groups.
Alexey Shipunov
jitter
, sunflowerplot
## colors modified via palette() plot(iris[, 1:2], type="n") palette(rainbow(3)) PPoints(iris[, 5], iris[, 1], iris[, 2], pchs=0, scale=0.7) palette("default") ## now with centers, colors default, pch by group, and one NA iris[1, 1] <- NA plot(iris[, 1:2], type="n") PPoints(iris[, 5], iris[, 1], iris[, 2], scale=0.7, centers=TRUE) data(iris) ## to restore default embedded object
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.