Hi all ,
I have the following bar chart and I want to add SLC variable values to the charts but I don't know how to use geom_text:
ggplot(df,(Protocol,fill=quant))+geom_bar()+coord_flip()
Thanks for any help!
Elahe
add value to Bar chart ggplot2
5 messages · Elahe chalabi, Jeff Newmiller, Ulrik Stervbo
Hi Elahe, maybe this will help: http://stackoverflow.com/questions/6455088/how-to-put-labels-over-geom-bar-in-r-with-ggplot2 or this: http://stackoverflow.com/questions/12018499/how-to-put-labels-over-geom-bar-for-each-bar-in-r-with-ggplot2 Best, Ulrik On Fri, 27 May 2016 at 15:12 ch.elahe via R-help <r-help at r-project.org> wrote:
Hi all ,
I have the following bar chart and I want to add SLC variable values to
the charts but I don't know how to use geom_text:
ggplot(df,(Protocol,fill=quant))+geom_bar()+coord_flip()
Thanks for any help!
Elahe
______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Thanks Ulrik, But in these examples they want to mark the percentage or frequency of plot variables, in my case I want to mark the bars with a different variable of my df. DO you have any idea?
On Friday, May 27, 2016 3:22 PM, Ulrik Stervbo <ulrik.stervbo at gmail.com> wrote:
Hi Elahe, maybe this will help: http://stackoverflow.com/questions/6455088/how-to-put-labels-over-geom-bar-in-r-with-ggplot2 or this: http://stackoverflow.com/questions/12018499/how-to-put-labels-over-geom-bar-for-each-bar-in-r-with-ggplot2 Best, Ulrik
On Fri, 27 May 2016 at 15:12 ch.elahe via R-help <r-help at r-project.org> wrote:
Hi all , I have the following bar chart and I want to add SLC variable values to the charts but I don't know how to use geom_text: ggplot(df,(Protocol,fill=quant))+geom_bar()+coord_flip() Thanks for any help! Elahe
______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
I think you need to read those questions again more carefully... particularly the second one.
Sent from my phone. Please excuse my brevity. On May 27, 2016 7:41:25 AM PDT, "ch.elahe via R-help" <r-help at r-project.org> wrote: >Thanks Ulrik, >But in these examples they want to mark the percentage or frequency of >plot variables, in my case I want to mark the bars with a different >variable of my df. DO you have any idea? > > > >On Friday, May 27, 2016 3:22 PM, Ulrik Stervbo ><ulrik.stervbo at gmail.com> wrote: > > > >Hi Elahe, > >maybe this will help: >http://stackoverflow.com/questions/6455088/how-to-put-labels-over-geom-bar-in-r-with-ggplot2 >or this: >http://stackoverflow.com/questions/12018499/how-to-put-labels-over-geom-bar-for-each-bar-in-r-with-ggplot2 > >Best, >Ulrik > > >On Fri, 27 May 2016 at 15:12 ch.elahe via R-help <r-help at r-project.org> >wrote: > > >>Hi all , >>I have the following bar chart and I want to add SLC variable values >to the charts but I don't know how to use geom_text: >> >> >> ggplot(df,(Protocol,fill=quant))+geom_bar()+coord_flip() >> >>Thanks for any help! >>Elahe >> >>______________________________________________ >>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >>https://stat.ethz.ch/mailman/listinfo/r-help >>PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >>and provide commented, minimal, self-contained, reproducible code. >> > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]]
Hi Elahe, Based on this and your other questions I think you could benefit from spending time with tutorials on ggplot and on R in general. Google should give you plenty and I quickly found this: http://www.ats.ucla.edu/stat/r/ and this: https://www.nceas.ucsb.edu/files/scicomp/Dloads/RProgramming/BestFirstRTutorial.pdf R tutorial but others might suit your needs. For the ggplot tutorial I came across http://tutorials.iq.harvard.edu/R/Rgraphics/Rgraphics.html and http://www.r-bloggers.com/basic-introduction-to-ggplot2/ I have only skimmed the linked pages and it looks like a good starting point. Hope this helps Ulrik On Fri, 27 May 2016 at 16:58 Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:
I think you need to read those questions again more carefully... particularly the second one. -- Sent from my phone. Please excuse my brevity. On May 27, 2016 7:41:25 AM PDT, "ch.elahe via R-help" < r-help at r-project.org> wrote:
Thanks Ulrik, But in these examples they want to mark the percentage or frequency of plot variables, in my case I want to mark the bars with a different variable of my df. DO you have any idea? On Friday, May 27, 2016 3:22 PM, Ulrik Stervbo <ulrik.stervbo at gmail.com> wrote: Hi Elahe, maybe this will help: http://stackoverflow.com/questions/6455088/how-to-put-labels-over-geom-bar-in-r-with-ggplot2 or this: http://stackoverflow.com/questions/12018499/how-to-put-labels-over-geom-bar-for-each-bar-in-r-with-ggplot2 Best, Ulrik On Fri, 27 May 2016 at 15:12 ch.elahe via R-help <r-help at r-project.org> wrote: Hi all ,
I have the following bar chart and I want to add SLC variable values to the charts but I don't know how to use geom_text:
ggplot(df,(Protocol,fill=quant))+geom_bar()+coord_flip()
Thanks for any help!
Elahe
------------------------------
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
------------------------------
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.