Chapter 9 Strip charts:1-D scatter plots

Formula:

stripchart(x, data = NULL method = “overplot”, jitter = 0.1)

  • x: the data from which the plots are to be produced. Allowed values are one or a list of numeric vector, each corresponding to a component plot.
  • data: a data.frame (or list) from which the variables in x should be taken.
  • Method: the method to be used to separate coincident points. Allowed values are one of “overplot”, “jitter” or “stack”.
  • jitter: when method = “jitter” is used, jitter gives the amount of jittering applied.

Example-1:

# Plot len by dose
stripchart(len ~ dose, data = ToothGrowth,
         pch = 19, frame = FALSE,col="orange")

Example-2:

# Vertical plot using method = "jitter"
stripchart(len ~ dose, data = ToothGrowth,
         pch = 19, frame = FALSE, vertical = TRUE,
         method = "jitter",col="blue")

Example-3:

# Change point shapes (pch) and colors by groups
# add main title and axis labels
stripchart(len ~ dose, data = ToothGrowth,
         frame = FALSE, vertical = TRUE,
         method = "jitter", pch = c(21, 18, 16),
         col = c("#00BF32", "#E69F00", "#56B4E9"),
         main = "Length by dose", xlab = "Dose", ylab = "Length")