1
votes

I have an array of random integers for which I have calculated the mean and std, the standard deviation. Next I have an array of random numbers within the normal distribution of this (mean, std).

I want to plot now a scatter plot of the normal distribution array using matplotlib. Can you please help?

Code:

random_array_a = np.random.randint(2,15,size=75)  #random array from [2,15) 
mean = np.mean(random_array_a)     
std = np.std(random_array_a)    
sample_norm_distrib = np.random.normal(mean,std,75)

The scatter plot needs x and y axis...but what should it be?

2
Difficult to know, what you ask for, when you don't know, what it is. Maybe your assignment is about a Normal Probability Plot? - Mr. T

2 Answers

1
votes

I think what you may want is a histogram of the normal distribution:

import matplotlib.pyplot as plt
%matplotlib inline

plt.hist(sample_norm_distrib)

enter image description here

0
votes

The closest thing you can do to visualise your distribution of 1D output is doing scatter where your x & y are the same. this way you can see more accumulation of data in the high probability areas. For example:

import numpy as np
import matplotlib.pyplot as plt

mean = 0    
std = 1 
sample_norm_distrib = np.random.normal(mean,std,7500)

plt.figure()
plt.scatter(sample_norm_distrib,sample_norm_distrib)

enter image description here