[英]Beginner question: Python scatter plot with normal distribution not plotting
I have an array of random integers for which I have calculated the mean
and std
, the standard deviation.我有我所计算出的随机的整数数组mean
和std
,标准偏差。 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.我现在想使用 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?散点图需要 x 和 y 轴......但它应该是什么?
The closest thing you can do to visualise your distribution of 1D output is doing scatter where your x & y are the same.您可以做的最接近可视化一维输出分布的事情是在 x & y 相同的地方进行分散。 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)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.