title: bar author: Daniel Jones part: Geometry order: 1003 ...
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 conevient geometry Geom.histogram
.
y
: Height of each bar.color
(optional): Group categorically by color.
Either
x
: Position of each bar.
Or
xmin
: Starting x positions for each bar.xmax
: End x positions for each bar.
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.
-
position
: Either:stack
or:dodge
. If thecolor
aesthetic is bound this determines how bars of different colors should be arranged: stacked on top of each other, or placed side by side. -
orientation
: Either:vertical
(default) or:horizontal
. If:horizontal
, then the required aesthetics arey
orymin/ymax
.
using RDatasets
using Gadfly
Gadfly.prepare_display()
Gadfly.set_default_plot_size(12cm, 8cm)
plot(data("HistData", "ChestSizes"), x="Chest", y="Count", Geom.bar)