title: How to color my data points in PCA plot from tfidfvectorizer matrix
body: <p>I'm working on a data-set that I've generated through web-crawling, I have two columns first one is the processed text and the second is the categories. And I wanted to visualize how my data points would look like in a 3D space with PCA.</p>
  
  <p>therefor, I applied a tfidfvectorizer through a subset of my intial data-frame and only took three categories, the matrix was so huge so I reduced the features to 75000 and now I'm trying to visualize my data points with PCA. I already tried doing so with the 20news_group data and it worked wery well. Here is what I tried with my code as far : </p>
  
  <pre class="lang-py prettyprint-override"><code>d = df.loc[df['Id'].isin(['37','49','23'])] #selecting the categories I wanted
  
  X_train, X_test, Y_train, Y_test = train_test_split(d.content, d.Id, test_size = 0.3)
  pipe = Pipeline([('vect', TfidfVectorizer(ngram_range = (1, 2), 
          stop_words = "english", 
          sublinear_tf = True, 
          max_features= 75000))])
  
  X = pipe.fit_transform(X_train)
  data = pd.DataFrame(X.todense())
  pca = PCA(n_components = 3).fit(data)
  data2D = pca.transform(data)
  
  
  from mpl_toolkits.mplot3d import axes3d, Axes3D
  import matplotlib.pyplot as plt
  colormap = np.array(['C0', 'C5', 'C8',])
  
  fig = plt.figure(figsize=(15,8))
  ax = Axes3D(fig)
  ax.scatter(data2D[:,0], data2D[:,1], data2D[:,2], c= colormap[np.array(Y_train)])
  ax.tick_params(labelsize=15)
  plt.show()
  
  </code></pre>
  
  <p>So the expected result should've been all my data points projected in the 3D space generated by PCA axes,  yet I get this error </p>
  
  <blockquote>
    <p>Traceback (most recent call last):
      File "***********/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3267, in run_code
        exec(code_obj, self.user_global_ns, self.user_ns)
      File "", line 3, in 
        ax.scatter(data2D[:,0], data2D[:,1], data2D[:,2], c= colormap[np.array(Y_train)])
    IndexError: index 37 is out of bounds for axis 1 with size 3</p>
  </blockquote>
  
  <p>When I take off the "c" argument it works well but there's no coloring to my data points and I get the following warning : </p>
  
  <blockquote>
    <p>UserWarning: This figure includes Axes that are not compatible with tight_layout, so results might be incorrect.
      warnings.warn("This figure includes Axes that are not compatible "</p>
  </blockquote>
  
  <p>I thought it was the max_features who did the problem so I did the same with 20news_group data and it worked well too.</p>
  
  <p>Thanks for your Help !</p>