title: histogram author: Daniel Jones part: Geometry order: 1003 ...
Draw histograms. An alias for Geom.bar
with Stat.histogram
.
x
: Sample to draw histogram from.color
(optional): Group categoricially by color.
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 aesthetic isy
instead ofx
.bincount
: Number of bins to use. If unspecified, an optimization method be used to deterimine a reasonable value.minbincount
: Set a lower limit when automatically choosing a bin count.maxbincount
: Set an upper limit when automatically choosing a bin count.
using RDatasets
using Gadfly
Gadfly.prepare_display()
Gadfly.set_default_plot_size(14cm, 8cm)
plot(dataset("ggplot2", "diamonds"), x="Price", Geom.histogram)
# Binding categorical data to color
plot(dataset("ggplot2", "diamonds"), x="Price", color="Cut", Geom.histogram)
# Choosing a smaller bin count
plot(dataset("ggplot2", "diamonds"), x="Price", color="Cut",
Geom.histogram(bincount=30))