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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:29:31+00:00 2026-06-16T06:29:31+00:00

I want to plot error bars of the two different set of value of

  • 0

I want to plot error bars of the two different set of value of y1, y2 with respect to x. In other words, I have two data Y1,Y2 and they are correspond X value. I managed to plot them together after I reshaped the data frame. Now I want to graph the error bars on the same graph for each Y1, Y2 points. I understand geom_errorbar() is what I’m looking for. However, I’m following long way to do that and I’m sure there is a short way. What I’m doing I’m calculating “se” for each set and calculate aes(ymin=y1-se, ymax=y+se) and repeat the same for Y2. Because I want to apply this error bars to different plots . I ‘d rather do it in a short way.

Here my data frame after reshape:

M     Req      Rec      load       Un      L1
1    30.11  9.000000   3.000000  30.02000  A
2    50.31  10.030000  6.045000  39.44000  A
3    60.01  11.290000  7.366667  54.93000  A
4    66.10  12.630000  8.827500  68.44500  A
5    80.18  13.106000  9.462000  71.07600  A
6    87.10  14.421667  15.961667 82.70500  A
7    90.08  15.880000  20.644286 94.20714  A
1    4.000  1.500000    1.000000  1        B
2    8.240  6.240000    4.760000  3.00000  B
3    10.28  12.230000  9.420000  4.05000   B
4    18.570 25.570000 17.930000  6.00000   B
5    22.250 35.250000 27.850000  7.00000   B
6    35.070 55.010000 36.810000  8.06000   B
7    48.480  0.420000 47.020000  9.06000   B

I have used the following command to graph it:

ggplot(df_reshaped,aes(x = M, y = Req, colour = L1, shape=L1)) +  
     geom_point(size = 5)+
     geom_line() +
     scale_x_discrete(name="M") +
     scale_y_continuous(name="Y1 Y2")+
     ggtitle("A vs B")

In this case I’m graphing Y1=Req1, Y2=Req2, with respect to x=M

Any short way or suggestion to calculate the error bars ?

Is there any quick way to calculate the “se” ?

  • 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-16T06:29:32+00:00Added an answer on June 16, 2026 at 6:29 am

    In general there are two possibilities to prepare your data for ggplot:

    • You could aggregate the raw data and plot the results. If you follow this way, you have to calculate the standard errors too since the information cannot be retrieved from the aggregated data. These standard errors could be plotted with geom_errorbar.
    • A second option is to use the raw data and let ggplot do all the calculations for you. This could be done with stat_summary. For example:

      stat_summary(fun.data = "mean_cl_normal", mult = 1, geom = "errorbar")
      

    Obviously, you have chosen the first approach. So, you just need to calculate the standard errors for the points of both variables.

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

Sidebar

Related Questions

I have the data in two files. I want to plot a graph the
I have a data which I want to plot in cumulative function. The R
With this approach. I have a line plot graph. I want to plot 'two'
I have a data file where I want to plot specific lines of the
I want to plot data from different data frames with ggplot. However, I'm having
I have many files of data and I want to plot all of them
I have the following barchart to which I want to add error bars. library(lattice)
I have three data sets and also a vector of their error. I want
Possible Duplicate: How to plot two histograms together in R? I want to plot
I have a vectors of strings, say c(E^A,S^P,lambda,T,E^Q,E^Q,AT) , and I want to plot

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.