0

I have a list of data . My values in the list are 0<x<1 and length of the list is 1,000,000 . I need to plot a probability density function like this :

I have tried the plt.hist but it gives me weird numbers in y axis. like 80,000 which is frequency .

1 Answers1

0

Here is some code using numpy & matplotlib to plot some random numbers

import numpy as np
import matplotlib.pyplot as plt

# Generate a random list of data (replace this with your actual data)
data = np.random.random(1000000)

# Plot the probability density function
plt.hist(data, bins=50, density=True, alpha=0.5, color='skyblue')

# Add labels and title to the plot
plt.xlabel('Value')
plt.ylabel('Probability Density')
plt.title('Probability Density Function')

# Show the plot
plt.show()
hobrin
  • 3
  • 2