text: user4595: I have plotted a tSNE plot of my 1643 cells from 9 time points by seurat like below as 9 clusters. But, you know I should not expected each cluster of cells contains only cells from one distinct time point. For instance, cluster 2 includes cells from time point 16, 14 and even few cells from time point 12. My question is, how I can change the colour of cells here so cells from each time point has a distinct colour does not matter some cells are being clustered somewhere else because this is unavoidable. I have named my cells already so I know cells from each time point but I want to colour cells to nine colours based on the time point they have been sequenced not the cluster they are being grouped by seurat. 
  I first created a file in one column is name of my cells and in second colour the corresponding time point 
  Like so
      time
  s0.1    h0
  s0.2    h0
  s0.3    h0
  s0.4    h0
  s0.5    h0
  s0.6    h0
  s0.7    h0
  s0.8    h0
  s0.9    h0
  s0.10   h0
  s0.11   h0
  s0.12   h0
  s0.13   h0
  s0.14   h0
  s0.15   h0
  s0.16   h0
  s0.17   h0
  s0.18   h0
  s0.19   h0
  s0.20   h0
  s0.21   h0
  s0.22   h0
  s0.23   h0
  s0.24   h0
  s0.25   h0
  
  I read my file
  time <- read.table("time.txt",header = TRUE)
  seurat@meta.data$time <- time
  TSNEPlot(object = seurat, group.by = "time")
  
  Sorry in my code colour of tSNE changed also the position of cells changed that I don't want that. I want to change the color of cells but they are still in the same cluster
  says that    
  > TSNEPlot(object = al)
  Error in seq.default(h[1], h[2], length.out = n) : 
    'to' must be a finite number 
  
  when I changed names(identity)=sampleInfo$cellName to names(identity)=src$cellName
  that worked but again the position of cells changed that I don't want that :(
  
  user678: Seurat puts the label in the tSNE plot according to the @ident slot of the Seurat object.
  By default, if you do the tSNE without computing the clusters and you have the correct metadata in the object, the labels should be pointing to your timepoints not to the clusters. 
  If it is not the case, what you have to do its to change this slot to reflect to which timepoint belong each cell you are plotting. 
  For instance if your Seurat object is called src:
  identity=as.factor(sampleInfo$timepoints)
  names(identity)=sampleInfo$cellName
  src@ident=identity
  
  And then plot the tSNE. Something like this should work after adapting it to your metadata.
  
original_text: 4595: <p>I have plotted a tSNE plot of my 1643 cells from 9 time points by seurat like below as 9 clusters. But, you know I should not expected each cluster of cells contains only cells from one distinct time point. For instance, cluster 2 includes cells from time point 16, 14 and even few cells from time point 12. My question is, how I can change the colour of cells here so cells from each time point has a distinct colour does not matter some cells are being clustered somewhere else because this is unavoidable. I have named my cells already so I know cells from each time point but I want to colour cells to nine colours based on the time point they have been sequenced not the cluster they are being grouped by seurat. </p>
  
  <p>I first created a file in one column is name of my cells and in second colour the corresponding time point </p>
  
  <p>Like so</p>
  
  <pre><code>    time
  s0.1    h0
  s0.2    h0
  s0.3    h0
  s0.4    h0
  s0.5    h0
  s0.6    h0
  s0.7    h0
  s0.8    h0
  s0.9    h0
  s0.10   h0
  s0.11   h0
  s0.12   h0
  s0.13   h0
  s0.14   h0
  s0.15   h0
  s0.16   h0
  s0.17   h0
  s0.18   h0
  s0.19   h0
  s0.20   h0
  s0.21   h0
  s0.22   h0
  s0.23   h0
  s0.24   h0
  s0.25   h0
  </code></pre>
  
  <p>I read my file</p>
  
  <pre><code>time &lt;- read.table("time.txt",header = TRUE)
  seurat@meta.data$time &lt;- time
  TSNEPlot(object = seurat, group.by = "time")
  </code></pre>
  
  <p>Sorry in my code colour of tSNE changed also the position of cells changed that I don't want that. I want to change the color of cells but they are still in the same cluster</p>
  
  <p>says that    </p>
  
  <pre><code>&gt; TSNEPlot(object = al)
  Error in seq.default(h[1], h[2], length.out = n) : 
    'to' must be a finite number 
  </code></pre>
  
  <p>when I changed <code>names(identity)=sampleInfo$cellName</code> to <code>names(identity)=src$cellName</code></p>
  
  <p>that worked but again the position of cells changed that I don't want that :(</p>
   678: <p>Seurat puts the label in the tSNE plot according to the <strong>@ident</strong> slot of the Seurat object.</p>
  
  <p>By default, if you do the tSNE without computing the clusters and you have the correct metadata in the object, the labels should be pointing to your timepoints not to the clusters. </p>
  
  <p>If it is not the case, what you have to do its to change this slot to reflect to which timepoint belong each cell you are plotting. </p>
  
  <p>For instance if your Seurat object is called src:</p>
  
  <pre><code>identity=as.factor(sampleInfo$timepoints)
  names(identity)=sampleInfo$cellName
  src@ident=identity
  </code></pre>
  
  <p>And then plot the tSNE. Something like this should work after adapting it to your metadata.</p>
  