Easy Error Bars with R and Plotly

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


It is also possible to calculate and plot error bars with a percent value, like on the Rain line below. Set:


To create horizontal error bars use error_x. Furthermore, it’s easy to graph asymmetrical error bars. Just set symmetric = FALSE and add an arrayminus array like this:


Creating dashboards or visualizations at your company? Consider Plotly Enterprise for modern intracompany graph and data sharing.