Last active
July 3, 2019 14:33
-
-
Save ilkayisik/d39732db89a12afb2f90c555061e80d1 to your computer and use it in GitHub Desktop.
Use matplotlib to create subplots with time series plots using 2 for loops [here for subjects and movies]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import seaborn as sns | |
for s in range(nr_subjects): | |
fig, ax = plt.subplots(5, 6, sharex=True, sharey=True, figsize=(15, 20)) | |
sns.despine() | |
ax = ax.flatten() | |
for m in range(nr_movies): | |
ax[m].plot(cdt[s, m, :]) | |
ax[m].plot(cdrt[s, m, :]) | |
ax[m].set_ylim([-1.2, 1.2]) | |
ax[m].text(10, -0.5, 'norm_lad: ' + "%.3f" %norm_lad_vals[s, m]) | |
ax[m].text(10, -0.75, 'p r: ' + "%.3f" %pr_vals[s, m]) | |
plt.suptitle('Participant: ' + '%.2d' %(s+1)) | |
savename = 'ForSubject_' + '%.2d' %(s+1) + '.png' | |
plt.savefig(savename, dpi=300) | |
plt.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment