【问题标题】:How to enlarge a gene map plot?如何放大基因图谱?
【发布时间】:2018-10-13 20:45:01
【问题描述】:

我正在做基因序列分析,我有一个基因组,我已经绘制了基因及其蛋白质的图,但是情节非常繁忙,当我编织我的 R 降价以呈现图像时,它被切断了。不知道从哪里开始如何调整它,任何帮助将不胜感激。这是它的代码:

library(tidyverse)
library(ggplot2)
library(devtools)
install_github("wilkox/gggenes")
library(gggenes)
gene_prediction <-read.csv('~/genome1table.csv', header=TRUE, sep=',')
gene_names<-c(gene_prediction$Gene)
starts <- c(gene_prediction$Start)
ends<-c(gene_prediction$End)
strand<-c(gene_prediction$Strand)
genome_name<-rep('Genome',62)

dfgenome1map<-data.frame(genome_name=genome_name, name=gene_names, start=starts, end=ends, category=category, strand=strand)

dfgenome1map$direction<- ifelse(dfgenome1map$strand == "+", 1, -1)

ggplot(dfgenome1map, aes(xmin=start, xmax=end, y='', 
           fill=category, 
           label=gene_names, forward= direction)) + 
  geom_gene_arrow() +
  geom_gene_label(align = "center") +
  labs(x='locus (bp)', fill='VOG category')+
  theme_genes() + 
  scale_color_continuous() +
  theme(axis.title.y = element_blank(),
    axis.title.x=element_text())

这在我的 R 降价中看起来像这样,但蛋白质的键应该更大:

【问题讨论】:

    标签: r plot ggplot2


    【解决方案1】:

    你把块粘贴到这里了吗?

    您可以调整绘图大小:

    opts_chunk$set(fig.width = 15, fig.height = 15)
    

    15 是高值的示例。 在 RStudio 的最新版本中,您在右上角有块选项。

    输出文件是什么? HTML/docx/pdf ?

    您还可以在 .Rmd(YAML)的开头指定选项:

    ---
    title: "xxx"
    output:
      html_document:
        fig_width: 15
        fig_height: 15
        fig_caption: true
    ---
    

    【讨论】:

    • 输出为html
    • 这似乎可以改变我的基因图之后的图表,但我的基因图保持不变。我将 pts_chunk$set(fig.width = 15, fig.height = 15) 放在我的 ggplot(dfgenome1map, line, 对吗?
    • 您可以尝试更改 YAML 中的选项(Rmd 文件的标头)。
    猜你喜欢
    • 2015-02-04
    • 2018-08-30
    • 1970-01-01
    • 1970-01-01
    • 2016-03-22
    • 2016-05-25
    • 2019-09-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多