Notebook on nbviewer (original) (raw)
- sciruby-notebooks
- Visualization Notebook
Creating a Histogram with statsample¶
This example demonstrates how a histogram can be created with statsample.
The 'histogram' function creates a histogram by using the Statsample::Graph::Histogram class. This class accepts data in a Daru::Vector (as created by rnorm
).
A line showing normal distribution can be drawn by setting the :line_normal_distribution
option to true.
In [1]:
require 'statsample' include Statsample::Shorthand
h = histogram(rnorm(3000,0,20), line_normal_distribution: true) h
Out[1]:
0 20 40 60 80 100 120 140 160 180 −80 −60 −40 −20 0 20 40 60