0% found this document useful (0 votes)
52 views1 page

Histogram and Box Plots

The document provides instructions for creating a histogram of a normal distribution using Python's matplotlib and numpy libraries. It specifies the figure size, axis creation, random seed setting, and parameters for generating the normal distribution data. The final output includes labeling the axes and setting the title for the histogram plot.

Uploaded by

pavan developer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views1 page

Histogram and Box Plots

The document provides instructions for creating a histogram of a normal distribution using Python's matplotlib and numpy libraries. It specifies the figure size, axis creation, random seed setting, and parameters for generating the normal distribution data. The final output includes labeling the axes and setting the title for the histogram plot.

Uploaded by

pavan developer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Histogram and Box plots

1. test_hist_of_a_sample_normal_distribution
Create a figure of size 8 inches in width, and 6 inches in height. Name it as fig.
Create an axis, associated with figure fig, using add_subplot. Name it as ax.
Set random seed to 100 using the expression np.random.seed(100).
Create a normal distribution x1 of 1000 values, with mean 25 and standard deviation 3.0. Use
np.random.randn.
Draw a histogram of x1 with 30 bins. Use the hist function.
Label X-Axis as X1
Label Y-Axis as Bin Count
Set Title as Histogram of a Single Dataset.

In [9]:
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure(figsize=(8,6))
ax = fig.add_subplot(111)
np.random.seed(100)
x1 = 25 + 3.0*np.random.randn(1000)
ax.set(title="Histogram of a Single Dataset", xlabel="X1", ylabel="Bin
Count")
plt.hist(x1,bins=30)

You might also like