dotPlot | R Documentation |
Plot observations as dots.
dotPlot(
x,
fact = NULL,
vertical = FALSE,
at = 1,
key = NULL,
pch = 20,
col = fadeColor("black", "66"),
cex = 1.5,
add = FALSE,
axes = TRUE,
xlim = NULL,
ylim = NULL,
...
)
x |
A numerical vector. |
fact |
A character or factor vector defining the grouping for data in
|
vertical |
If |
at |
The vertical coordinate of the points, or the horizontal
coordinate if |
key |
The factor levels corresponding to |
pch |
Plotting character. If |
col |
Plotting character color. If |
cex |
Plotting character size. If |
add |
If |
axes |
If |
xlim |
Limits for the x axis. |
ylim |
Limits for the y axis. |
... |
Additional arguments to be passed to |
David Diez
histPlot
, densityPlot
,
boxPlot
library(dplyr)
# Price by type
dotPlot(cars93$price,
cars93$type,
key = c("large", "midsize", "small"),
cex = 1:3
)
# Hours worked by educational attainment or degree
gss2010_nona <- gss2010 |>
filter(!is.na(hrs1) & !is.na(degree))
dotPlot(gss2010_nona$hrs1,
gss2010_nona$degree,
col = fadeColor("black", "11")
)
# levels reordered
dotPlot(gss2010_nona$hrs1,
gss2010_nona$degree,
col = fadeColor("black", "11"),
key = c("LT HIGH SCHOOL", "HIGH SCHOOL", "BACHELOR", "JUNIOR COLLEGE", "GRADUATE")
)
# with boxPlot() overlaid
dotPlot(mariokart$total_pr,
mariokart$cond,
ylim = c(0.5, 2.5), xlim = c(25, 80), cex = 1
)
boxPlot(mariokart$total_pr,
mariokart$cond,
add = 1:2 + 0.1,
key = c("new", "used"), horiz = TRUE, axes = FALSE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.