<p>On top of M__'s suggestion to reduce the point alpha, here are a few other things you can implement to make your figures cleaner:</p>
<p>Remove grid lines from the panel backgrounds</p>
<pre><code>theme(panel.grid.major = element_blank(),
      panel.grid.minor = element_blank())
</code></pre>
<p>I think a figure legend like the one you have now is a better approach than labeling every cell type in every facet. However, if you still want to go that route, I suggest implementing repulsive labels with the <a href="https://cran.r-project.org/web/packages/ggrepel/vignettes/ggrepel.html" rel="nofollow noreferrer">ggrepel package</a>. <code>geom_label_repel()</code> can also be applied to your percentages so they are not overlapping.</p>

CC BY-SA 4.0
2022-02-09T18:54:31.547Z
Agreed, BTW I like the user icon
M__
CC BY-SA 4.0
2022-02-09T19:04:33.157Z
Phage are phantastic!
acvill
CC BY-SA 4.0
2022-02-09T19:22:20.823Z
Except for bacteria :-/
M__
CC BY-SA 4.0
2022-02-09T18:40:17.703Z
2022-02-09T18:40:17.703Z
acvill
<p>Try</p>
<pre><code>p6 + geom_point(alpha = 1/100)
</code></pre>
<p>And variations of 1/10 to 1/1000, this will give a better idea of point density.</p>

CC BY-SA 4.0
2022-02-09T14:57:05.360Z
2022-02-09T18:06:32.737Z
2022-02-09T18:06:32.737Z
M__
<p>I have generated a ggplot for 8 single-cell libraries, with the purpose of visualizing the tSNE facet plot by sample, colored by cell type -- with percentages. The best I could get to is this -</p>
<p><a href="https://i.sstatic.net/2vUiy.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/2vUiy.png" alt="enter image description here" /></a></p>
<p>however, it looks too crowded, and I also want the cell types to be labeled for each cluster, which makes it look even worse.<br />
How can I improve the data visualization here?</p>
<p>my code:</p>
<pre><code>p6 &lt;- ggplot(tsnePlot, aes(x=tSNE_1, y=tSNE_2, color=RefinedCellTypes)) + 
  scale_color_manual(values=refinedCellTypeColors) +
  geom_point(data = tsnePlotAll, mapping = aes(x=tSNE_1, y=tSNE_2), size = 1, alpha = 1, color = &quot;grey75&quot;) +
  geom_point(size = 1, alpha = 1) +
  geom_text(data = tsneClusterLabelsRefined, mapping = aes(x = tSNE_1, y = tSNE_2, label = CellType),color=&quot;black&quot;,size=0.75,hjust=0) +
  geom_label(data = tsneCellTypeFractions, mapping = aes(x = tSNE_1, y = tSNE_2, label = scales::percent(Freq,accuracy = 0.1)),color=&quot;black&quot;,fill = &quot;white&quot;, alpha = 0.5, label.size = 0) +
  facet_wrap(~Sample) +
  theme_bw(base_size = 12) +
  theme(legend.position=&quot;left&quot;,
        axis.text=element_text(size=12, color = &quot;black&quot;),
        axis.title=element_text(size=10))
</code></pre>
<p>Is there any way I can control the number of cols/rows for the figure?</p>

<scrnaseq><single-cell><visualization><ggplot2>
Arrange ggplot Figure for scRNA-seq data
# Arrange ggplot Figure for scRNA-seq data

(Asked by: username_0 on 2022-02-09)

I have generated a ggplot for 8 single-cell libraries, with the purpose of visualizing the tSNE facet plot by sample, colored by cell type -- with percentages. The best I could get to is this -

however, it looks too crowded, and I also want the cell types to be labeled for each cluster, which makes it look even worse.
How can I improve the data visualization here?
my code:
p6 <- ggplot(tsnePlot, aes(x=tSNE_1, y=tSNE_2, color=RefinedCellTypes)) + 
  scale_color_manual(values=refinedCellTypeColors) +
  geom_point(data = tsnePlotAll, mapping = aes(x=tSNE_1, y=tSNE_2), size = 1, alpha = 1, color = "grey75") +
  geom_point(size = 1, alpha = 1) +
  geom_text(data = tsneClusterLabelsRefined, mapping = aes(x = tSNE_1, y = tSNE_2, label = CellType),color="black",size=0.75,hjust=0) +
  geom_label(data = tsneCellTypeFractions, mapping = aes(x = tSNE_1, y = tSNE_2, label = scales::percent(Freq,accuracy = 0.1)),color="black",fill = "white", alpha = 0.5, label.size = 0) +
  facet_wrap(~Sample) +
  theme_bw(base_size = 12) +
  theme(legend.position="left",
        axis.text=element_text(size=12, color = "black"),
        axis.title=element_text(size=10))

Is there any way I can control the number of cols/rows for the figure?

**Tags:** scrnaseq, single-cell, visualization, ggplot2

---

## 2 answers

### Answer by username_1 on 2022-02-09. Score: 3

On top of M__'s suggestion to reduce the point alpha, here are a few other things you can implement to make your figures cleaner:
Remove grid lines from the panel backgrounds
theme(panel.grid.major = element_blank(),
      panel.grid.minor = element_blank())

I think a figure legend like the one you have now is a better approach than labeling every cell type in every facet. However, if you still want to go that route, I suggest implementing repulsive labels with the ggrepel package. geom_label_repel() can also be applied to your percentages so they are not overlapping.

> **Comments:**
> **username_2**: Agreed, BTW I like the user icon  
> **username_1**: Phage are phantastic!  
> **username_2**: Except for bacteria :-/  

---

### Answer by username_2 on 2022-02-09. Score: 1

Try
p6 + geom_point(alpha = 1/100)

And variations of 1/10 to 1/1000, this will give a better idea of point density.


---

