Skip to main content
v2026.11,986 entries · CC-BY 4.0

Stripchart in R: How to Use stripchart() with Jitter and Stack

How to draw a stripchart in R with stripchart(): grouping, vertical strips, jitter vs stack, and the ggplot2 geom_jitter equivalent.

Written and maintained by CASRAI Editorial Board

Published · Last updated

On this page

A stripchart in R is drawn with the stripchart() function, which plots every observation as a point along a single axis, one strip per group. The R manual describes these as one-dimensional scatter plots (dot plots), and notes that these plots are a good alternative to boxplots when sample sizes are small. The main decision is how to handle points that share the same value: method = "overplot", "jitter" or "stack".

What a stripchart is used for in research

A stripchart shows the raw data rather than a summary. Each value is one point, so a reader can see group sizes, gaps and outliers directly. That is why the R manual points to it as an alternative to boxplots for small samples: a box and whiskers built from a handful of observations hides how few observations there are. For the boxplot side of the comparison, see the CASRAI guide to box plots in R; for two numeric variables, see scatterplots in R.

Install or access

stripchart() is documented in the graphics package of the R manual. Once R is running, ?stripchart opens its help page. The ggplot2 alternative in the table below is a separate package; the ggplot2 home page gives these install commands:

install.packages("ggplot2")
# or the whole collection
install.packages("tidyverse")

Step-by-step: drawing a stripchart

The default method has this usage in the R manual:

stripchart(x, method = "overplot", jitter = 0.1, offset = 1/3,
           vertical = FALSE, group.names, add = FALSE, at = NULL,
           xlim = NULL, ylim = NULL, ylab = NULL, xlab = NULL,
           dlab = "", glab = "", log = "", pch = 0,
           col = par("fg"), cex = par("cex"), axes = TRUE,
           frame.plot = axes, ...)
  1. Pass the data. x can be a numeric vector or a list of numeric vectors, one strip per list element. With a single vector you get one strip: stripchart(x).
  2. Group with a formula. A formula y ~ g groups the numeric variable y by the factor g. This example is adapted from the manual: stripchart(decrease ~ treatment, data = OrchardSprays), where OrchardSprays is one of R’s built-in datasets. (Data frames are covered in data frames in R.)
  3. Choose the orientation. The default is vertical = FALSE, so values run along the horizontal axis. Set vertical = TRUE to draw vertical strips. The manual’s own example is stripchart(decrease ~ treatment, main = "stripchart(OrchardSprays)", vertical = TRUE, log = "y", data = OrchardSprays), which also puts the data axis on a log scale.
  4. Separate tied points. Add method = "jitter" or method = "stack" (see the next section).
  5. Label the axes. Use xlab and ylab, or dlab and glab for the data axis and group axis. The manual says dlab and glab are used when xlab or ylab are not given.
  6. Add to an existing plot if needed. add = TRUE draws on the current plot, and at sets where the strip goes; it defaults to 1:n for n groups. The manual’s example adds a stacked strip at position 1.2: x <- rnorm(50); xr <- round(x, 1); stripchart(xr, method = "stack", add = TRUE, at = 1.2).

Which method for tied values: overplot, jitter or stack

The method decides what happens when several observations have the same or nearly the same value. The manual lists three:

Method What it does Setting and default Note from the manual
"overplot" Draws points on top of each other Default method Coincident points overlap
"jitter" Adds random displacement so coincident points separate jitter = 0.1 Separates coincident points
"stack" Stacks coincident points into a pile offset = 1/3, the spacing between stacked points in line heights The manual says stacking only makes sense for very granular data

“Very granular data” means values with many repeats, such as measurements rounded to one decimal. That is why the manual’s stacking example rounds the random normal values with round(x, 1) before stacking. On continuous values with no ties, stacking has nothing to pile up.

Make jittered stripcharts reproducible

Jitter is random displacement, so two runs of stripchart(x, method = "jitter") place the points slightly differently. The usage shown above has no seed argument, so the practical way to get the same picture every time is to set R’s random seed immediately before the call (editorial practice, not a stripchart option):

set.seed(42)
stripchart(decrease ~ treatment, data = OrchardSprays, method = "jitter", vertical = TRUE)

ggplot2 handles this inside the position object. The position_jitter() reference documents a seed argument described as a random seed to make the jitter reproducible; the default NA initialises it with a random value, and NULL uses the current seed. In a figure for a paper or a registered analysis, fix the seed so a reviewer who reruns the script sees the same layout. Because the displacement carries no information, the seed changes only where points sit across the strip, never their values on the data axis.

