ggplot2绘制曲线图

2024-06-10  本文已影响0人  小陈生信日记

library('ggplot2')

setwd("C:/bin")

data <- read.table('result_pita_results.tab', sep="\t", header=TRUE)

ddG_counts <- as.data.frame(table(data$ddG))

colnames(ddG_counts) <- c("ddG", "Count")

# 使用 ggplot2 绘制图表

p=ggplot(ddG_counts, aes(x = ddG, y = Count)) +

  geom_bar(stat = "identity", width = 0.5) +

  labs(x = "ddG 值", y = "UTR 的个数", title = "ddG 值与 UTR 的个数关系") +

  theme_minimal()

ddG_counts <- as.data.frame(table(data$ddG))

colnames(ddG_counts) <- c("ddG", "Count")

# 将 ddG 列转换为数值类型

ddG_counts$ddG <- as.numeric(as.character(ddG_counts$ddG))

# 使用 ggplot2 绘制图表

p1=ggplot(ddG_counts, aes(x = ddG, y = Count)) +

  geom_point(size = 3) +

  geom_line() +

  labs(x = "ddG 值", y = "UTR 的个数", title = "ddG 值与 UTR 的个数关系") +

  theme_minimal()

ddG_counts <- as.data.frame(table(data$ddG))

colnames(ddG_counts) <- c("ddG", "Count")

# 将 ddG 列转换为数值类型

ddG_counts$ddG <- as.numeric(as.character(ddG_counts$ddG))

# 使用 ggplot2 绘制图表

p3=ggplot(ddG_counts, aes(x = ddG, y = Count)) +

  geom_smooth(method = "loess", span = 0.25, se = FALSE) +

  labs(x = "ddG value", y = "miRNA and mRNA interactions number") +

  theme_minimal()

p3

上一篇 下一篇

猜你喜欢

热点阅读