Python Forum
Defining x and y axes in Spectrogram Function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Defining x and y axes in Spectrogram Function
#4
I'm not familiar with spectrogram so the below DOES NOT WORK, but it shows how you may assign. The problem I appear to have here is not having the data.

import numpy as np
ht = np.array([1,2,3,4,5,6,7,8,9])
fs = np.array([3,1,5,2,6])
from scipy.signal import spectrogram  
spec_f, spec_t, spec = spectrogram(ht,fs)  
plt.pcolormesh(spec_t, spec_f, spec, shading='gouraud')  
plt.ylabel('Frequency [Hz]')  
plt.xlabel('Time [sec]')  
plt.show()
Reply


Messages In This Thread
RE: Defining x and y axes in Spectrogram Function - by jefsummers - Nov-29-2020, 01:42 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How do I set the figure title and axes labels font size in Matplotlib? anouar2002 1 1,731 Nov-03-2020, 05:31 PM
Last Post: ndc85430
  Plotting axes help StillAnotherDave 11 3,867 Jan-24-2020, 04:29 PM
Last Post: StillAnotherDave
  defining a function to see if a list is sorted Siylo 14 7,353 Nov-29-2018, 05:25 PM
Last Post: wavic
  python 3.4.3 Question a defining function student8 1 4,410 Oct-02-2017, 07:59 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020