Adding error bars to a line graph with ggplot2 in RRotating and spacing axis labels in ggplot2Plot two graphs in same plot in RPlotting two variables as lines using ggplot2 on the same graphOrder Bars in ggplot2 bar graphHow can we make xkcd style graphs?Give color to scatter plot points based on value thersholdTurn each row of data into individual line with ggplotPlot using mean and standard error values using ggplot2Add a geom_rect to the plot background (not panel) in ggplot2Adding error bars to a ggplot with reshaped data

Why wear sunglasses in indoor velodromes?

How can sister protect herself from impulse purchases with a credit card?

How come Arya Stark wasn't hurt by this in Game of Thrones Season 8 Episode 5?

I recently started my machine learning PhD and I have absolutely no idea what I'm doing

Who is frowning in the sentence "Daisy looked at Tom frowning"?

What should I wear to go and sign an employment contract?

Have GoT's showrunners reacted to the poor reception of the final season?

FIFO data structure in pure C

Can more than one instance of Bend Luck be applied to the same roll by multiple Wild Magic sorcerers?

Referring to a character in 3rd person when they have amnesia

Can a generation ship withstand its own oxygen and daily wear for many thousands of years?

Bookshelves: the intruder

Is it a good idea to teach algorithm courses using pseudocode?

What would be the game balance implications for using the Gygax method for applying falling damage?

Why does a table with a defined constant in its index compute 10X slower?

Why does string strummed with finger sound different from the one strummed with pick?

