在Graph(ggplot2)中标记标题,并带有另一个文件的标签

在我的程序中,我有两个主要文件,第一个是数据,第二个是标签(或图形标题):

文件总数1(数据)

3   10000   3   32039232    1   0.0017290351    2   0.0002781092
3   10001   3   32101193    1   0.0045398899    2   0.0032875689
3   1000    1   60233253    1   0.0022057964    2   6.747e-06
3   10002   3   32108182    1   0.0219913914    2   0.0102120679
3   10003   3   32133994    1   0.0007025013    2   0.0010197563
3   10004   3   32192498    1   0.0029210855    2   0.0036980008
3   10005   3   32230041    1   0.0005408603    2   0.0015782048
3   10006   3   32271305    1   1.099e-07       2   0.0033466856
3   10007   3   32289336    1   0.0185812303    2   0.0027349589
3   10008   3   32453784    1   0.0080117379    2   0.0003596759

文件腿(标签)

Áre de olho de lombo
Espessura de gordura subcutânea
pH0 inicial 
pH24 final
Perda por cocção
Força de cisalhamento
Cor L*
Cor a*
Cor b* 

我在同一块bash卡上同时使用linux命令和R来绘制图形。 我在做这个脚本循环:

!/斌/庆典

对于{1..9}中的l; 做

R -q -e“leg <-read.table('leg',header = F,sep =' t'); write.table(leg,'lef1.txt',sep =' t',row。 names = F,col.names = F); uni $ l <-read.table('./ var / chrsnpvar_uni $ l',header = F); bi $ l <-read.table('./ var / chrsnpvar_bi $ l',header = F); map <-read.table('snp_map_clean',sep =' t',header = F); uni1 $ l = uni $ l [(uni $ l [,1] = = 1&uni $ l [,2] == 3),]; bi1 $ l = bi $ l [bi(bi,l [,1] == 2&bi $ l [,2] == 3), ]; total $ l < - merge(uni1 $ l,bi1 $ l,by = c(2,4,5,6),all = T); write.table(total $ l,'total $ l.txt' ,'./ solution / cor $ l.tiff',width = 10,height = 6,units = 'in',res = 75); ggplot(total $ l,aes(x = total $ l [,6],y = total $ l [,8]))+ geom_point()+ scale_x_continuous(breaks = round(seq (min(0),max(0.08),by = 0.01),2),limits = c(0,0.08))+ scale_y_continuous(break = round(seq(min(0),max(0.08))= 0.01 ),2),limits = c(0,0.08))+ geom_smooth(method = lm,color ='grey35',se = FALSE)+ geom_vline(xintercept = quantile(total $ l [,6],0.95) = 2,size = 1,color ='gray')+ geom_hline(yintercept = q (主语)(主语)(主语)(主语)(主语)(主语)(主语) .line.x = element_line(color ='black',size = 1),axis.line.y = element_line(color ='black',size = 1),axis.ticks.length = unit(4,'mm' ),legend.title = element_blank(),axis.title.y = element_text(size = 22),axis.title.x = element_text(size = 22),axis.text.x = element_text(size = 22),axis .text.y = element_text(size = 22),legend.text = element_text(size = 22),title = element_text(size = 22))+ annotate('text',x = 0.005,y = 0.07,label =' A',size = 8)+ annotate('text',x = 0.06,y = 0.07,label ='B',size = 8)+ annotate('text',x = 0.005,y = 0.005,label =' C',color ='white',size = 8)+ annotate('text',x = 0.06,y = 0.005,label ='D',size = 8)+ ggtitle(leg [$ l,1]); dev.off()”

DONE

该程序是好的,我只需要在我的图形标题中以下标形式写入“pH24最终”的24个和“pH0 Inicial”的0个,从标签文件写出标题,我使用命令ggtitle(leg[$l,1]) 。 有谁知道我可以通过使用另一个文件的标签来做到这一点?

链接地址: http://www.djcxy.com/p/68927.html

上一篇: Subscript a title in a Graph (ggplot2) with label of another file

下一篇: Arrange common plot width with facetted ggplot 2.0.0 & gridExtra