Black Lives Matter. Please consider donating to Black Girls Code today.

Plotting stereo audio - Plotly Python


I’m a new plotly user and my primary use is offline plots. So, I’m using the modules and objects from plotly.offline.

I have stereo audio content I need to plot. With MATLAB or Python’s own matplotlib, I can just plot it using plot(x) (where x is a stereo audio signal). The plot automatically overlays the two channels and assigns a different color to the second channel.

In Plotly however, it seems like I have to split the file into two separate traces:
trace0 --> x[:,0]
trace1 --> x[:,1]
data = [trace0, trace1]

And then plot the data.

Is there a pre-defined function to plot stereo or even other multi-channel data without having to split it up? I guess we could look at it as plotting the columns of a matrix?


If you don’t mind converting x to a Pandas dataframe, then you could use cufflinks:

Thanks for the suggestion. But cufflinks doesn’t like large datasets. It gives a user warning to convert it to a webGl graph or use matplotlib, and then errors out after a long time waiting :slight_smile:

I think I’ll stick to the extra couple of lines to create two traces individually, as plotly by itself doesn’t have any issues.