# Does anyone know “nice” ways of plotting confidence intervals for use in presentations?

I am now plotting some bars and pictures for use in presentation. Really interested in different ways of showing confidence intervals on the plots.

• Are you looking for general aesthetic guidance? Or statistical guidance on what is best to report? Or particular ways of doing it in a particular software package? Please be more specific. – Aaron left Stack Overflow Jun 16 '11 at 15:30

As Aaron has pointed out, it is not quite clear what you are actually asking for.

Here is an example of bars with confidence intervals, which I think does the job

It was produced in R using the package ggplot2 and the following code based on the example in the help page for geom_errorbar

library(ggplot2)
df <- data.frame( trt = factor(c(1, 1, 2, 2)), resp = c(1, 5, 3, 4),
group = factor(c(1, 2, 1, 2)), se = c(0.1, 0.3, 0.3, 0.2) )
# Define the top and bottom of the errorbars
ci <- aes(ymax = resp + 1.96*se, ymin=resp - 1.96*se)
p <- ggplot(df, aes(fill=group, y=resp, x=trt))
# Because the bars and errorbars have different widths
# we need to specify how wide the objects we are dodging are
dodge <- position_dodge(width=0.9)
p + geom_bar(position=dodge) + geom_errorbar(ci, position=dodge, width=0.25)


If you like to do it in MATLAB, you can use errorbar. Alternatively, you may check the confidence interval plotting utilities in MATLAB file exchange. For instance, errorb is a nice function to do different types of confidence interval plots.

clc, clear, close

y=rand(1,5)+1; e=rand(1,5)/4;
hold off; bar(y,'facecolor',[.8 .8 .8]); hold on;
errorb(y,e);

figure
x=linspace(0,2*pi,8); y=sin(x); e=rand(1,8)/4;
hold off; plot(x,y,'k','linewidth',2); hold on;
errorb(x,y,e)

figure
values=abs(rand(2,3))+1; errors=rand(2,3)/1.5+0;
errorb(values,errors,'top');


There are other alternatives in file exchange such as #1, #2 and #3.