Strip charts: 1-D scatter plots - R Base Graphs - Easy Guides - Wiki (2024)

  • Home
  • Explorer
    • Pleleminary tasks
    • R base function: stripchart()
    • Create strip charts
    • Related articles
    • See also
    • Infos

    Previously, we described the essentials of R programming and provided quick start guides for importing data into R.

    Here, we’ll describe how to create strip charts (i.e., one dimensional scatter plots or dot plots) in R. These plots are a good alternative to box plots when sample sizes are small.

    1. Launch RStudio as described here: Running RStudio and setting up your working directory

    2. Prepare your data as described here: Best practices for preparing your data and save it in an external .txt tab or .csv files

    3. Import your data into R as described here: Fast reading of data from txt|csv files into R: readr package.

    Here, we’ll use the R built-in ToothGrowth data set.

    ToothGrowth$dose <- as.factor(ToothGrowth$dose)# Print the first 6 rowshead(ToothGrowth, 6)
    ## len supp dose## 1 4.2 VC 0.5## 2 11.5 VC 0.5## 3 7.3 VC 0.5## 4 5.8 VC 0.5## 5 6.4 VC 0.5## 6 10.0 VC 0.5
    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.
    # Plot len by dosestripchart(len ~ dose, data = ToothGrowth, pch = 19, frame = FALSE)

    Strip charts: 1-D scatter plots - R Base Graphs - Easy Guides - Wiki (1)

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

    Strip charts: 1-D scatter plots - R Base Graphs - Easy Guides - Wiki (2)

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

    Strip charts: 1-D scatter plots - R Base Graphs - Easy Guides - Wiki (3)

    • Creating and Saving Graphs in R
    • Scatter Plots
    • Scatter Plot Matrices
    • Box Plots
    • Bar Plots
    • Line Plots
    • Pie Charts
    • Histogram and Density Plots
    • Dot Charts
    • Plot Group Means and Confidence Intervals
    • Graphical Parameters
    • Lattice Graphs
    • ggplot2 Graphs

    This analysis has been performed using R statistical software (ver. 3.2.4).

    Enjoyed this article? I’d be very grateful if you’d help it spread by emailing it to a friend, or sharing it on Twitter, Facebook or Linked In.

    Show me some love with the like buttons below... Thank you and please don't forget to share and comment below!!

    Avez vous aimé cet article? Je vous serais très reconnaissant si vous aidiez à sa diffusion en l'envoyant par courriel à un ami ou en le partageant sur Twitter, Facebook ou Linked In.

    Montrez-moi un peu d'amour avec les like ci-dessous ... Merci et n'oubliez pas, s'il vous plaît, de partager et de commenter ci-dessous!

    Recommended for You!

    Machine Learning Essentials: Practical Guide in R
    Practical Guide to Cluster Analysis in R
    Practical Guide to Principal Component Methods in R
    R Graphics Essentials for Great Data Visualization
    Network Analysis and Visualization in R
    More books on R and data science

    Recommended for you

    This section contains best data science and self-development resources to help you on your path.

    Coursera - Online Courses and Specialization

    Data science

    Popular Courses Launched in 2020

    Trending Courses

    Books - Data Science

    Our Books


    Want to Learn More on R Programming and Data Science?

    Follow us by Email

    On Social Networks:

    Get involved :
    Click to follow us on Facebook and Google+ :
    Comment this article by clicking on "Discussion" button (top-right position of this page)

    Strip charts: 1-D scatter plots - R Base Graphs - Easy Guides - Wiki (2024)
    Top Articles
    Latest Posts
    Article information

    Author: Merrill Bechtelar CPA

    Last Updated:

    Views: 6099

    Rating: 5 / 5 (70 voted)

    Reviews: 85% of readers found this page helpful

    Author information

    Name: Merrill Bechtelar CPA

    Birthday: 1996-05-19

    Address: Apt. 114 873 White Lodge, Libbyfurt, CA 93006

    Phone: +5983010455207

    Job: Legacy Representative

    Hobby: Blacksmithing, Urban exploration, Sudoku, Slacklining, Creative writing, Community, Letterboxing

    Introduction: My name is Merrill Bechtelar CPA, I am a clean, agreeable, glorious, magnificent, witty, enchanting, comfortable person who loves writing and wants to share my knowledge and understanding with you.