0

I've created spectrogram from file data in 2d using the script

Pxx, freqs, bins, im = plot.specgram(data, NFFT=524288, Fs=2.5e9, noverlap=65536, cmap='plasma')
plot.colorbar(label='Voltage (dB)').ax.yaxis.set_label_position('left')
ax = plot.gca()
ax.set_title('Night sound spectrogram detection')
ax.set_xlabel('Time (s)')
ax.set_ylabel('Frequency (Hz)')
plot.show()

And the question is how to create 3d spectrogram?

I tried

spec = plot.figure()
ax = spec.gca(projection='3d')

ax.plot_surface(frequs, bins, Pxx, cmap='plasma')
plot.show()

but it doesn't work.

Paul1010
  • 1
  • 1
  • What have you tried so far? You'll need to update your question to demonstrate some effort at solving the problem before you'll get any help. – calico_ Dec 29 '19 at 00:14
  • Is there a way to create some dummy data? For example using np.random? Or, if everything can be demonstrated by a few data points, just copy-paste the start of your data and create a dataframe? – JohanC Dec 29 '19 at 10:42
  • Did you look at https://stackoverflow.com/questions/56788798/python-spectrogram-in-3d-like-matlabs-spectrogram-function ? Does it help? If not, why not? – JohanC Dec 29 '19 at 12:45
  • I've looked at [https://stackoverflow.com/questions/56788798/python-spectrogram-in-3d-like-matlabs-spectrogram-function], it uses generated data, but I have a data in file, which contains to columns, first one with time and the second with value. I'm also using function specgram which returns four objects. – Paul1010 Dec 29 '19 at 14:59

0 Answers0