Geom.bar

Geom.bar

Draw bar plots. This geometry works on pre-summarized data such as counts. To draw histograms from a series of observations, add Stat.histogram to the plot, or use the convenient geometry Geom.histogram.

Aesthetics

Either

Or

If x is given, a bar will be drawn at each x value, specifying both xmin and xmax allows bars of variable width to be drawn.

Arguments

Examples

plot(dataset("HistData", "ChestSizes"), x="Chest", y="Count", Geom.bar)
Chest 30 35 40 45 50 0 500 1000 1500 Count
plot(by(dataset("datasets","HairEyeColor"),[:Eye,:Sex], d->sum(d[:Freq])),
    color="Eye", y="x1", x="Sex",
    Geom.bar(position=:dodge), Guide.ylabel("Freq"))
Sex Female Male Blue Brown Green Hazel Eye 0 50 100 150 Freq