我正在嘗試制作一個像這里顯示的那樣的單一基因覆寫圖。

我已經繪制了覆寫率,但我仍然需要在相應的坐標中插入外顯子和內含子。謝謝!我的代碼:
ggplot(z, aes(x=inicio, y=promedio, fill=Technology, group=Technology, color=Technology))
stat_smooth(
geom = 'area', method = 'loess', span = 1/3,
alpha = 1/2)
scale_x_continuous(limits=c(30689060,30748122))
theme_set(theme_bw())
theme(legend.text = element_text (size = 12))
xlab("Coordinates")
ylab("Depth")
ggtitle("TEX15")

uj5u.com熱心網友回復:
如果沒有包含一些輸入資料和預期輸出的最小可重現示例(MRE),就很難知道如何為您提供幫助。例如,這是一個帶有一些“假”資料的 MRE:
library(tidyverse)
df <- data.frame(Coverage = runif(1000, 0, 7900))
p1 <- df %>%
ggplot(aes(x = Coverage))
geom_density(outline.type = "full", fill = "#D6B7C9")
theme_minimal(base_size = 14)
theme(axis.title.x = element_blank())
features1 <- tribble(~"feature", ~"start", ~"end",
"E1", 1, 1950,
"E5", 2986, 3237,
"L1", 4775, 6292)
features2 <- tribble(~"feature", ~"start", ~"end",
"E2", 1892, 2989,
"L2", 3373, 4794,
"E6", 7125, 7601,
"E7", 7604, 7900)
p2 <- features1 %>%
ggplot()
geom_rect(aes(xmin = start, xmax = end,
ymin = 0, ymax = 1,
fill = feature),
color = "black")
geom_text(aes(x = (start end) / 2, y = 0.5, label = feature))
theme_void()
theme(legend.position = "none")
p3 <- features2 %>%
ggplot()
geom_rect(aes(xmin = start, xmax = end,
ymin = 0, ymax = 1,
fill = feature),
color = "black")
geom_text(aes(x = (start end) / 2, y = 0.5, label = feature))
theme_void()
theme(legend.position = "none")
library(patchwork)
p1 / p2 / p3 plot_layout(nrow = 3, heights = c(1, 0.1, 0.1))

由reprex 包于 2022-06-16 創建(v2.0.1)
這種方法是否適合您的單基因覆寫圖?如果不是,你想改變什么?
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/493122.html
上一篇:繪制GAM(繪圖輸出中的錯誤)
下一篇:R:如何在情節中修改圖例?
