Skip to content

Commit

Permalink
Added option for plot image file type
Browse files Browse the repository at this point in the history
  • Loading branch information
rstraver committed Oct 8, 2015
1 parent 3b37ea1 commit 5a573a3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import matplotlib
import argparse

def plotResults(sample, markedBins, kept, kept2, outputFile, zScoresDict,zSmoothDict,blindsDict,wastedBins,sampleName):
def plotResults(sample, markedBins, kept, kept2, outputFile, zScoresDict,zSmoothDict,blindsDict,wastedBins,sampleName,fileType):
import matplotlib.pyplot as plt
from matplotlib.collections import BrokenBarHCollection

Expand Down Expand Up @@ -132,7 +132,7 @@ def preparePlot(chrom):

ax.legend((lRed, lBlue, bLGreen, bDGreen, bPink, bPurple, bLGrey, bGrey), ('Z-score windowed method', 'Z-score individual bin method', 'Detected deviation by individual bin method', 'Called by individual bin method', 'Detected deviation by windowed method', 'Called by windowed method', 'Not enough reference bins available', 'Unmappable region'), 'lower left',prop={'size':6}, mode='expand', ncol=4)

plt.savefig(outputFile+'.pdf',figsize=(11.7, 8.3),dpi=160)
plt.savefig(outputFile+'.'+fileType,figsize=(11.7, 8.3),dpi=160)


if __name__ == "__main__":
Expand All @@ -147,6 +147,9 @@ def preparePlot(chrom):

parser.add_argument('-mpluse', default='agg', type=str,
help='make matplotlib use another backend for plotting')

parser.add_argument('-filetype', default='pdf', type=str,
help='make save plot as filetype instead of pdf')

args = parser.parse_args()

Expand Down Expand Up @@ -175,6 +178,7 @@ def preparePlot(chrom):
sampleData['zSmoothDict'], \
sampleData['blindsDict'], \
sampleData['wastedBins'], \
sampleName
sampleName, \
args.filetype
)
print '\n# Finished'

0 comments on commit 5a573a3

Please sign in to comment.