Dear all,
I have a set of unordered data
for example: scaffold 16 was started from 0.05 mbp to 0.85 mbp but scaffold 18 was started again from 0.05.
I am planning to make "Mbp" as X axis and "Pvalue" as Y axis. However, the scaffold data overlap each other.
Does anyone know how to make a graph with thise data witout overlapping each other?
This is my script
#Chromosome
library(tidyverse)
library(ggplot2)
data1 = read.csv("data1.csv", header=T)
data2 = read.csv("data2.csv", header=T)
datas = bind_rows(
data1 %>% mutate(row = row_number()) %>% mutate(df = "A"),
data2 %>% mutate(row = row_number()) %>% mutate(df = "B"))
# fig theme ##############################################################
mytheme = theme_gray() + theme (panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_blank(),
axis.line = element_line(colour = "black"),
legend.title=element_blank(),
axis.title.x = element_text(size = 15),
axis.title.y = element_text(size = 20),
text = element_text(size=20),
axis.text.y = element_text(hjust=0)
+ annotate (geom = "rect",
color = "#D5D8DC",
fill = "#D5D8DC", alpha = 0.4)
)
theme_set(mytheme)
# Wiring fig ##############################################################
A = ggplot(datas, aes(Mbp, Pvalue, color = df))+
geom_jitter(size = 1, alpha = 0.4, width = 0.2) +
geom_hline(yintercept=1.4,linetype="dashed") +
xlim(-0.1, 20) +
ylim(0, 50) +
ylab("-Log10(P)") +
xlab("") +
scale_color_manual(values = c("#0F34E1", "orange"))
A = A + ggtitle("Chromosom")
These are the data
data1
data2
Please help me.