美文网首页
ggplot2绘制曲线图

ggplot2绘制曲线图

作者: 小陈生信日记 | 来源:发表于2024-06-10 00:00 被阅读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

    相关文章

      网友评论

          本文标题:ggplot2绘制曲线图

          本文链接:https://www.haomeiwen.com/subject/eqeyzdtx.html