#添加文字注释
p1 ggplot2::annotate("text", x=6, y=1, label="This is a text\n annotation!")
#添加线条
p1 ggplot2::annotate("segment", x=1, xend = 3, y=1.5, yend = 1.5, size=3)
#添加图形注释
p1 ggplot2::annotate("rect", xmin = 6.5, xmax = 7.5, ymin = -0.05, ymax = 0.8,
alpha=0.2, col="grey", fill="green")
#模板代码
library(ggplot2)
col1<-make_col_scheme(chars = c("A","G", "T", "C"),
groups = c("g1","g2", "g3","g4"),
cols = c("red","green","blue","yellow"))#自定义配色
ggplot() geom_logo(df1$MA0018.2,#数据
method="bits",#方法
seq_type="dna",#序列类型
col_scheme=col1,#配色方案
font="xkcd_regular",#字体
stack_width=0.8#字母宽度
)
annotate("text", x=5.5, y=2, color='red',label="This is a text\n annotation!")
annotate("segment", x=4.5, xend = 6.5, y=1.6, yend = 1.6, size=3)
annotate("rect", xmin = 2.5, xmax = 3.5, ymin = -0.05, ymax = 2.05,
alpha=0.2, col="grey", fill="green")
theme_logo()