Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

plt hist random normal distribution

# Implementation of matplotlib function
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
   
np.random.seed(10**7)
mu = 121 
sigma = 21
x = mu + sigma * np.random.randn(1000)
   
num_bins = 100
   
n, bins, patches = plt.hist(x, num_bins, 
                            density = 1, 
                            color ='green',
                            alpha = 0.7)
   
y = ((1 / (np.sqrt(2 * np.pi) * sigma)) *
     np.exp(-0.5 * (1 / sigma * (bins - mu))**2))
  
plt.plot(bins, y, '--', color ='black')
  
plt.xlabel('X-Axis')
plt.ylabel('Y-Axis')
  
plt.title('matplotlib.pyplot.hist() function Example

',
          fontweight ="bold")
  
plt.show()
Comment

PREVIOUS NEXT
Code Example
Python :: 0xff in python 
Python :: empty python 
Python :: bulet in jupyter notebook 
Python :: which can be reversed , string or list? 
Python :: uncompress zip file in pythonanywhere 
Python :: CHECK POLYGON IS VALID 
Python :: install python 3.10 pip 
Python :: python ordereddict initialization 
Python :: How to srape all links from a website in python 
Python :: Python NumPy atleast_3d Function Syntax 
Python :: Python NumPy ndarray flat function Example 
Python :: display colors in python console 
Python :: python dictionary examples 
Python :: Python NumPy ascontiguousarray Function Example Tuple to an array 
Python :: Python NumPy row_stack Function Example with 1d array 
Python :: Python NumPy insert Function Example Working with Scalars 
Python :: python how to loop through array 
Python :: Python __le__ magic method 
Python :: pandas listagg equivalent in python 
Python :: NumPy bitwise_or Code When inputs are Boolean 
Python :: miniforge cv2 vscode 
Python :: cast set 
Python :: send http request from python with quesry 
Python :: knn compute_distances_one_loop 
Python :: Data Extraction in Python 
Python :: pandas groupby min get index 
Python :: tkinter screen clicked 
Python :: Flask error: werkzeug.routing.BuildError 
Python :: EDA dataframe missing and zero values 
Python :: ring Sort List Item 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =