In [ ]:
import numpy as np
import bqplot.pyplot as plt

Basic Histogram


In [ ]:
np.random.seed(0)
x_data = np.random.randn(100)

In [ ]:
fig = plt.figure(padding_y=0)
hist = plt.hist(x_data)
fig

In [ ]:
hist.count

In [ ]:
# Changing the number of bins
hist.bins = 20

Properties of Histogram


In [ ]:
# normalizing the count
fig = plt.figure(padding_y=0)
hist = plt.hist(x_data, normalized=True)
fig

In [ ]:
# changing the color
hist.colors=['orangered']

In [ ]:
# stroke and opacity update
hist.stroke = 'orange'
hist.opacities = [0.5] * hist.bins

Read-only properties of Histogram


In [ ]:
fig = plt.figure(padding_y=0)
hist = plt.hist(x_data, normalized=True)
fig

In [ ]:
# count is the number of elements in each interval
hist.count

In [ ]:
# mid points are the mid points of each interval
hist.midpoints