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

  • Home
  • SEARCH
  • 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 7927307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:14:22+00:00 2026-06-03T19:14:22+00:00

I have a small dataframe from which I am plotting 3 columns in order

  • 0

I have a small dataframe from which I am plotting 3 columns in order to display a risk estimate and the 95% confidence intervals. Right now I have those 3 sets of vectors displayed as points, but I would like to connect them using “segment”.

Here is a sample of the dataframe being plotted:

                      Diagnosis  age.group X..change X..lower X..upper
1                    Dysrythmia All adults        16        0       35
2                 Heart failure All adults        -4      -20       14
3                        Asthma All adults        10       -5       28

Here is my plot code:

plot(dt[,4], pch="-", ylim=c(-20, 50), axes=F, ann=F, cex=1.5)
abline(h=0, col=1, lty=2)
points(dt[,3], pch=16, col="black", bg="black" )
points(dt[,5], pch="-", cex=1.5)
axis(1, at=1:10, lab=dt[,1], las=3, lwd=0, cex.axis=0.7, pos=-22)
axis(2, at=5*-20:54, las=1, cex.axis=0.7, cex.lab=0.7, col=1)
title(main="Risk estimates: All Adults", col.main="black", font.main=1)
title(ylab="Increase in risk (%)", col.lab=rgb(0,0.5,0))
box()

The points are the estimates and the dashes are the confidence intervals. I want to connect these three points for each diagnosis. I’ve looked at the R notation but it doesn’t help me figure out how to tell R which xy “coordinates” I want to draw the segments connecting, because I have used vectors here instead of values? Can anyone help write a segment line of code? Thank you

  • 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-06-03T19:14:30+00:00Added an answer on June 3, 2026 at 7:14 pm

    OK, so you basically want to plot CIs. The arrows command is probably better for what you want. Here’s a brief example that works with what you have for the lower CI.

    plot(dt[,3], pch="•", ylim=c(-20, 50), axes=F, ann=F, cex=1.5, bty = 'o')
    abline(h=0, col=1, lty=2)
    arrows(1:3, dt[,3], 1:3, dt[,4], angle = 90, length = 0.08)
    

    You can therefore leave out the extra points commands and any new segments commands. It’s all much more concise.

    But, if you insist on adding segments to what you have it’s just…

    segments(1:3, dt[,3], 1:3, dt[,5])
    segments(1:3, dt[,3], 1:3, dt[,4])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have small PHP script which has $query = SELECT MAX(id) FROM `dbs`; //query
I have small page which has label, DropDownList and a submit button. <div> <asp:label
I have a dataframe with the lengths and widths of various arthropods from the
I have a big dataframe, but small example would be like this: mydf <-
I have a dataframe with three columns: Id , Date and Value and want
I have small script that takes the value from a text input and needs
I now have a small java script server working correctly, called by: <?php $handle
I have small chess application which consists of cells and boards. When user moves
I have small problem with JavaMail. Sometimes method getRecipients from class Message returns weird
I have small issue and that is I am now working with toggle button

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.