简体   繁体   English

一个 plot 上的多个散点图

[英]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.

相关问题 一个颜色条用于多个散点图 - One colorbar for multiple scatter plots Seaborn 散点图用循环绘制多个图 - Seaborn Scatter Plot multiple plots with loop 多图合二为一 plot - Multiple plots into one plot matplotlib:如何在一个网格中绘制多个散点图,其中每个图基于单独的列表具有不同的颜色? - matplotlib: How to plot multiple scatter plots in one grid where each plot is different color based on a separate list? Matplotlib:具有多组单独垂直散点图的散点 plot - Matplotlib: Scatter plot with multiple groups of individual vertical scatter plots 在一个图中绘制不同数据框的不同列作为散点图 - Plots different columns of different dataframe in one plot as scatter plot matplotlib绘制多个散点图,每个散点图由不同的三次变量着色 - matplotlib Plot multiple scatter plots, each colored by different thrid variable 如何使用matplotlib在同一窗口中绘制多个散点图? - How to plot multiple scatter plots in the same window with matplotlib? 如何防止 python 制作多个单独的散点图但产生单个散点 plot? - How to prevent python from making multiple individual scatter plots but produce single scatter plot? 将不同散点图制作的多个路径集合合并到一个图形子图中 - Merge multiple pathcollections made by different scatter plots in one figure subplot
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM