You can download this code by clicking the button below.
This code is now available for download.
This function generates a histogram of random data based on a normal distribution using the Bokeh library.
Technology Stack : Bokeh, NumPy
Code Type : Chart generation
Code Difficulty : Intermediate
def random_histogram(data):
from bokeh.plotting import figure, show
from bokeh.charts import Histogram
from numpy import random
# Generate random data
data = random.normal(size=1000)
# Create a histogram with Bokeh
p = figure(title="Random Data Histogram", tools="pan,wheel_zoom,box_zoom,reset", width=800, height=600)
hist, edges = np.histogram(data, bins=50)
p.quad(top=hist, bottom=0, left=edges[:-1], right=edges[1:], color='navy', alpha=0.5)
# Show the plot
show(p)