How to generate a stripplot like this in Python or R?
1
2
Entering edit mode
5.7 years ago

How to generate a stripplot like this in Python or R?

enter image description here

Thank you so much in advance.

RNA-Seq visualization python R • 2.3k views
ADD COMMENT
0
Entering edit mode

in R you can just make a scatter plot in something like ggplot2. You could use facets per gene.

ADD REPLY
0
Entering edit mode

enter image description here

Another example is here. I don't think the author used facet to draw this. It seems that it used a special version of jitter (ordered).

ADD REPLY
0
Entering edit mode
  1. do a box plot and jitter.
  2. Do not draw box plot boundaries and let median line be there.
  3. Do facet (or equivalent with mfrow) per gene
ADD REPLY
1
Entering edit mode

usually, jitter in boxplot only generates some noise in x-axis to avoid overlapping. I don't know how to do it in an ordered manner. Can you show some code snippet? Thank you.

ADD REPLY
0
Entering edit mode
ADD REPLY
1
Entering edit mode
5.7 years ago

some thing like this ?

Rplot

codeL

library(dplyr)
library(tidyr)
df=data.frame(s1=rnorm(1000,0,10), s2=rnorm(1000,1,10), s3=rnorm(1000,2,10))
library(ggplot2)
df1=gather(df,"sample","value")

ggplot(df1, aes(x = sample, y = value)) +
  geom_point(aes(color=sample)) +
  stat_summary(
    fun.y = median,
    fun.ymin = median,
    fun.ymax = median,
    geom = "crossbar",
    color = "red",
    width=0.2,
    linetype = "dotted"
  )+
  ylim(-100,100)+
  theme_bw()+
  theme(legend.position="none")
ADD COMMENT

Login before adding your answer.

Traffic: 1649 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6