As far i know is pcolormesh convert an input data matrix given a colormap,
and the colormap gives a RGB values for each entries in matrix and plots it.
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from PIL import Image
import librosa
import librosa.display
from matplotlib import cm
fig = plt.figure(figsize=(12,4))
min = -1.828067
max = 22.70058
data = np.random.uniform(low=min, high=max, size=(474,40))
librosa.display.specshow(data.T,sr=16000,x_axis='frames',y_axis='mel',hop_length=160,cmap=cm.jet)
plt.axis('off')
plt.show()
raw_input("sadas")
convert = plt.get_cmap(cm.jet)
norm = matplotlib.colors.Normalize(vmin=0,vmax=1)
numpy_output_static = convert(norm(data.T))
plt.imshow(numpy_output_static,cmap = cm.jet, aspect = 'auto')
plt.show()
raw_input("asds”)
Problem here is I need to store as a numpy array, and the data has to represent the plot as the array is being used as an input for a NN, in which input matters, and won't be able learn anything if the input doesn't resemble or show the same patterns which the NN has to learn.
So how do make it store the actual plot, and keep the dimensions of data that used to make the plot.
Librosa basically do a pcolormesh plot, in which the argument only set the x-axis and y-axis , and scale them to the proper size.