Geom.histogram

Draw histograms. An alias for Geom.bar with Stat.histogram.

Aesthetics

Arguments

Examples

plot(dataset("ggplot2", "diamonds"), x="Price", Geom.histogram)
Price 0 5.0×10³ 1.0×10⁴ 1.5×10⁴ 2.0×10⁴ 0 1×10³ 2×10³ 3×10³ 4×10³
# Binding categorical data to color
plot(dataset("ggplot2", "diamonds"), x="Price", color="Cut", Geom.histogram)
Price 0 5.0×10³ 1.0×10⁴ 1.5×10⁴ 2.0×10⁴ Ideal Premium Good Very Good Fair Cut 0 1×10³ 2×10³ 3×10³ 4×10³
# Choosing a smaller bin count
plot(dataset("ggplot2", "diamonds"), x="Price", color="Cut",
     Geom.histogram(bincount=30))
Price 0 5.0×10³ 1.0×10⁴ 1.5×10⁴ 2.0×10⁴ Ideal Premium Good Very Good Fair Cut 0 5.0×10³ 1.0×10⁴ 1.5×10⁴
# Density instead of counts
plot(dataset("ggplot2", "diamonds"), x="Price", color="Cut",
     Geom.histogram(bincount=30, density=true))
Price 0 5.0×10³ 1.0×10⁴ 1.5×10⁴ 2.0×10⁴ Ideal Premium Good Very Good Fair Cut 0 200 400 600 800