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

1 |
error_y = list(type = "data", array = c(YOUR_VALUES)) |

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

1 |
error_y = list(type = "percent", value = CHOOSE_%_VALUE) |

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:

1 2 3 4 5 |
error_x = list( type = "data", symmetric = FALSE, array = c(YOUR_HIGH_VALUES), arrayminus = c(YOUR_LOW_VALUES)) |

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