How the jitter amount is chosen

Two different things are called jitter in R. The jitter argument of stripchart() is a single number, 0.1 by default, used when method = "jitter". The separate base function jitter() adds noise to a numeric vector and has the usage jitter(x, factor = 1, amount = NULL). The R manual states the result as x + amount * runif(n, -1, 1), that is, each value moves by a random number between minus and plus amount.

When amount is NULL, the manual sets it to factor * d / 5, where d is about the smallest gap between unique values. A worked case: if your values are whole numbers, the smallest gap is 1, so with the default factor = 1 the amount is 1/5 = 0.2 and every value moves by somewhere between -0.2 and +0.2. If amount is 0, the manual uses factor * (max - min) / 50 instead; for values spanning 0 to 100 that is 1 * 100 / 50 = 2.

The practical difference: stripchart(method = "jitter") displaces points across the strip (the group axis) and leaves the data axis untouched, while jitter() changes the numbers themselves if you pass it a data vector. Do not jitter a variable you then analyse. The data table below compares how stripchart(), jitter(), geom_jitter() and position_jitter() expose the amount, the defaults and the seed.

Plotting several groups

There are two routes to one strip per group. Pass a list of numeric vectors, which gives one strip per list element, or use a formula. The formula route is the one used in most tutorials; a widely cited example uses the built-in iris data: stripchart(Sepal.Length ~ Species, data = iris, method = "jitter", vertical = TRUE). Because iris ships with R, the example runs without any download. Use group.names to set the labels under each strip when you pass a list, and at to space strips unevenly; the manual’s own example uses at = (1:8)^2 to place eight strips at squared positions.

To overlay a summary on a stripchart, draw the strips first and then add to the same plot with points(), or draw a second stripchart with add = TRUE, as the manual’s stacked example does.

Styling arguments

Argument Effect Default in the usage above
pch Plotting symbol for the points 0
col Colour of the points par("fg")
cex Point size par("cex")
xlim, ylim Axis limits NULL
log Log scale for an axis, for example log = "y" with vertical = TRUE as in the manual’s example empty string
main Plot title, passed on to the plotting call none

Choose a symbol that stays legible when points overlap slightly; hollow symbols make tied points easier to count than filled ones. Keep colours consistent with the groups you plot elsewhere in the same paper.

Missing values and subsets

The manual states that missing values (NA) are allowed in the data. For the formula method, the default na.action ignores missing values in the response or the grouping variable, so incomplete rows are dropped from the plot rather than causing an error. The formula method also accepts a subset argument to restrict the rows drawn, for example subset = treatment != "A". Because dropped rows are silent, report the number of observations per group in the figure legend or text; the count of points you can see is not always the count you collected.

Common mistakes

  • Treating jitter as data. Displacement across the strip means nothing; only the position on the data axis counts.
  • Stacking continuous values. With few ties, method = "stack" has nothing to pile up; round the data or use jitter.
  • Forgetting the seed. An unseeded jittered figure differs on each run, which makes figure diffs and reproducibility checks noisy.
  • Too much jitter in ggplot2. The reference warns that categorical data are aligned on integers, so a width of 0.5 makes categories indistinguishable. A narrower width such as 0.25 keeps categories visibly separate.
  • Using overplot with tied values and reading the point count as group size. Tied points hide each other.

Output and how to read it

  • Every point is one observation. A stripchart does not draw medians, quartiles or means. What you see is the raw data, so the number of points per strip is the group size (with overplot, tied values hide each other, so count with jitter or stack).
  • Read position along the data axis only. The data axis is horizontal by default (X) and vertical when vertical = TRUE. Jitter exists to separate coincident points, so the small displacement it adds is not data; do not read it as a difference between observations.
  • Compare strips by position and spread. Check where each group sits on the data axis, how widely the points spread, and whether any single points lie far from the rest.

Troubleshooting

Points hide each other

The default method = "overplot" draws tied values at the same spot. Switch to method = "jitter", and if the strips still look crowded, raise the jitter amount from its default of 0.1.

Stacked points look wrong or do nothing

Stacking is meant for very granular data. If your values are continuous with few repeats, use "jitter" instead, or round the values first as the manual’s example does.

Axis labels are blank or on the wrong axis

dlab labels the data axis and glab labels the group axis. The data axis is X unless vertical = TRUE, so set the label to match the orientation you chose.

