I figured out how to plot graphs in loop with the print
but it is printing 2 plots per line and getting cutoff. Even when I add cat("\n")
it still has 2 plots per line. How to print 1 plot per line?
for (clust in intersecting.001.2.unlog) {
ex <- row.names(map[map$transcript_cluster_id == clust, ])
Clotrimazole.exon <- Clotrimazole.e[ex,]
Clotrimazole.gene <- Clotrimazole.g[as.character(clust),]
Chlorhexidine.exon <- Chlorhexidine.e[ex,]
Chlorhexidine.gene <- Chlorhexidine.g[as.character(clust),]
# https://stackoverflow.com/questions/11956520/r-knitr-markdown-output-plots-within-for-loop
print(plot.exons(exonx.drug1=Clotrimazole.exon,
genex.drug1=as.numeric(Clotrimazole.gene),
rx.drug1=Clotrimazole.r,
exonx.drug2=Chlorhexidine.exon,
genex.drug2=as.numeric(Chlorhexidine.gene),
rx.drug2=Chlorhexidine.r,
ti=clust))
}
for (clust in intersecting.001.2.unlog) {
ex <- row.names(map[map$transcript_cluster_id == clust, ])
Clotrimazole.exon <- Clotrimazole.e[ex,]
Clotrimazole.gene <- Clotrimazole.g[as.character(clust),]
Chlorhexidine.exon <- Chlorhexidine.e[ex,]
Chlorhexidine.gene <- Chlorhexidine.g[as.character(clust),]
# https://stackoverflow.com/questions/11956520/r-knitr-markdown-output-plots-within-for-loop
print(plot.exons(exonx.drug1=Clotrimazole.exon,
genex.drug1=as.numeric(Clotrimazole.gene),
rx.drug1=Clotrimazole.r,
exonx.drug2=Chlorhexidine.exon,
genex.drug2=as.numeric(Chlorhexidine.gene),
rx.drug2=Chlorhexidine.r,
ti=clust))
cat("\n")
}