Why are stats in Angband written as 18/** instead of 19, 20...?

Are there any symmetric cryptosystems based on computational complexity assumptions?

How do you cope with rejection?

Is it possible to determine from only a photo of a cityscape whether it was taken close with wide angle or from a distance with zoom?

Is there any deeper thematic meaning to the white horse that Arya finds in The Bells (S08E05)?

Physically unpleasant work environment

Does the usage of mathematical symbols work differently in books than in theses?

Does a windmilling propeller create more drag than a stopped propeller in an engine out scenario



Adding error bars to a line graph with ggplot2 in R


Rotating and spacing axis labels in ggplot2Plot two graphs in same plot in RPlotting two variables as lines using ggplot2 on the same graphOrder Bars in ggplot2 bar graphHow can we make xkcd style graphs?Give color to scatter plot points based on value thersholdTurn each row of data into individual line with ggplotPlot using mean and standard error values using ggplot2Add a geom_rect to the plot background (not panel) in ggplot2Adding error bars to a ggplot with reshaped data






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have three y values corresponding to three x values. I just want to have a line graph between these three dots



g <- c("1","2","3")
i <- c(181.83,178.74,152.02)
df <- data.frame(g,i)
p <- ggplot(df, aes(x=g, y=i)) + geom_line() + geom_point()


Using this I get this:



enter image description here



First of all why does my geom_line() not work? After that I have:



se <- c(22.95,22.72,19.2)
p + geom_errorbar(aes(ymin=se,ymax=se))


And what I get is:



enter image description here



Why are my errorbars not centered around the data points? Why are they smushed to the bottom? Why do they seem horizontal? What can I do to fix this?










share|improve this question
























  • You can fix the first problem with adding group = 1 like this ggplot(df, aes(x = g, y = i, group = 1)) + geom_line() + geom_point()

    – kath
    Mar 23 at 17:36












  • Thank you so much! Should I edit out that part of the question because it's resolved?

    – YarkınErgin
    Mar 23 at 17:46

















0















I have three y values corresponding to three x values. I just want to have a line graph between these three dots



g <- c("1","2","3")
i <- c(181.83,178.74,152.02)
df <- data.frame(g,i)
p <- ggplot(df, aes(x=g, y=i)) + geom_line() + geom_point()


Using this I get this:



enter image description here



First of all why does my geom_line() not work? After that I have:



se <- c(22.95,22.72,19.2)
p + geom_errorbar(aes(ymin=se,ymax=se))


And what I get is:



enter image description here



Why are my errorbars not centered around the data points? Why are they smushed to the bottom? Why do they seem horizontal? What can I do to fix this?










share|improve this question
























  • You can fix the first problem with adding group = 1 like this ggplot(df, aes(x = g, y = i, group = 1)) + geom_line() + geom_point()

    – kath
    Mar 23 at 17:36












  • Thank you so much! Should I edit out that part of the question because it's resolved?

    – YarkınErgin
    Mar 23 at 17:46













0












0








0








I have three y values corresponding to three x values. I just want to have a line graph between these three dots



g <- c("1","2","3")
i <- c(181.83,178.74,152.02)
df <- data.frame(g,i)
p <- ggplot(df, aes(x=g, y=i)) + geom_line() + geom_point()


Using this I get this:



enter image description here



First of all why does my geom_line() not work? After that I have:



se <- c(22.95,22.72,19.2)
p + geom_errorbar(aes(ymin=se,ymax=se))


And what I get is:



enter image description here



Why are my errorbars not centered around the data points? Why are they smushed to the bottom? Why do they seem horizontal? What can I do to fix this?










share|improve this question
















I have three y values corresponding to three x values. I just want to have a line graph between these three dots



g <- c("1","2","3")
i <- c(181.83,178.74,152.02)
df <- data.frame(g,i)
p <- ggplot(df, aes(x=g, y=i)) + geom_line() + geom_point()


Using this I get this:



enter image description here



First of all why does my geom_line() not work? After that I have:



se <- c(22.95,22.72,19.2)
p + geom_errorbar(aes(ymin=se,ymax=se))


And what I get is:



enter image description here



Why are my errorbars not centered around the data points? Why are they smushed to the bottom? Why do they seem horizontal? What can I do to fix this?







r ggplot2 graphing errorbar






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 23 at 17:35









kath

5,0231026




5,0231026










asked Mar 23 at 17:30









YarkınErginYarkınErgin

1




1












  • You can fix the first problem with adding group = 1 like this ggplot(df, aes(x = g, y = i, group = 1)) + geom_line() + geom_point()

    – kath
    Mar 23 at 17:36












  • Thank you so much! Should I edit out that part of the question because it's resolved?

    – YarkınErgin
    Mar 23 at 17:46

















  • You can fix the first problem with adding group = 1 like this ggplot(df, aes(x = g, y = i, group = 1)) + geom_line() + geom_point()

    – kath
    Mar 23 at 17:36












  • Thank you so much! Should I edit out that part of the question because it's resolved?

    – YarkınErgin
    Mar 23 at 17:46
















You can fix the first problem with adding group = 1 like this ggplot(df, aes(x = g, y = i, group = 1)) + geom_line() + geom_point()

– kath
Mar 23 at 17:36






You can fix the first problem with adding group = 1 like this ggplot(df, aes(x = g, y = i, group = 1)) + geom_line() + geom_point()

– kath
Mar 23 at 17:36














Thank you so much! Should I edit out that part of the question because it's resolved?

– YarkınErgin
Mar 23 at 17:46





Thank you so much! Should I edit out that part of the question because it's resolved?

– YarkınErgin
Mar 23 at 17:46












1 Answer
1






active

oldest

votes


















0














Alright I figured it out: the ymin and ymax arguments are telling where the error line starts and ends quite literally, so you can't just put the real standard error value and expect ggplot2 to figure out where will this error line be centered. So you have to specify it as:



geom_errobar(aes(ymin = i - se, ymax = i + se))


And finally you get:



enter image description here



Hope it helps others as well.






share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55316493%2fadding-error-bars-to-a-line-graph-with-ggplot2-in-r%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Alright I figured it out: the ymin and ymax arguments are telling where the error line starts and ends quite literally, so you can't just put the real standard error value and expect ggplot2 to figure out where will this error line be centered. So you have to specify it as:



    geom_errobar(aes(ymin = i - se, ymax = i + se))


    And finally you get:



    enter image description here



    Hope it helps others as well.






    share|improve this answer





























      0














      Alright I figured it out: the ymin and ymax arguments are telling where the error line starts and ends quite literally, so you can't just put the real standard error value and expect ggplot2 to figure out where will this error line be centered. So you have to specify it as:



      geom_errobar(aes(ymin = i - se, ymax = i + se))


      And finally you get:



      enter image description here



      Hope it helps others as well.






      share|improve this answer



























        0












        0








        0







        Alright I figured it out: the ymin and ymax arguments are telling where the error line starts and ends quite literally, so you can't just put the real standard error value and expect ggplot2 to figure out where will this error line be centered. So you have to specify it as:



        geom_errobar(aes(ymin = i - se, ymax = i + se))


        And finally you get:



        enter image description here



        Hope it helps others as well.






        share|improve this answer















        Alright I figured it out: the ymin and ymax arguments are telling where the error line starts and ends quite literally, so you can't just put the real standard error value and expect ggplot2 to figure out where will this error line be centered. So you have to specify it as:



        geom_errobar(aes(ymin = i - se, ymax = i + se))


        And finally you get:



        enter image description here



        Hope it helps others as well.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 23 at 19:42









        markus

        16.8k21438




        16.8k21438










        answered Mar 23 at 18:05









        YarkınErginYarkınErgin

        1




        1





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55316493%2fadding-error-bars-to-a-line-graph-with-ggplot2-in-r%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현