Groups are in an unexpected order or position

Groups are placed at at = 1:n by default. Set at explicitly to place strips where you want them.

Free alternatives

Base R’s stripchart() and the ggplot2 function geom_jitter() both draw jittered one-dimensional dot plots, and both are free and open source. The ggplot2 reference describes geom_jitter() as adding a small amount of random variation to the location of each point, and as a shortcut for geom_point(position = "jitter"). A matching call for the manual’s example is ggplot(OrchardSprays, aes(treatment, decrease)) + geom_jitter(width = 0.2). For more on the ggplot2 system, see ggplots in R.

Feature Base R stripchart() ggplot2 geom_jitter()
Where it comes from graphics package, R manual ggplot2 package, installed with install.packages("ggplot2")
How jitter is set method = "jitter" with jitter = 0.1 (amount) width and height, both NULL by default
Default amount 0.1 40% of the resolution of the data when omitted
What the number means Amount of jitter The jitter is added in both positive and negative directions, so the total spread is twice the value specified
Caution with categories Strips sit at at = 1:n Categorical data are aligned on integers, so a width or height of 0.5 makes the categories indistinguishable

If you want the plot to carry an extra variable or to join a longer ggplot2 workflow, geom_jitter() is the natural route. If you just need a quick look at raw values per group, stripchart() is a single call. Line width and styling arguments for base graphics are covered in lwd in R.

FAQ

What is a stripchart in R?

It is a one-dimensional scatter plot (dot plot) drawn by stripchart(): one point per observation along a single axis, with one strip per group.

When should I use a stripchart instead of a boxplot?

The R manual calls stripcharts a good alternative to boxplots when sample sizes are small; every observation stays visible, so group size is obvious.

How do I make the strips vertical?

Set vertical = TRUE. The default is FALSE.

How do I stop points from overlapping?

Use method = "jitter" to add random displacement, or method = "stack" for very granular data.

How do I group a stripchart by a factor?

Pass a formula such as y ~ g, with data = naming the data frame.

How do I draw a stripchart in ggplot2?

Use geom_jitter(), which is a shortcut for geom_point(position = "jitter").

How do I make jitter reproducible in R?

Call set.seed() before stripchart(method = "jitter"), since stripchart has no seed argument. In ggplot2, pass seed to position_jitter().

Does stripchart handle missing values?

Yes. NA values are allowed, and with the formula method the default na.action ignores missing values in the response or the group.

What does the jitter argument in stripchart do?

It sets the amount of jitter used when method = "jitter"; the default is 0.1.

What is the difference between jitter() and stripchart(method = “jitter”)?

jitter() adds amount * runif(n, -1, 1) to a numeric vector, changing its values. The stripchart option displaces points across the strip only, for drawing.

How do I put strips at custom positions?

Use at; the manual’s example sets at = (1:8)^2. The default is 1:n.

Can I use a log axis?

Yes. The manual’s example uses vertical = TRUE with log = "y".

Sources

Data: Jitter controls in base R stripchart() and related R and ggplot2 functions

Compares how four R functions expose jitter: argument name, default, what the number means, and whether a seed is offered. Compiled from the R manual pages for stripchart and jitter and the ggplot2 reference pages for geom_jitter and position_jitter.

Jitter controls in base R stripchart() and related R and ggplot2 functions
FunctionJitter argumentDefaultMeaning of the valueHas a seed argument
graphics::stripchart(method = "jitter")jitter0.1Amount of jitter used when method = "jitter"No
base::jitter()amount (and factor)amount = NULL, factor = 1Noise x + amount * runif(n, -1, 1); NULL gives factor * d/5, with d about the smallest gap between unique valuesNo
ggplot2::geom_jitter()width, heightNULL (40% of data resolution)Added in both directions, so total spread is twice the valueNot in usage; use position_jitter
ggplot2::position_jitter()width, height, seedNULL; seed = NASame as geom_jitter; seed makes jitter reproducibleYes

Sources

Compiled by CASRAI from the sources above. Free to reuse under CC BY 4.0 with attribution.

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · full access

Ask about Stripchart in R: How to Use stripchart() with Jitter and Stack

Full access: large monthly usage, up to 10 source passages behind each answer, and MCP and API access for Claude Code, Codex and other CLIs. Cancel any time.

An AI assistant for research: funder rules, compliance, methods and publishing. It links the sources behind its answers and labels answers that come from a web search.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays open to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →