I think this is called a caterpillar plot. The dot is the mean and the lines represent a 95% confidence interval.
On the x axis there are several different test cycles, the red line is the true value.
I think this is called a caterpillar plot. The dot is the mean and the lines represent a 95% confidence interval.
On the x axis there are several different test cycles, the red line is the true value.
You can use ErrorListPlot
as described in: How to : Add Error Bars to Charts and Plots.
(This might be considered "easily found" however I don't believe "caterpillar plot" would find it.)
The first example from the documentation:
Needs["ErrorBarPlots`"]
ErrorListPlot[Table[{i, RandomReal[{0.2, 1}]}, {i, 10}]]
By the way if you find that the error bars are being cut off by the edges of the plot you can use Show
with a PlotRange
of All
:
ErrorListPlot[Table[{i, RandomReal[{1, 3}]}, {i, 10}]];
Show[%, PlotRange -> All]
The fact that the error bars are not taken into consideration for the plot range in ErrorListPlot
itself might be considered a bug.
Here is a cheat using BoxWhiskerChart
. The error bars are quantiles (0.05, 0.95) and not symmetric confidence interval. It is not ideal wrt placement of mean marker.
Using:
rv = RandomVariate[NormalDistribution[10, 3], {20, 10}];
BoxWhiskerChart[rv, {{"MeanMarker", Style[\[FilledSmallCircle], 20],
Blue}}, Method -> {"BoxRange" -> (Quantile[#, {0.05, 0.5, 0.5, 0.5,
0.95}, {{1, -1}, {0, 1}}] &)}, ChartStyle -> White,
GridLines -> {None, {{4, Dashed}, 10, {16, Dashed}}},
GridLinesStyle -> Red]
Here is an example using $\mu \pm 1.96 \sigma/\sqrt{n}$ to illustrate how you can adapt:
fun[d_] := {#1 - 1.96 #2, #3, #3, #3, #1 + 1.96 #2} & @@ {Mean[d],
StandardDeviation[d]/Sqrt[Length@d], Median[d]}
BoxWhiskerChart[rv, {{"MeanMarker", Style[\[FilledSmallCircle], 20],
Blue}}, Method -> {"BoxRange" -> (fun@# &)}, ChartStyle -> White,
GridLines -> {None, {{4, Dashed}, 10, {16, Dashed}}},
GridLinesStyle -> Red]
yielding: