Skip to content

Instantly share code, notes, and snippets.

@macleginn
Created October 6, 2020 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save macleginn/8fc4e827c670ddb99e39c8794ab5c71e to your computer and use it in GitHub Desktop.
Save macleginn/8fc4e827c670ddb99e39c8794ab5c71e to your computer and use it in GitHub Desktop.
import pandas as pd
import matplotlib.pyplot as plt
d = pd.read_excel('spectrograms-relative-20.xlsx', header=None)
# Combine the first two columns in a new index
index_col = [ f'{a}-{b}' for a, b in zip(d.iloc[:,0], d.iloc[:,1]) ]
d.index = index_col
# Delete old index columns
del d[0]
del d[1]
plt.figure(figsize = (16, 55))
for i, word in enumerate(d.index[:30]):
plt.tight_layout()
plt.subplot(30, 1, i+1)
plt.tick_params(
axis='x', # changes apply to the x-axis
which='both', # both major and minor ticks are affected
bottom=False, # ticks along the bottom edge are off
top=False, # ticks along the top edge are off
labelbottom=False) # labels along the bottom edge are off
# One row per plot
plt.plot(d.iloc[i,:])
plt.title(word)
plt.savefig('lineplottest.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment