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 5982451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:05:21+00:00 2026-05-22T22:05:21+00:00

I would like to plot a simple graphic. I have a dat set with

  • 0

I would like to plot a simple graphic. I have a dat set with n rowns and k columns, in which each row has a a sequence of 0 and 1. I would like to plot exactly this sequence for all rows.

Actually I want to reproduce the figure 24.1, p. 516, of Gelman and Hill’s book (Data aAnalysis Using Regression and Multilevel/Hierarchical Models). I suspect that he made the graphic in Latex, but it seems quite ridiculous that I’m not able to repplicate this simple graphic in R. The figue is something like this. As you can see from the link, the “ones” are replaced by “S” and “zeros” by “.”. It’s a simple graphic, but it shows each individual response by time.

  • 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-22T22:05:22+00:00Added an answer on May 22, 2026 at 10:05 pm

    I would go with a formatted text output using sprintf. Much cleaner and simpler. If you still want a plot, you could go with the following:

    Given matrix tbl containing your data:

    tbl <- matrix(data=rep(0:1,25), nrow=5)
    

    You can generate a plot as:

    plot(1, 1, xlim=c(1,dim(tbl)[2]+.5), ylim=c(0.5,dim(tbl)[1]), type="n")
    lapply(1:dim(tbl)[1], function(x) {
      text(x=c(1:dim(tbl)[2]), y=rep(x,dim(tbl)[2]), labels=tbl[x,])
    })
    

    Using this as a base you can play around with the text and plot args to stylize the plot the way you wish.

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

Sidebar

Related Questions

I have a vector of integers, e.g.: 2,8,11,19 . I would like to plot
The data frame has n columns and I would like to get n plots,
When plotting a function using Plot, I would like to obtain the set of
I have two coordinates for which I would like to draw a perpendicular line
I would like to have a reference for the pros and cons of using
I would like to have an iframe take as much vertical space as it
I would like to have a VM to look at how applications appear and
I would like to create a simple flow chart in latex with the TikZ
I have a List, and I would like to compute a double[360] containing the
I would like to create 10 plots that have different data, but the same

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.