[英]Multiple scatter plots on one plot
I am having two audio files and I am taking their 1D convolution.我有两个音频文件,我正在使用它们的一维卷积。 The output has 3 points for each audio file.
output每个音频文件有3分。 I wanted to plot the outputs of both the files on the scatter plot but I am able to plot just the last output. Can anybody please help me to plot both the outputs?
我想要 plot 散点图 plot 上两个文件的输出,但我只能 plot 最后一个 output。有人能帮我 plot 这两个输出吗?
path = 'C:/Users/....'
for filename in glob.glob(os.path.join(path, '*.wav')):
sample_rate,audio = wavfile.read(filename)
x = audio
z = x.reshape(1,audio.shape[0],1)
z = tf.constant(z, dtype=tf.float32)
print(x.shape)
print(audio.shape[0])
y = tf.keras.layers.Conv1D(1, 44095, activation='relu', input_shape=(1,audio.shape[0],1))(z)
y=y.numpy()
print(y)
aa=y.reshape(-1)
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.scatter(np.arange(3), aa, color = 'crimson')
plt.show()
The plot that I am getting is:我得到的 plot 是:
You don't really need 3d for your case, as you have index + feature, so you only need 2 dimensions for each point, you can use the default 2d plotting context and use:你并不真的需要 3d 你的情况,因为你有索引+特征,所以你只需要每个点的 2 个维度,你可以使用默认的 2d 绘图上下文并使用:
# in the loop
plt.scatter(np.arange(3), aa, color = 'crimson')
# outside the loop
plt.show()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.