Skip to content

Latest commit

 

History

History
52 lines (39 loc) · 1.35 KB

geom_histogram.md

File metadata and controls

52 lines (39 loc) · 1.35 KB

title: histogram author: Daniel Jones part: Geometry order: 1003 ...

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

Aesthetics

  • x: Sample to draw histogram from.
  • color (optional): Group categoricially by color.

Arguments

  • position: Either :stack or :dodge. If the color 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 is y instead of x.
  • 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.

Examples

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))