1

When trying to create a few subplots and then fill them while using Seaborn I get everything plotted in the same subplot. This minimal working example reproduces exactly my problem. I would like every different first index of my tseries variable plotted in a different subplot, as I think my code shows by calling the different axis. If you have any suggestions where I am making a mistake, what's going wrong, please let me know, any suggestions are greatly appreciated!

Thank you!

import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
%matplotlib inline


tseries = np.random.random((3,100))
labels = np.random.randint(1,4,100)

fig, ax = plt.subplots(1, 3, figsize = (50,25))
k = 3
for clusteridx in range(1,k+1):
    ax[0] = sns.kdeplot(tseries[0,labels==clusteridx],shade=True,label='cluster '+str(clusteridx))
for clusteridx in range(1,k+1):
    ax[1] = sns.kdeplot(tseries[1,labels==clusteridx],shade=True,label='cluster '+str(clusteridx))
for clusteridx in range(1,k+1):
    ax[2] = sns.kdeplot(tseries[1,labels==clusteridx],shade=True,label='cluster '+str(clusteridx))


Emily
  • 354
  • 3
  • 10
  • Hi @ImportanceOfBeingErnest, Thank you for the link to the duplicate question! I did not come across it when looking for similar problems, thank you! – Emily Sep 13 '19 at 11:37

0 Answers0