Horizontal Error Bar In R
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you ggplot errorbar might have Meta Discuss the workings and policies of this site
Vertical Error Bars Ggplot2
About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or geom_errorbar linetype posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of
Ggplot2 Horizontal Error Bars
4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Add horizontal error bars on a single point on a graph (R) up vote 0 down vote favorite I have plotted a graph using plot(data.exoplanets$loga, data.exoplanets$logMass, ylab="Log of Mass", xlab="Log of Semi Major Axis") highlighted a ggplot horizontal bar plot single point using points(data.exoplanets$loga[1535], data.exoplanets$logMass[1535], col="red", pch=19) and used this to generate a vertical set of error bars, where KepError was the error. lines(rep(data.exoplanets$loga[1535],2), c(data.exoplanets$loga[1535]-KepError, data.exoplanets$loga[1535]+KepError), col="red", type="o", pch="_") How can I tweak this to give horizontal error bars for the x-axis? css r share|improve this question asked Jan 6 '15 at 22:16 Ben Foxcroft 1 segments or arrows(...,angle=90) ? –Ben Bolker Jan 6 '15 at 22:16 I was looking into arrows, but I'm not sure how to make them as precise as I need them to be? –Ben Foxcroft Jan 6 '15 at 22:21 1 what do you mean? arrows(x0,y0,x1,y1) specifies the starting and ending points: in fact y0=y1 by default, so if you specify arrows(x0=lower,x1=upper,y0=y,angle=90) you should be done (then adjust length until you like the look of it; or use segments if you don't want "serifs" on your error bars –Ben Bolker Jan 6 '15 at 22:28 @BenFoxcroft: Are we do
That's certainly a simpler solution. It might be worth wrapping a few arrows() calls up in some kind of simple errorbar function (just so it's slightly more accessible to
Geom_errorbar Horizontal
newcomers). The only two things my function did that these calls don't do is (1)
Errbar R
to size the plot appropriately so the upper and lower limits of the errors are within the plot, (2) to draw the geom_text segments/arrows first so that one can add points with pch=19 and bg=par("bg") to get open points without lines going through them. On Thu, 9 Nov 2000, Emmanuel Paradis wrote: > At 14:07 08/11/00 -0500, Ben Bolker wrote: http://stackoverflow.com/questions/27808165/add-horizontal-error-bars-on-a-single-point-on-a-graph-r > > > > I'm going to take the liberty of reposting this function, which is based > >on one that Bill Venables posted a while back. I've tweaked with it a bit > >to add functionality. It will do horizontal bars or vertical bars, but > >not (yet) both simultaneously (the hardest thing about that is deciding on > >what format you want the data supplied in). > > > > There's also a https://stat.ethz.ch/pipermail/r-help/2000-November/009029.html help file supplied below. > > > > Should this (after appropriate tweaking/polishing/testing/revision) go > >into the main R code base? It seems like a pretty basic function to me > >... > > [...] > > >On Wed, 8 Nov 2000, Mike Beddo wrote: > > > >> I'm a newcomer to R. I can't seem to find any documentation how to add > >> error bars to points in scatter plots. I guess I could plot the points, > >> then compute and plot line segments in the X and/or Y directions to > >> represent the errors? > >> > >> - Mike > > I think using arrows(..., code=3, angle=90, ...) is quite simple, e.g.: > > x <- rnorm(10) > y <- rnorm(10) > se.x <- runif(10) > se.y <- runif(10) > plot(x, y, pch=22) > arrows(x, y-se.y, x, y+se.y, code=3, angle=90, length=0.1) > arrows(x-se.x, y, x+se.x, y, code=3, angle=90, length=0.1) > > The first arrows() draws the error bars for y, and the second one for x, > 'code=3' draws a head at both ends of the arrow, 'angle=' is the angle of > the head with the main axis of the arrow, and 'length=' is the length of > the head. You can also add usual graphic parameters (col, lwd, ...). > > > Emmanuel Paradi
by over 573 bloggers. There are many ways to follow us - By e-mail: On Facebook: If you are https://www.r-bloggers.com/easy-error-bars-with-r-and-plotly/ an R blogger yourself you are invited to add your own R content feed to this site (Non-English R bloggers should add themselves- here) Jobs for R-usersFinance Manager @ Seattle, U.S.Data Scientist http://r.789695.n4.nabble.com/Fwd-Plot-the-means-with-simultaneous-horizontal-and-vertical-error-bars-td4694211.html – AnalyticsTransportation Market Research Analyst @ Arlington, U.S.Data AnalystData Scientist for Madlan @ Tel Aviv, Israel Popular Searches web scraping heatmap twitter maps time series boxplot animation shiny how to import error bar image file to R hadoop Ggplot2 trading latex finance eclipse excel quantmod sql googlevis PCA knitr RStudio ggplot market research rattle regression coplot map rcmdr tutorial Recent Posts ODSC West 2016 - 20% off discount code for training with leading R experts Proofing statistics in papers Network Analysis Part 2 Exercises approximate lasso RcppAnnoy 0.0.8 R code to accompany Real-World Machine Learning horizontal error bar (Chapter 2) R Course Finder update ggplot2 2.2.0 coming soon! All the R Ladies One Way Analysis of Variance Exercises GoodReads: Machine Learning (Part 3) Danger, Caution H2O steam is very hot!! R+H2O for marketing campaign modeling Watch: Highlights of the Microsoft Data Science Summit A simple workflow for deep learning Other sites SAS blogs Jobs for R-users Easy Error Bars with R and Plotly March 25, 2015By chelsea (This article was first published on Modern Data » R, and kindly contributed to R-bloggers) Error bars are a great way to visually represent variability of a dataset, and are easy to graph with Plotly and R! Error bars can be used to visualize standard deviations, standard errors or confidence intervals (just don't forget to specify which measure the error bar in the graph represents). Below are two examples that demonstrate how to graph a variety of error bars. The complete R script and data used to create these 2 graphs are available here! To create vertical error bars, like on the Snow line in the graph below, set error_y = list(
type = "dat
messages Ahmed Attia Threaded Open this post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ Fwd: Plot the means with simultaneous horizontal and vertical error bars Dear R users, I would appreciate your help in plotting the means with simultaneous horizontal and vertical error bars. I use the lineplot.CI but it creates the vertical bars only. The attached file has the dataset that I want to graph. The (X) is the x-axis values and (y Lint) is the response in y-axis. Therefore, values in the x-axis would be 150, 350, 550, .....etc. At each value of the x-axis would be the average response point (y Lint) with vertical and horizontal error bars. Each value of the x-axis (X) represents a range of values that in x Water. The x Water column should be used to draw the horizontal lines. Thank you so much. AA Ahmed M. Attia Research Assistant Dept. of Soil&Crop Sciences Texas A&M University [hidden email] Cell phone: 001-979-248-5215 FAX: 001-308-455-4024 ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code. Sarah Goslee Threaded Open this post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ Re: Fwd: Plot the means with simultaneous horizontal and vertical error bars You could try plotCI from the plotrix package. Note that most attachments are stripped; dput() is the preferred way to include data. Sarah On Fri, Jul 18, 2014 at 4:41 PM, Ahmed Attia <[hidden email]> wrote: > Dear R users, > > I would appreciate your help in plotting the means with simultaneous > horizontal and vertical error bars. I use the lineplot.CI but it creates > the vertical bars only. > > > The attached file has the dataset that I want to graph. The (X) is the > x-axis values and (y Lint) is the response in y-axis. Therefore, values in > the x-axis would be 150, 350, 550, .....etc. > > At each value of the x-axis would be the average response point (y Lint) > with vertical and horizontal error bars. > > Each value of the x-axis (X) represents a range of values that in x Water. > The x Water column should be used to draw the horizontal lines. > > Thank you so much. > > AA > > > -- Sarah Goslee http://www.functionaldiversity.org______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, min