Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP C C++ C# AWS W3.CSS HOW TO BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL SQLITE MONGODB ASP AI R GO KOTLIN SWIFT SASS VUE GEN AI SCIPY CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING INTRO TO HTML & CSS BASH RUST DART PLAYWRIGHT TOOLS MATH SHEETS POWER BI

R Strip Chart


Share

Strip Charts

A box plot shows a summary of the values: the median, the box and the whiskers. But you cannot see the values themselves.

A strip chart draws one dot for every value, along a single line. It is a good choice when you have a small set of numbers and want to see each one of them.

Use the stripchart() function to draw a strip chart:

Example

scores <- c(55, 62, 68, 70, 71, 75, 78, 80, 82, 85, 88, 91, 95)

stripchart(scores)

Result:

Strip chart with one dot for each test score
Try it Yourself »

Each dot is one student's test score. Now you can see that the scores are spread out from 55 to 95.


Equal Values

If some values are equal, their dots are drawn on top of each other, so you cannot see how many there are.

Here, we roll a dice 15 times:

Example

rolls <- c(3, 5, 2, 6, 3, 1, 4, 6, 3, 5, 2, 6, 4, 3, 6)

stripchart(rolls)

Result:

Strip chart of dice rolls where equal values are drawn on top of each other
Try it Yourself »

It looks like every number came up once, but that is not true: we rolled a 3 four times.

Add method = "stack" to stack equal values on top of each other. The pch = 19 parameter draws filled dots, like in the Plot chapter:

Example

rolls <- c(3, 5, 2, 6, 3, 1, 4, 6, 3, 5, 2, 6, 4, 3, 6)

stripchart(rolls, method = "stack", pch = 19)

Result:

Strip chart of dice rolls with equal values stacked
Try it Yourself »

Now it is easy to see that 3 and 6 came up most often.



Colors and Labels

Use vertical = TRUE to draw the strip chart from bottom to top. You can also use col, main and ylab, just like in the other charts:

Example

scores <- c(55, 62, 68, 70, 71, 75, 78, 80, 82, 85, 88, 91, 95)

stripchart(scores, vertical = TRUE, pch = 19, col = "blue", main = "Test Scores", ylab = "Score")

Result:

Vertical strip chart with blue dots, a title and a label
Try it Yourself »

Combine with a Box Plot

A strip chart and a box plot work well together: the box plot shows the summary, and the strip chart shows every value.

Draw the box plot first. Then draw the strip chart with add = TRUE, so the dots are added to the box plot instead of to a new chart:

Example

scores <- c(55, 62, 68, 70, 71, 75, 78, 80, 82, 85, 88, 91, 95)

boxplot(scores)
stripchart(scores, vertical = TRUE, pch = 19, col = "blue", add = TRUE)

Result:

Box plot with every test score drawn as a dot on top of it
Try it Yourself »


Free account

Track your progress

XP earned 0 Day streak 0 Spaces 0 League —

New

Learn in Adventure Mode W3Schools Adventure App

Coding fundamentals as bite-sized lessons and challenges.

×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookies and privacy policy.

Copyright 1999-2026 by W3Schools. All Rights Reserved. W3Schools is Powered by W3.CSS.