Scatter plot 5

Category: scatter

something went wrong... here should be a figure
library(tidyverse)
library(ggExtra)
library(viridis)

cells <- tibble(
  cell = colnames(transcripts$raw$merged),
  nCount = colSums(transcripts$raw$merged),
  nFeature = colSums(transcripts$raw$merged != 0)
)

cells %>% glimpse()
# Observations: 6,000
# Variables: 3
# $ cell     <chr> "TGCCCATGTGTTCGAT-A", "ACGGCCACAAGAAGAG-A", "CTGTGCTGTCAGAAG…
# $ nCount   <dbl> 5784, 6037, 4655, 42398, 14765, 4621, 14368, 4570, 6635, 113…
# $ nFeature <dbl> 1655, 1397, 1300, 5387, 2548, 295, 2929, 1056, 1720, 638, 27…

p <- ggplot(cells, aes(nCount, nFeature)) +
  geom_pointdensity(adjust = 500) +
  scale_x_continuous(name = 'Number of transcripts', labels = scales::comma) +
  scale_y_continuous(name = 'Numner of expressed genes', labels = scales::comma) +
  scale_color_viridis() +
  theme_bw() +
  theme(legend.position = 'none')
p <- ggMarginal(p, type = 'histogram', fill = 'grey', bins = 50)

ggsave('5.png', p, height = 4, width = 6)