In my program I have two main files, the first with the data and the second with labels (or titles of my graphics):
File total1 (data)
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
File leg (labels)
Á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*
I am using linux commands and R simultaneously on the same bash card, to plot graphs. I'm doing looping in this script:
!/bin/bash
for l in {1..9}; do
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[ which(uni$l[,1]==1 & uni$l[,2]==3), ]; bi1$l=bi$l [ which(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', sep='\t', row.names = F,col.names=F);library(ggplot2);tiff('./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(breaks = round(seq(min(0), max(0.08), by = 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),lty=2,size=1,colour='grey')+ geom_hline(yintercept = quantile(total$l[,8], .95), lty=2,size=1,colour='grey') + ylab('Bicaracterística') + xlab('Unicaracterística')+ theme_classic()+ theme(axis.line.x=element_line(colour='black',size=1),axis.line.y=element_line(colour='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', colour='white', size=8)+ annotate('text', x = 0.06, y=0.005, label = 'D',size=8)+ggtitle(leg[$l,1]); dev.off()"
done
The program is ok, I just need to write the 24 of "pH24 final" and 0 of "pH0 Inicial" in subscript form in my graphic titles, to write the titles from the label file I am using the commandggtitle(leg[$l,1])
. Does anyone know how I can do this by using the label of another file?