Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6568189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:26:49+00:00 2026-05-25T14:26:49+00:00

What is the best way to generate a dotplot with two factors like this,

  • 0

What is the best way to generate a dotplot with two factors like this, preferably using standard R plots (not ggplot) and from a 2×2 data frame. The horizontal lines should be means. I have tried cleveland dot charts, but cannot figure out how to get two data series’ and have the dots jittered:

example dotplot

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T14:26:50+00:00Added an answer on May 25, 2026 at 2:26 pm

    The following piece of code should do the trick:

    set.seed(1)
    t1 = rnorm(10); t2 = rnorm(10, 2)
    t1_g2 = rnorm(10, 4);t2_g2 = rnorm(10)
    
    ##Don't print the axes labels
    par(ann=FALSE)
    
    ##Plot first set of data.
    ##Need to check for sensible ranges
    ##Use the jitter function to spread data out.
    plot(jitter(rep(0,10),amount=0.2), t1,
         xlim=range(-0.5,3.5), ylim=range(-3,8),
         axes=FALSE,frame.plot=TRUE)
    points(jitter(rep(1,10), amount=0.2), t1_g2, col=2)
    points(jitter(rep(2,10), amount=0.2), t2)
    points(jitter(rep(3,10), amount=0.2), t2_g2, col=2)
    
    ##Add in the y-axis
    axis(2, seq(-4,8,by=2))
    
    ##Add in the x-axis labels
    mtext("Treatment 1", side = 1, at=0.5)
    mtext("Treatment 2", side = 1, at=2.5)
    
    ##Add in the means
    segments(-0.25, mean(t1), 0.25, mean(t1))
    segments(0.75, mean(t1_g2), 1.25, mean(t1_g2))
    segments(1.75, mean(t2), 2.25, mean(t2))
    segments(2.75, mean(t2_g2), 3.25, mean(t2_g2))
    
    ##Add in the legend
    legend(0, 8, c("Group 1", "Group 2"), col=1:2, pch=1)
    

    which gives:

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the best way to generate gifs of algorithms like this one in
What is the best way to generate a name for some temporary context which
I need to find a best way to generate a million tcp connections. (More
Given a string, what is the best way to generate a substring after n
What's the best way to comment code in Java, is there a way to
Very similar to this question , I'm looking to calculate the MD5 hash of
so i was able to make my recaptcha thing working but my problem is
I inherited some code that was recently attacked where the attacker sent repeated remote
I'm writing a new project in C# with a number of SQL queries in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.