text: user3968: I am analysing singe cell sequence data and I have followed this tutorial, https://satijalab.org/seurat/pbmc3k_tutorial.html to perform QC and various differential analyses using the Seurat package on my data up till now.
  How can I rearrange on the resulting plot, the order in which the groups of my samples appear when I use the FeatureHeatmap() function to visualise the differential gene expression of Gene1 and Gene2 across the cell clusters?
  FeatureHeatmap(object = object, features.plot = c("Gene1", "Gene2"), 
                 group.by = "Conditions",
                 pt.size = 0.25, key.position = "top",
                 max.exp = 3)
  
  produces:
  
  but I want:
  
  
  user3415: I don't think this is possible in Seurat v2, but in v3 you can change the factor levels of the grouping variable to change the plot order:
  library(Seurat)
  
  FeaturePlot(object = pbmc_small,
              features = head(VariableFeatures(pbmc_small), 2),
              split.by = 'groups')
  
  
  Change the order:
  pbmc_small$groups <- factor(pbmc_small$groups, levels = c('g2', 'g1'))
  
  FeaturePlot(object = pbmc_small,
              features = head(VariableFeatures(pbmc_small), 2),
              split.by = 'groups')
  
  
  
original_text: 3968: <p>I am analysing singe cell sequence data and I have followed this tutorial, <a href="https://satijalab.org/seurat/pbmc3k_tutorial.html" rel="nofollow noreferrer">https://satijalab.org/seurat/pbmc3k_tutorial.html</a> to perform QC and various differential analyses using the Seurat package on my data up till now.</p>
  
  <p>How can I rearrange on the resulting plot, the order in which the groups of my samples appear when I use the <code>FeatureHeatmap()</code> function to visualise the differential gene expression of Gene1 and Gene2 across the cell clusters?</p>
  
  <pre><code>FeatureHeatmap(object = object, features.plot = c("Gene1", "Gene2"), 
                 group.by = "Conditions",
                 pt.size = 0.25, key.position = "top",
                 max.exp = 3)
  </code></pre>
  
  <p>produces:
  <a href="https://i.stack.imgur.com/HsHVd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HsHVd.png" alt="enter image description here"></a></p>
  
  <p>but I want:
  <a href="https://i.stack.imgur.com/QFkwQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QFkwQ.png" alt="enter image description here"></a></p>
   3415: <p>I don't think this is possible in Seurat v2, but in v3 you can change the factor levels of the grouping variable to change the plot order:</p>
  
  <pre><code>library(Seurat)
  
  FeaturePlot(object = pbmc_small,
              features = head(VariableFeatures(pbmc_small), 2),
              split.by = 'groups')
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/c51So.png" rel="noreferrer"><img src="https://i.stack.imgur.com/c51So.png" alt="enter image description here"></a></p>
  
  <p>Change the order:</p>
  
  <pre><code>pbmc_small<span class="math-container">$groups &lt;- factor(pbmc_small$</span>groups, levels = c('g2', 'g1'))
  
  FeaturePlot(object = pbmc_small,
              features = head(VariableFeatures(pbmc_small), 2),
              split.by = 'groups')
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Rg2BG.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Rg2BG.png" alt="enter image description here"></a></p>
  