How can I add errorbars to a grouped bar plot in Makie.jl?

One option is to use `crossbar`

, but this generates a bar graph indicating the error range, not the usual line + whisker.

How can I add errorbars to a grouped bar plot in Makie.jl?

One option is to use `crossbar`

, but this generates a bar graph indicating the error range, not the usual line + whisker.

You mean the errorbars function doesnâ€™t work because it doesnâ€™t include the grouping?

We should probably add `dodge`

to the error bar recipe, so that one just has to pass in the same `dodge`

variable than in the bar plot.

That would be great.

Does it make more sense to make a barplot-with-errorbars recipe instead? There might be other things that youâ€™d want to dodge, but it seems weird to me to add it to every basic recipe. If I think about errorbars, I donâ€™t think about dodging. Only in conjunction with barplots.

That also makes sense. It seems like dodged errorbars only really make sense for dodged barplot and in a dodged violin plot (to have a vertical line in the middle marking some quantiles), but again, that could just be part of the violin recipe.

On a related not, Iâ€™m curious whether we can find a parametric approach to encode the â€śestimator + errorâ€ť plots. Something along the lines of

`plot(Errorplot{BarPlot, ErrorBars}, x, ys, ylower, yupper)`

`plot(Errorplot{Scatter, ErrorBars}, x, ys, ylower, yupper)`

`plot(Errorplot{Scatter, Band}, x, ys, ylower, yupper)`

`plot(Errorplot{Lines, ErrorBars}, x, ys, ylower, yupper)`

`plot(Errorplot{Lines, Band}, x, ys, ylower, yupper)`

where `ErrorPlot`

would be the parametric recipe, hopefully with a better name. In this case, the `BarPlot`

case would have a special method that takes dodging into account.

This would also help with AlgebraOfGraphics, because then analyses that return estimate plus error would only need return to return one layer with this composite recipe.

1 Like

I just got hit by this when trying to compose bar plot with dodge and errorbar with dodge. Is there a workaround other than crossbar?

Also just hit by this. @tbenst did you find a workaround? (also with `crossbar`

I canâ€™t seem to get the horizontal position right).