Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

ValueError: minvalue must be less than or equal to maxvalue

#This error occurred while using colorbar with spectrogram.
#Below is an extract of the code that caused an ValueError: 

vmin = 10*np.log10(np.max(signalArr)) - 100 

NFFT = 1024
pxx,  freq, t, cax = ax.specgram(signalArr**2/(NFFT/2), Fs=fs,
mode='psd', NFFT=NFFT, noverlap=NFFT/2, vmin=vmin, cmap=cmap)
clb= fig.colorbar(cax)

#initially the vmin was set as above for specgram, upon executing the
#code above, it let to the ValueError, then error was fixed after vmin
#was set to:

vmin = 10*np.log10(np.max(signalArr)) - 200 

#Note that this error depend on the signal signalArr. 

 
PREVIOUS NEXT
Tagged: #minvalue #equal #maxvalue
ADD COMMENT
Topic
Name
6+4 =