Home > Software engineering >  Plotting three points on scatter plot
Plotting three points on scatter plot

Time:01-11

I have an audio file. I took its convolution and got three values. Now I want to plot those values on a scatter plot. I want three separate dots for the three values but I am getting just one. What am I doing wrong?

from scipy.io import wavfile
import tensorflow as tf
import numpy as np
from matplotlib import pyplot as plt
# import matplotlib as plt


sample_rate,audio = wavfile.read('tv2.wav')
x = audio
z = x.reshape(1,audio.shape[0],1)
z = tf.constant(z, dtype=tf.float32)
y = tf.keras.layers.Conv1D(1, 44095, activation='relu', input_shape=(1,audio.shape[0],1))(z)
y=y.numpy()
aa=y.reshape(-1)

fig = plt.figure()
ax = fig.add_subplot(projection='3d')
ax.view_init(15, 35)
ax.scatter(xs=aa[0], ys=aa[1], zs=aa[2], color='crimson')

The plot that I am getting is:

enter image description here

CodePudding user response:

It seems like what you're looking for is something like the result of

plt.plot(aa, 'o', color = crimson)
plt.show()

Equivalently, you could do

plt.scatter(np.arange(3), aa, color = 'crimson')
plt.show()
  • Related