def makePerSiteBoxPlot(self): """ This function makes a box-and-whisker plot showing the evaluation scores grouped by the image scan type. """ pp = pdfpages('ImageEvalBoxplots_perScanType_perSite.pdf') site_list = self.getListFromDB("SELECT DISTINCT project FROM ImageEval;") for site in site_list: (all_evals, x_labels, scanTypeList) = self.getEvalScoresAndXticks(site) boxplot(all_evals) ylim(-0.1, 10.1) xticks( arange(1, len(scanTypeList)+1), x_labels, fontsize = 'medium') yticks(fontsize = 'large') xlabel("\n \n Image Scan Type (Ratio of Scores Greater Than 5 to Total Scores)", fontsize = 'large') ylabel("Evalution Scores \n", fontsize = 'large') title('Evaluation Scores for Site {0} Grouped by Image Scan Type \n \n'.format(site), fontsize = 'large') subplots_adjust(bottom = 0.2, top = 0.86, right = .88, left = 0.15) pp.savefig() hold(False) pp.close()
def makePerSiteWhiskerPlots(self): """ This function makes a box-and-whisker plot showing the evaluation scores grouped by the image scan type. """ pp = pdfpages('test.pdf') #pp = pdfpages('ImageEvalBoxplots_perScanType_perSite.pdf') siteList = self.AllEvalDict.keys() # makes a list of all site locations siteList = sort(siteList) # sorts the list of site locaitons scanTypeList = [u'T1-30', u'T2-30', u'T1-15', u'PDT2-15', u'T2-15', u'PD-15'] for site in siteList: SiteObject = self.AllEvalDict[site] # sets the site object to a variable for easier identification later allEvals = list() # makes an empty list which will contain all eval scores xLabels = list() # makes an empty list for x labels for scanType in scanTypeList: if scanType in SiteObject.Evals.keys(): evalScores = SiteObject.Evals[scanType] allEvals.append(evalScores) # appends the eval scores for this scan type to allEvals # appends the scan type and the number of scans for this type to the xLabel list Count = self.findEvalsGreaterThan5(evalScores) xLabels.append(scanType + "\n (" + str(Count) + "/" + str(len(evalScores)) + ")") else: emptyList = list() allEvals.append(emptyList) # appends the eval scores for this scan type to allEvals # appends the scan type and the number of scans for this type to the xLabel list xLabels.append(scanType + "\n (0)") boxplot(allEvals) ylim(-0.1, 10.1) # sets the y scale limits between -0.1 and 10.1 since scores are only between 0 and 10 xticks( arange(1,len(scanTypeList)+1), xLabels, fontsize = 'medium') # assigns the x labels and fontsize yticks(fontsize = 'large') # assigns y ticks fontsize to large xlabel("\n \n Image Scan Type (Ratio of Scores Greater Than 5 to Total Scores)", fontsize = 'large') ylabel("Evalution Scores \n", fontsize = 'large') title('Evaluation Scores for Site {0} Grouped by Image Scan Type \n \n'.format(site), fontsize = 'large') #subplots_adjust(bottom = 0.2, top = 0.88, right = 0.8, left = 0.2) subplots_adjust(bottom = 0.2, top = 0.86, right = .88, left = 0.15) subplots_adjust() pp.savefig() hold(False) pp.close()
def create_figures(conf_list, figure_data, pdf_out_file): print("Creating figures ... " + pdf_out_file) # create one pdf document with all figures pdf_pages = pdfpages(pdf_out_file) # loop over variables for conf in conf_list: # debug print(conf) # name, unit, data name = conf["name"] data = np.array(figure_data[name]) * conf["scale"] unit = conf["unit"] # plot fig = plt.figure() plt.plot(data, 'k') plt.title("%s" % name) plt.xlabel("model years") plt.ylabel("[%s]" % unit) # store pdf_pages.savefig(fig) # close figure plt.close() # close pdf doc pdf_pages.close()